Commit d442058a authored by Florian Wittkamp's avatar Florian Wittkamp

Introduce EPRECOND_PER_SHOT_SH

parent 3b5377d2
......@@ -1687,6 +1687,7 @@ int main(int argc, char **argv){
if((!VERBOSE)&&(MYID==0)) fprintf(FP,"\n ****************************************\n ");
/*------------------------------------------------------------------------------*/
/*---------------------- start loop over timesteps (forward model) ------------*/
/*------------------------------------------------------------------------------*/
......@@ -2592,27 +2593,30 @@ int main(int argc, char **argv){
if(WAVETYPE==2 || WAVETYPE==3) {
eprecond1(We_SH,Ws_SH,Wr_SH,EPSILON_WE_SH);
if(EPRECOND_PER_SHOT) We_max_SH=global_maximum(We_SH);
if(EPRECOND_PER_SHOT_SH) We_max_SH=global_maximum(We_SH);
}
if(EPRECOND_PER_SHOT){
fprintf(FP,"\n Applying approx. Hessian for shot %i. EPRECOND=%i, EPSILON_WE=%f",ishot,EPRECOND,EPSILON_WE);
if(EPRECOND_PER_SHOT && (WAVETYPE==1 || WAVETYPE==3)){
fprintf(FP,"\n Applying approx. Hessian for shot %i PSV. EPRECOND=%i, EPSILON_WE=%f",ishot,EPRECOND,EPSILON_WE);
for (j=1;j<=NY;j=j+IDY){
for (i=1;i<=NX;i=i+IDX){
if(WAVETYPE==1 || WAVETYPE==3) {
We[j][i]=We[j][i]/We_max;
waveconv_shot[j][i] = waveconv_shot[j][i]/(We[j][i]);
if(!ACOUSTIC){
waveconv_u_shot[j][i] = waveconv_u_shot[j][i]/(We[j][i]);
}
waveconv_rho_shot[j][i] = waveconv_rho_shot[j][i]/(We[j][i]);
}
if(WAVETYPE==2 || WAVETYPE==3) {
We_SH[j][i]=We_SH[j][i]/We_max_SH;
waveconv_u_shot_z[j][i] = waveconv_u_shot_z[j][i]/(We_SH[j][i]);
waveconv_rho_shot_z[j][i] = waveconv_rho_shot_z[j][i]/(We_SH[j][i]);
We[j][i]=We[j][i]/We_max;
waveconv_shot[j][i] = waveconv_shot[j][i]/(We[j][i]);
if(!ACOUSTIC){
waveconv_u_shot[j][i] = waveconv_u_shot[j][i]/(We[j][i]);
}
waveconv_rho_shot[j][i] = waveconv_rho_shot[j][i]/(We[j][i]);
}
}
}
if(EPRECOND_PER_SHOT_SH && (WAVETYPE==2 || WAVETYPE==3)){
fprintf(FP,"\n Applying approx. Hessian for shot %i SH. EPRECOND=%i, EPSILON_WE=%f",ishot,EPRECOND,EPSILON_WE);
for (j=1;j<=NY;j=j+IDY){
for (i=1;i<=NX;i=i+IDX){
We_SH[j][i]=We_SH[j][i]/We_max_SH;
waveconv_u_shot_z[j][i] = waveconv_u_shot_z[j][i]/(We_SH[j][i]);
waveconv_rho_shot_z[j][i] = waveconv_rho_shot_z[j][i]/(We_SH[j][i]);
}
}
}
......@@ -2724,31 +2728,31 @@ int main(int argc, char **argv){
/* ----------------------------------------- */
if((EPRECOND==1)||(EPRECOND==3)){
if(!EPRECOND_PER_SHOT){
fprintf(FP,"\n Applying approx. Hessian to summed gradient. EPRECOND=%i, EPSILON_WE=%f",EPRECOND,EPSILON_WE);
if(!EPRECOND_PER_SHOT && (WAVETYPE==1 || WAVETYPE==3)){
fprintf(FP,"\n Applying approx. Hessian to summed gradient PSV. EPRECOND=%i, EPSILON_WE=%f",EPRECOND,EPSILON_WE);
if (WAVETYPE==1 || WAVETYPE==3) {
We_sum_max1=global_maximum(We_sum);
for (j=1;j<=NY;j=j+IDY){
for (i=1;i<=NX;i=i+IDX){
We_sum[j][i]=We_sum[j][i]/We_sum_max1;
waveconv[j][i] = waveconv[j][i]*We_sum[j][i];
if(!ACOUSTIC){
waveconv_u[j][i] = waveconv_u[j][i]*We_sum[j][i];
}
waveconv_rho[j][i] = waveconv_rho[j][i]*We_sum[j][i];
We_sum_max1=global_maximum(We_sum);
for (j=1;j<=NY;j=j+IDY){
for (i=1;i<=NX;i=i+IDX){
We_sum[j][i]=We_sum[j][i]/We_sum_max1;
waveconv[j][i] = waveconv[j][i]*We_sum[j][i];
if(!ACOUSTIC){
waveconv_u[j][i] = waveconv_u[j][i]*We_sum[j][i];
}
waveconv_rho[j][i] = waveconv_rho[j][i]*We_sum[j][i];
}
}
}
if(!EPRECOND_PER_SHOT_SH && (WAVETYPE==2 || WAVETYPE==3)){
fprintf(FP,"\n Applying approx. Hessian to summed gradient SH. EPRECOND=%i, EPSILON_WE=%f",EPRECOND,EPSILON_WE);
if (WAVETYPE==2 || WAVETYPE==3) {
We_sum_max1=global_maximum(We_sum_SH);
for (j=1;j<=NY;j=j+IDY){
for (i=1;i<=NX;i=i+IDX){
We_sum_SH[j][i]=We_sum_SH[j][i]/We_sum_max1;
waveconv_u_z[j][i] = waveconv_u_z[j][i]*We_sum_SH[j][i];
waveconv_rho_z[j][i] = waveconv_rho_z[j][i]*We_sum_SH[j][i];
}
We_sum_max1=global_maximum(We_sum_SH);
for (j=1;j<=NY;j=j+IDY){
for (i=1;i<=NX;i=i+IDX){
We_sum_SH[j][i]=We_sum_SH[j][i]/We_sum_max1;
waveconv_u_z[j][i] = waveconv_u_z[j][i]*We_sum_SH[j][i];
waveconv_rho_z[j][i] = waveconv_rho_z[j][i]*We_sum_SH[j][i];
}
}
}
......
......@@ -101,6 +101,7 @@ void exchange_par(void){
extern int EPRECOND_ITER;
extern float EPSILON_WE,EPSILON_WE_SH;
extern int EPRECOND_PER_SHOT;
extern int EPRECOND_PER_SHOT_SH;
extern int LBFGS_SURFACE;
extern int LBFGS_STEP_LENGTH;
......@@ -346,17 +347,18 @@ void exchange_par(void){
idum[104]=LBFGS_STEP_LENGTH;
idum[105]=EPRECOND_PER_SHOT;
idum[106]=EPRECOND_PER_SHOT_SH;
idum[106]=N_LBFGS;
idum[107]=N_LBFGS;
idum[107]=WOLFE_CONDITION;
idum[108]=WOLFE_NUM_TEST;
idum[109]=WOLFE_TRY_OLD_STEPLENGTH;
idum[108]=WOLFE_CONDITION;
idum[109]=WOLFE_NUM_TEST;
idum[110]=WOLFE_TRY_OLD_STEPLENGTH;
idum[110]=WRITE_FILTERED_DATA;
idum[111]=WRITE_FILTERED_DATA;
idum[111]=TAPER_STF;
idum[112]=TW_IND;
idum[112]=TAPER_STF;
idum[113]=TW_IND;
} /** if (MYID == 0) **/
......@@ -621,19 +623,20 @@ void exchange_par(void){
LBFGS_STEP_LENGTH=idum[104];
EPRECOND_PER_SHOT= idum[105];
EPRECOND_PER_SHOT_SH= idum[106];
N_LBFGS=idum[106];
N_LBFGS=idum[107];
WOLFE_CONDITION=idum[107];
WOLFE_CONDITION=idum[108];
WOLFE_NUM_TEST=idum[108];
WOLFE_NUM_TEST=idum[109];
WOLFE_TRY_OLD_STEPLENGTH=idum[109];
WOLFE_TRY_OLD_STEPLENGTH=idum[110];
WRITE_FILTERED_DATA=idum[110];
WRITE_FILTERED_DATA=idum[111];
TAPER_STF=idum[111];
TW_IND=idum[112];
TAPER_STF=idum[112];
TW_IND=idum[113];
MPI_Bcast(&FL[1],L,MPI_FLOAT,0,MPI_COMM_WORLD);
......
......@@ -88,6 +88,7 @@ int EPRECOND;
float EPSILON_WE,EPSILON_WE_SH;
int EPRECOND_ITER;
int EPRECOND_PER_SHOT;
int EPRECOND_PER_SHOT_SH;
int N_LBFGS;
int LBFGS_SURFACE;
......
......@@ -108,6 +108,7 @@ void read_par_json(FILE *fp, char *fileinp){
extern int EPRECOND_ITER;
extern float EPSILON_WE,EPSILON_WE_SH;
extern int EPRECOND_PER_SHOT;
extern int EPRECOND_PER_SHOT_SH;
extern int LBFGS_SURFACE;
extern int LBFGS_STEP_LENGTH;
......@@ -489,6 +490,10 @@ void read_par_json(FILE *fp, char *fileinp){
fprintf(fp," EPRECOND_ITER is set to EPRECOND_ITER=%d.\n",EPRECOND_ITER);
}
}
if (get_int_from_objectlist("EPRECOND_PER_SHOT_SH",number_readobjects,&EPRECOND_PER_SHOT_SH,varname_list, value_list)){
EPRECOND_PER_SHOT_SH=0;
fprintf(fp,"Variable EPRECOND_PER_SHOT_SH is set to default value %d.\n",EPRECOND_PER_SHOT_SH);
}
if (get_float_from_objectlist("EPSILON_WE",number_readobjects,&EPSILON_WE,varname_list, value_list))
err("Variable EPSILON_WE could not be retrieved from the json input file!");
......
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