Commit 5ddfe553 authored by Florian Wittkamp's avatar Florian Wittkamp

CLEANUP: Removed HESSIAN

Removed the option HESSIAN from the code.
parent 94ebed93
......@@ -28,7 +28,7 @@
void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, float C_vp, float ** gradp, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float FC){
extern int NX, NY, IDX, IDY, SPATFILTER, GRAD_FILTER;
extern int HESSIAN, INVMAT, SWS_TAPER_GRAD_VERT, SWS_TAPER_GRAD_HOR, SWS_TAPER_GRAD_SOURCES, SWS_TAPER_FILE;
extern int INVMAT, SWS_TAPER_GRAD_VERT, SWS_TAPER_GRAD_HOR, SWS_TAPER_GRAD_SOURCES, SWS_TAPER_FILE;
extern int POS[3], MYID, ACOUSTIC;
extern char JACOBIAN[STRING_SIZE];
extern int RESTART_WORKFLOW;
......@@ -48,7 +48,7 @@ void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int
/* ===================================================== GRADIENT ZP ================================================================================== */
/* ===================================================================================================================================================== */
if((HESSIAN!=1)&&(INVMAT==0)){
if((INVMAT==0)){
/* Preconditioning of the gradient */
/* ------------------------------- */
......@@ -285,7 +285,7 @@ void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int
/* ===================================================== GRADIENT Zs ================================================================================== */
/* ===================================================================================================================================================== */
if((HESSIAN!=1)&&(INVMAT==0)&&(!ACOUSTIC)){
if((INVMAT==0)&&(!ACOUSTIC)){
/* Preconditioning of the gradient */
/* ------------------------------- */
......@@ -515,7 +515,7 @@ void PCG(float ** waveconv, float ** taper_coeff, int nsrc, float ** srcpos, int
/* ===================================================== GRADIENT rho ================================================================================== */
/* ===================================================================================================================================================== */
if((HESSIAN!=1)&&(INVMAT==0)){
if((INVMAT==0)){
/* Preconditioning of the gradient */
/* ------------------------------- */
......
......@@ -28,7 +28,7 @@
void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int ntr_glob, int iter, int nfstart_jac, float ** waveconv_u, float C_vs, float ** gradp_u, float ** waveconv_rho, float C_rho, float ** gradp_rho, float Vs_avg, float FC){
extern int NX, NY, IDX, IDY, SPATFILTER, GRAD_FILTER;
extern int HESSIAN, INVMAT, SWS_TAPER_GRAD_VERT, SWS_TAPER_GRAD_HOR, SWS_TAPER_GRAD_SOURCES, SWS_TAPER_FILE;
extern int INVMAT, SWS_TAPER_GRAD_VERT, SWS_TAPER_GRAD_HOR, SWS_TAPER_GRAD_SOURCES, SWS_TAPER_FILE;
extern int POS[3], MYID, ACOUSTIC,WAVETYPE;
extern char JACOBIAN[STRING_SIZE];
......@@ -47,7 +47,7 @@ void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int
/* ===================================================== GRADIENT Zs ================================================================================== */
/* ===================================================================================================================================================== */
if((HESSIAN!=1)&&(INVMAT==0)&&(!ACOUSTIC)){
if((INVMAT==0)&&(!ACOUSTIC)){
/* Preconditioning of the gradient */
/* ------------------------------- */
......@@ -279,7 +279,7 @@ void PCG_SH(float ** taper_coeff, int nsrc, float ** srcpos, int ** recpos, int
/* ===================================================== GRADIENT rho ================================================================================== */
/* ===================================================================================================================================================== */
if((HESSIAN!=1)&&(INVMAT==0)){
if((INVMAT==0)){
/* Preconditioning of the gradient */
/* ------------------------------- */
......
This diff is collapsed.
......@@ -45,8 +45,8 @@ void exchange_par(void){
extern int RUN_MULTIPLE_SHOTS, TAPERLENGTH, INVTYPE;
extern int NPROC, NPROCX, NPROCY, MYID, IDX, IDY, CHECKPTREAD, CHECKPTWRITE;
extern int GRADT1, GRADT2, GRADT3, GRADT4, ITERMAX, INVMAT1, INVMAT, QUELLTYPB;
extern int HESSIAN, GRAD_METHOD, ORDER_HESSIAN;
extern float FC_HESSIAN, TSHIFT_back;
extern int GRAD_METHOD;
extern float TSHIFT_back;
extern int MODEL_FILTER, FILT_SIZE;
extern int FILT_SIZE_GRAD, GRAD_FILTER;
......@@ -165,8 +165,6 @@ void exchange_par(void){
fdum[39] = npower;
fdum[40] = k_max_PML;
fdum[41] = FC_HESSIAN;
fdum[42] = FC_START;
fdum[43] = FC_END;
fdum[44] = FC_INCR;
......@@ -271,14 +269,11 @@ void exchange_par(void){
idum[61] = nfstart_jac;
idum[62] = nf_jac;
idum[63] = SWS_TAPER_FILE;
idum[64] = HESSIAN;
idum[65] = GRAD_METHOD;
idum[66] = MODEL_FILTER;
idum[67] = FILT_SIZE;
idum[68] = ORDER_HESSIAN;
idum[69] = INV_STF;
idum[70] = N_STF;
idum[71] = N_STF_START;
......@@ -433,7 +428,6 @@ void exchange_par(void){
npower = fdum[39];
k_max_PML = fdum[40];
FC_HESSIAN = fdum[41];
FC_START = fdum[42];
FC_END = fdum[43];
......@@ -539,7 +533,6 @@ void exchange_par(void){
nfstart_jac = idum[61];
nf_jac = idum[62];
SWS_TAPER_FILE = idum[63];
HESSIAN = idum[64];
GRAD_METHOD = idum[65];
......@@ -547,8 +540,6 @@ void exchange_par(void){
FILT_SIZE = idum[67];
ORDER_HESSIAN = idum[68];
INV_STF = idum[69];
N_STF = idum[70];
N_STF_START = idum[71];
......
......@@ -42,8 +42,8 @@ char FILE_WORKFLOW[STRING_SIZE];
int TAPER, TAPERLENGTH, INVTYPE;
int GRADT1,GRADT2,GRADT3,GRADT4;
int ITERMAX, REC1, REC2, INVMAT1, INVMAT, QUELLTYPB;
int HESSIAN, GRAD_METHOD, ORDER_HESSIAN;
float FC_HESSIAN, TSHIFT_back;
int GRAD_METHOD;
float TSHIFT_back;
int MODEL_FILTER, FILT_SIZE;
float EPSILON, MUN, EPSILON_u, EPSILON_rho;
......
......@@ -43,8 +43,8 @@ void read_par_json(FILE *fp, char *fileinp){
extern char JACOBIAN[STRING_SIZE],DATA_DIR[STRING_SIZE],FREQ_FILE[STRING_SIZE];
extern int NPROCX, NPROCY, MYID, IDX, IDY, CHECKPTREAD, CHECKPTWRITE;
extern int GRADT1, GRADT2, GRADT3, GRADT4, ITERMAX, INVMAT1, INVMAT, QUELLTYPB;
extern int HESSIAN, GRAD_METHOD, ORDER_HESSIAN;
extern float FC_HESSIAN, TSHIFT_back;
extern int GRAD_METHOD;
extern float TSHIFT_back;
extern int FILT_SIZE, MODEL_FILTER;
extern int FILT_SIZE_GRAD, GRAD_FILTER;
......@@ -439,9 +439,6 @@ void read_par_json(FILE *fp, char *fileinp){
WAVETYPE=1;
fprintf(fp,"For acoustic modelling WAVETYPE is set to %d.\n",WAVETYPE);
}
if (HESSIAN && WAVETYPE!=1) {
err("No HESSIAN yet for SH");
}
if(WAVETYPE==3) {
if (get_int_from_objectlist("JOINT_INVERSION_PSV_SH_TYPE",number_readobjects,&JOINT_INVERSION_PSV_SH_TYPE,varname_list, value_list)){
JOINT_INVERSION_PSV_SH_TYPE=1;
......@@ -711,13 +708,6 @@ void read_par_json(FILE *fp, char *fileinp){
/* Hessian and Gradient-Method */
if (get_int_from_objectlist("HESSIAN",number_readobjects,&HESSIAN,varname_list, value_list)){
HESSIAN=0;
fprintf(fp,"Variable HESSIAN is set to default value %d.\n",HESSIAN);}
else
if(ACOUSTIC){
HESSIAN=0;
fprintf(fp,"For acoustic modelling currently only HESSIAN=%d possible.\n",HESSIAN);}
if (get_int_from_objectlist("GRAD_METHOD",number_readobjects,&GRAD_METHOD,varname_list, value_list))
err("Variable GRAD_METHOD could not be retrieved from the json input file!");
else {
......@@ -756,16 +746,6 @@ void read_par_json(FILE *fp, char *fileinp){
}
}
}
if (HESSIAN){
if (get_float_from_objectlist("FC_HESSIAN",number_readobjects,&FC_HESSIAN,varname_list, value_list))
err("Variable FC_HESSIAN could not be retrieved from the json input file!");
if (get_int_from_objectlist("ORDER_HESSIAN",number_readobjects,&ORDER_HESSIAN,varname_list, value_list))
err("Variable ORDER_HESSIAN could not be retrieved from the json input file!");
if (get_float_from_objectlist("TSHIFT_back",number_readobjects,&TSHIFT_back,varname_list, value_list)){
TSHIFT_back=0.0;
fprintf(fp,"Variable TSHIFT_back is set to default value %f.\n",TSHIFT_back);}
}
/* Definition of smoothing the models vp and vs */
if (get_int_from_objectlist("MODEL_FILTER",number_readobjects,&MODEL_FILTER,varname_list, value_list)){
......
......@@ -46,8 +46,8 @@ void write_par(FILE *fp){
extern int NP, NPROCX, NPROCY, MYID;
extern int GRADT1, GRADT2, GRADT3, GRADT4, ITERMAX, INVMAT1, INVMAT, QUELLTYPB;
extern int HESSIAN, GRAD_METHOD, ORDER_HESSIAN;
extern float FC_HESSIAN, TSHIFT_back;
extern int GRAD_METHOD;
extern float TSHIFT_back;
extern int FILT_SIZE, MODEL_FILTER;
extern int FILT_SIZE_GRAD, GRAD_FILTER;
......@@ -472,10 +472,6 @@ void write_par(FILE *fp){
fprintf(fp,"\n\n");
fprintf(fp," --------------- Calculation of the diagonal elements of the approximate Hessian matrix -------------------\n");
fprintf(fp," HESSIAN = %d \n",HESSIAN);
if(HESSIAN){
fprintf(fp," Approximate HESSIAN is calculated.\n");
fprintf(fp," FC_HESSIAN = %f, ORDER_HESSIAN = %d, TSHIFT_back=%f \n",FC_HESSIAN,ORDER_HESSIAN,TSHIFT_back);}
switch(GRAD_METHOD){
case 1:
fprintf(fp," GRAD_METHOD=%d: PCG\n",GRAD_METHOD);
......@@ -483,9 +479,6 @@ void write_par(FILE *fp){
case 2:
fprintf(fp," GRAD_METHOD=%d: LBFGS\n",GRAD_METHOD);
break;
case 3:
fprintf(fp," GRAD_METHOD=%d: LBFGS1\n",GRAD_METHOD);
break;
case 0: break; /* only forward modeling is applied */
default:
err(" Sorry, incorrect value for GRAD_METHOD ! \n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment