Commit a98a59f2 authored by laura.gassner's avatar laura.gassner

fixed bugs in snapmerge.c and exchange_par.c, and made a few other minor adjustments.

parent e3375c7d
......@@ -22,34 +22,40 @@
*/
#include "fd.h"
#include "../src/fd.h"
void model_acoustic(float **rho, float **pi){
/*--------------------------------------------------------------------------*/
/* extern variables */
extern int NX, NY, NXG, NYG, POS[3], MYID;
extern int NX, NY, NXG, NYG, POS[3], MYID, FDORDER;
extern float DH, DT;
extern char MFILE[STRING_SIZE];
extern char INV_MODELFILE[STRING_SIZE];
extern char TAPER_FILE_NAME[STRING_SIZE], TAPER_FILE_NAME_RHO[STRING_SIZE];
/* local variables */
float piv, vp, rhov;
int i, j, ii, jj, l;
float piv, vp, rhov, taperv, **taper;
int i, j, ii, jj, l, nd;
char modfile[STRING_SIZE];
FILE *flfile;
int nodes;
char cline[256];
float *fldepth, *flrho, *flvp;
float *fldepth, *flrho, *flvp, *fltaper;
nd = FDORDER/2 + 1;
/*read FL nodes from File*/
nodes=4;
nodes=5;
fldepth=vector(1,nodes);
flrho=vector(1,nodes);
flvp=vector(1,nodes);
fltaper=vector(1,nodes);
taper=matrix(-nd+1,NY+nd,-nd+1,NX+nd);
flfile=fopen("model_true/flnodes.toy_example_ac.start","r");
if (flfile==NULL) err(" FL-file could not be opened !");
......@@ -57,7 +63,7 @@ void model_acoustic(float **rho, float **pi){
for (l=1;l<=nodes;l++){
fgets(cline,255,flfile);
if (cline[0]!='#'){
sscanf(cline,"%f%f%f",&fldepth[l], &flrho[l], &flvp[l]);
sscanf(cline,"%f%f%f%f",&fldepth[l], &flrho[l], &flvp[l], &fltaper[l]);
}
else l=l-1;
......@@ -122,9 +128,53 @@ void model_acoustic(float **rho, float **pi){
}
}
/* loop over global grid - taper */
for (i=1;i<=NXG;i++){
for (l=1;l<nodes;l++){
if (fldepth[l]==fldepth[l+1]){
if ((i==1) && (MYID==0)){
printf("depth: %f m: double node\n",fldepth[l]);}}
else{
for (j=(int)(fldepth[l]/DH)+1;j<=(int)(fldepth[l+1]/DH);j++){
taperv=0.0;
taperv=(DH*(j-1)-fldepth[l])*(fltaper[l+1]-fltaper[l])/(fldepth[l+1]-fldepth[l])+fltaper[l];
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if ((POS[1]==((i-1)/NX)) &&
(POS[2]==((j-1)/NY))){
ii=i-POS[1]*NX;
jj=j-POS[2]*NY;
taper[jj][ii]=taperv;
}
}
}
}
for (j=(int)(fldepth[nodes]/DH)+1;j<=NYG;j++){
taperv=0.0;
taperv=fltaper[nodes];
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if ((POS[1]==((i-1)/NX)) &&
(POS[2]==((j-1)/NY))){
ii=i-POS[1]*NX;
jj=j-POS[2]*NY;
taper[jj][ii]=taperv;
}
}
}
free_vector(fldepth,1,nodes);
free_vector(flrho,1,nodes);
free_vector(flvp,1,nodes);
free_vector(fltaper,1,nodes);
/**************************************************/
......@@ -164,8 +214,9 @@ void model_acoustic(float **rho, float **pi){
for (l=1;l<nodes;l++){
if (fldepth[l]==fldepth[l+1]){
if ((i==1) && (MYID==0)){
printf("depth: %f m: double node\n",fldepth[l]);}}
else{
printf("depth: %f m: double node\n",fldepth[l]);
}
}else{
for (j=(int)(fldepth[l]/DH)+1;j<=(int)(fldepth[l+1]/DH);j++){
rhov=0.0;
......@@ -176,13 +227,11 @@ void model_acoustic(float **rho, float **pi){
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if ((POS[1]==((i-1)/NX)) &&
(POS[2]==((j-1)/NY))){
if ((POS[1]==((i-1)/NX)) && (POS[2]==((j-1)/NY))){
ii=i-POS[1]*NX;
jj=j-POS[2]*NY;
rho[jj][ii]=rhov;
// pi[jj][ii]=piv;
}
}
}
......@@ -196,8 +245,7 @@ void model_acoustic(float **rho, float **pi){
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if ((POS[1]==((i-1)/NX)) &&
(POS[2]==((j-1)/NY))){
if ((POS[1]==((i-1)/NX)) && (POS[2]==((j-1)/NY))){
ii=i-POS[1]*NX;
jj=j-POS[2]*NY;
......@@ -227,4 +275,22 @@ void model_acoustic(float **rho, float **pi){
sprintf(modfile,"%s_vp_it0.bin.%i%i",INV_MODELFILE,POS[1],POS[2]);
remove(modfile);
sprintf(modfile,"%s",TAPER_FILE_NAME);
writemod(modfile,taper,3);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0) mergemod(modfile,3);
MPI_Barrier(MPI_COMM_WORLD);
sprintf(modfile,"%s.%i%i",TAPER_FILE_NAME,POS[1],POS[2]);
remove(modfile);
sprintf(modfile,"%s",TAPER_FILE_NAME_RHO);
writemod(modfile,taper,3);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0) mergemod(modfile,3);
MPI_Barrier(MPI_COMM_WORLD);
sprintf(modfile,"%s.%i%i",TAPER_FILE_NAME_RHO,POS[1],POS[2]);
remove(modfile);
free_matrix(taper,-nd+1,NY+nd,-nd+1,NX+nd);
}
......@@ -32,15 +32,11 @@
"QUELLTYP" : "3",
"QUELLTYP values (point_source): explosive=1;force_in_x=2;force_in_y=3;rotated_force=4" : "comment",
"SRCREC" : "1",
"SRCREC values : read source positions from SOURCE_FILE=1, PLANE_WAVE=2" : "comment",
"SOURCE_FILE" : "./source/sources.dat",
"RUN_MULTIPLE_SHOTS" : "1",
"PLANE_WAVE_DEPTH" : "0.0",
"PHI" : "0.0",
"TS" : "0.032",
"Acoustic Computation" : "comment",
"ACOUSTIC" : "1",
"Model" : "comment",
"READMOD" : "0",
......@@ -92,22 +88,10 @@
"SNAP_FORMAT" : "3",
"SNAP_FILE" : "./snap/waveform_forward",
"Receiver array" : "comment",
"REC_ARRAY" : "0",
"REC_ARRAY_DEPTH" : "70.0",
"REC_ARRAY_DIST" : "40.0",
"DRX" : "4",
"Monitoring the simulation" : "comment",
"LOG_FILE" : "log/2layer.log",
"LOG" : "1",
"Checkpoints" : "comment",
"CHECKPTREAD" : "0",
"CHECKPTWRITE" : "0",
"CHECKPTFILE" : "tmp/checkpoint_fdveps",
"General inversion parameters" : "comment",
"INVMAT1" : "1",
......
......@@ -32,15 +32,11 @@
"QUELLTYP" : "3",
"QUELLTYP values (point_source): explosive=1;force_in_x=2;force_in_y=3;rotated_force=4" : "comment",
"SRCREC" : "1",
"SRCREC values : read source positions from SOURCE_FILE=1, PLANE_WAVE=2" : "comment",
"SOURCE_FILE" : "./source/sources.dat",
"RUN_MULTIPLE_SHOTS" : "1",
"PLANE_WAVE_DEPTH" : "0.0",
"PHI" : "0.0",
"TS" : "0.032",
"Acoustic Computation" : "comment",
"ACOUSTIC" : "1",
"Model" : "comment",
"READMOD" : "0",
......@@ -92,29 +88,16 @@
"SNAP_FORMAT" : "3",
"SNAP_FILE" : "./snap/waveform_forward",
"Receiver array" : "comment",
"REC_ARRAY" : "0",
"REC_ARRAY_DEPTH" : "70.0",
"REC_ARRAY_DIST" : "40.0",
"DRX" : "4",
"Monitoring the simulation" : "comment",
"LOG_FILE" : "log/2layer.log",
"LOG" : "1",
"Checkpoints" : "comment",
"CHECKPTREAD" : "0",
"CHECKPTWRITE" : "0",
"CHECKPTFILE" : "tmp/checkpoint_fdveps",
"General inversion parameters" : "comment",
"ITERMAX" : "10",
"DATA_DIR" : "su/measured_data/DENISE_real",
"INVMAT1" : "1",
"INVMAT" : "0",
"INVTYPE" : "2",
"QUELLTYPB" : "1",
"MISFIT_LOG_FILE" : "L2_LOG.dat",
"VELOCITY" : "0",
......@@ -173,10 +156,6 @@
"Minimum number of iteration per frequency" : "comment",
"MIN_ITER" : "0",
"Cosine taper" : "comment",
"TAPER" : "0",
"TAPERLENGTH" : "10",
"Definition of gradient taper geometry" : "comment",
"SWS_TAPER_GRAD_VERT" : "0",
"SWS_TAPER_GRAD_HOR" : "0",
......
......@@ -76,7 +76,7 @@
"TAU" : "0.0966",
"General inversion parameters" : "comment",
"ITERMAX" : "1",
"ITERMAX" : "100",
"DATA_DIR" : "su/measured_data/toy_example_ac",
"INVMAT1" : "1",
"INVMAT" : "0",
......@@ -124,10 +124,9 @@
"SRTRADIUS" : "3.0",
"FILTSIZE" : "1",
"SWS_TAPER_FILE" : "1",
"TAPER_FILE_NAME" : "taper.bin",
"TAPER_FILE_NAME_U" : "taper_u.bin",
"TAPER_FILE_NAME_RHO" : "taper_rho.bin",
"TAPER_FILE_NAME" : "taper/taper.bin",
"TAPER_FILE_NAME_U" : "taper/taper_u.bin",
"TAPER_FILE_NAME_RHO" : "taper/taper_rho.bin",
"Upper and lower limits for model parameters" : "comment",
"VPUPPERLIM" : "5000",
......@@ -156,4 +155,16 @@
"FC_END" : "70.0",
"FC_INCR" : "10.0",
"ORDER" : "4",
"ZERO_PHASE" : "1",
"Trace killing" : "comment",
"TRKILL" : "0",
"TRKILL_FILE" : "./trace_kill/trace_kill.dat",
"Time windowing and damping" : "comment",
"TIMEWIN" : "0",
"PICKS_FILE" : "./picked_times/PickedTimes",
"TWLENGTH_PLUS" : "4.0",
"TWLENGTH_MINUS" : "0.01",
"GAMMA" : "100000",
}
#FLNODE
#converted by MOCOX V1.2 from final.mod.gremlin
# 0.0000 1 0 6371.0000
# depth rho vp
# depth rho vp taper
# in m in g/cm^3 in km/s
#4
0.0000 1.0200 1.4800
500.0000 1.0200 1.4800
500.0000 2.0010 1.5000
2000.0000 2.0010 2.5000
#5
0.0000 1.0200 1.4800 0
500.0000 1.0200 1.4800 0
500.0000 2.0010 1.5000 0
550.0000 2.0010 1.5000 1
2000.0000 2.0010 2.5000 1
......@@ -40,5 +40,7 @@ mpirun -np 4 nice -19 ../bin/denise in_and_out/toy_example/toy_example_ac_INV.js
make clean
# rm jacobian/toy_example/*.old.*.*
# rm model/toy_example/*.bin.*.*
rm jacobian/toy_example/*toy_example*.*.*.*
rm model/*.bin.*.*
rm model/toy_example/*.bin.*.*
rm taper/*.bin.*.*
\ No newline at end of file
......@@ -38,13 +38,15 @@ float intseis_s, intseis_sd;
float *picked_times=NULL;
float **intseis_section=NULL, **intseis_sectiondata=NULL;
float **intseis_sectiondata_envelope=NULL, **intseis_section_envelope=NULL, **intseis_section_hilbert=NULL, **dummy_1=NULL, **dummy_2=NULL;
if(LNORM==8){
intseis_section_envelope = matrix(1,ntr,1,ns);
intseis_sectiondata_envelope = matrix(1,ntr,1,ns);
intseis_section_hilbert = matrix(1,ntr,1,ns);
dummy_1 = matrix(1,ntr,1,ns);
dummy_2 = matrix(1,ntr,1,ns);
}
}
intseis_section = matrix(1,ntr,1,ns); /* declaration of variables for integration */
intseis_sectiondata = matrix(1,ntr,1,ns);
if(TIMEWIN) picked_times = vector(1,ntr); /* declaration of variables for TIMEWIN */
......@@ -53,13 +55,12 @@ if(TIMEWIN) picked_times = vector(1,ntr); /* declaration of variables for TIMEWI
umax=ntr*ns;
zero(&sectiondiff[1][1],umax);
/* TRACE KILLING */
int ** kill_tmp, *kill_vector; /* declaration of variables for trace killing */
char trace_kill_file[STRING_SIZE];
FILE *ftracekill;
if(TRKILL==1){
if(TRKILL==1){
/* sectiondiff will be set to zero */
umax=ntr*ns;
zero(&sectiondiff[1][1],umax);
......@@ -86,16 +87,13 @@ if(TRKILL==1){
}
} /* end if(TRKILL)*/
RMS=0.0;
Lcount=1;
/* Integration of measured and synthetic data */
for(i=1;i<=ntr;i++){
intseis_s=0;
intseis_sd=0;
if (VELOCITY==0){ /* only integtration if displacement seismograms are inverted */
for(j=1;j<=ns;j++){
intseis_s += section[i][j];
......@@ -113,25 +111,22 @@ for(i=1;i<=ntr;i++){
/* TIME WINDOWING */
if(TIMEWIN==1){
time_window(intseis_section, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_sectiondata, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_section, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
time_window(intseis_sectiondata, picked_times, iter, ntr_glob,recpos_loc, ntr, ns, ishot);
}
/* NORMALIZE TRACES */
if(NORMALIZE==1){
normalize_data(intseis_section,ntr,ns);
normalize_data(intseis_sectiondata,ntr,ns);
normalize_data(intseis_section,ntr,ns);
normalize_data(intseis_sectiondata,ntr,ns);
}
/* calculate RMS */
/*for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){*/
/*RMS += (sectionpdata[i][j]-sectionvx[i][j]) * (sectionpdata[i][j]-sectionvx[i][j]);*/
/*RMS += (sectionpdata[i][j]) * (sectionpdata[i][j]);*/
/* Lcount++;
/* Lcount++;
}
} */
......@@ -139,10 +134,8 @@ normalize_data(intseis_sectiondata,ntr,ns);
RMS=1.0;
/* calculate weighted data residuals and reverse time direction */
/* calculate kind of "energy" */
/* calculate envelope and hilbert transform for LNORM==8 */
if (LNORM==8){
calc_envelope(intseis_sectiondata,intseis_sectiondata_envelope,ns,ntr);
......@@ -158,7 +151,6 @@ if (LNORM==8){
/* end of calculate envelope and hilbert transform for LNORM==8 */
for(i=1;i<=ntr;i++){
if((TRKILL==1)&&(kill_vector[i]==1))
continue;
......@@ -175,7 +167,6 @@ for(i=1;i<=ntr;i++){
abs_sectiondata=sqrt(abs_sectiondata);
abs_section=sqrt(abs_section);
}
/* calculate residual seismograms and norm */
if((TRKILL==1)&&(kill_vector[i]==1))
......@@ -185,10 +176,7 @@ for(i=1;i<=ntr;i++){
invtime=ns;
for(j=1;j<=ns;j++){
/*printf("%d \t %d \t %e \t %e \n",i,j,sectionpdata[i][j],sectionp[i][j]);*/
/* calculate L1 residuals */
if(LNORM==1){
if(((sectiondata[i][j]-section[i][j])/RMS)>0){signL1=1.0;}
......@@ -225,7 +213,6 @@ for(i=1;i<=ntr;i++){
/*sectionpdiff[i][invtime]=sectionp[i][j];*/
/* calculate norm for different LNORM */
if((LNORM==2) && (swstestshot==1)){
L2+=sectiondiff[i][invtime]*sectiondiff[i][invtime];
......@@ -245,7 +232,6 @@ for(i=1;i<=ntr;i++){
/*L2+=sectiondiff[i][invtime];*/
invtime--; /* reverse time direction */
}
}
......@@ -253,7 +239,6 @@ for(i=1;i<=ntr;i++){
l2=L2;
// taper(sectiondiff,ntr,ns);
/* printf("\n MYID = %i IN CALC_RES: L2 = %10.12f \n",MYID,l2); */
/* free memory for integrated seismograms */
......@@ -262,9 +247,12 @@ free_matrix(intseis_sectiondata,1,ntr,1,ns);
/* free memory for time windowing and trace killing */
if(TIMEWIN==1) free_vector(picked_times,1,ntr);
if(TRKILL==1){
free_imatrix(kill_tmp,1,ntr_glob,1,nsrc_glob);
free_ivector(kill_vector,1,ntr);}
free_imatrix(kill_tmp,1,ntr_glob,1,nsrc_glob);
free_ivector(kill_vector,1,ntr);
}
if(LNORM==8){
free_matrix(intseis_sectiondata_envelope,1,ntr,1,ns);
free_matrix(intseis_section_envelope,1,ntr,1,ns);
......
......@@ -390,20 +390,19 @@ int main(int argc, char **argv){
if(!ACOUSTIC){
forward_prop_x = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
forward_prop_y = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
// forward_prop_x = vector(1,nxnyi*(NTDTINV));
forward_prop_y = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
// forward_prop_y = vector(1,nxnyi*(NTDTINV));
}else{
forward_prop_p = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
}
gradg = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
gradp = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
forward_prop_rho_x = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
forward_prop_rho_y = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
// forward_prop_rho_x = vector(1,nxnyi*(NTDTINV));
forward_prop_rho_y = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
// forward_prop_rho_y = vector(1,nxnyi*(NTDTINV));
gradg_rho = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
......@@ -414,7 +413,6 @@ int main(int argc, char **argv){
if(!ACOUSTIC){
forward_prop_u = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
// forward_prop_u = vector(1,nxnyi*(NTDTINV));
gradg_u = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
......@@ -582,23 +580,23 @@ int main(int argc, char **argv){
}
/* Memory for seismic data */
sectionvxdata=matrix(1,ntr,1,ns);
sectionread=matrix(1,ntr_glob,1,ns);
sectionvxdata=matrix(1,ntr,1,ns);
sectionvxdiff=matrix(1,ntr,1,ns);
sectionvxdiffold=matrix(1,ntr,1,ns);
sectionvydata=matrix(1,ntr,1,ns);
sectionpdata=matrix(1,ntr,1,ns);
sectionvydiff=matrix(1,ntr,1,ns);
sectionpdiff=matrix(1,ntr,1,ns);
sectionvxdiffold=matrix(1,ntr,1,ns);
sectionvydiffold=matrix(1,ntr,1,ns);
sectionpdata=matrix(1,ntr,1,ns);
sectionpdiff=matrix(1,ntr,1,ns);
sectionpdiffold=matrix(1,ntr,1,ns);
if((INV_STF==1)||(TIME_FILT==1) || (TIME_FILT==2)){
if((INV_STF==1)||(TIME_FILT==1)||(TIME_FILT==2)){
/* Memory for inversion for source time function */
sectionvy_conv=matrix(1,ntr_glob,1,NT);
sectionvy_obs=matrix(1,ntr_glob,1,NT);
sectionvx_conv=matrix(1,ntr_glob,1,NT);
sectionvx_obs=matrix(1,ntr_glob,1,NT);
sectionvy_conv=matrix(1,ntr_glob,1,NT);
sectionvy_obs=matrix(1,ntr_glob,1,NT);
sectionp_conv=matrix(1,ntr_glob,1,NT);
sectionp_obs=matrix(1,ntr_glob,1,NT);
source_time_function = vector(1,NT);
......@@ -1090,6 +1088,14 @@ int main(int argc, char **argv){
// imat++;
}
}
}else{
for (i=1;i<=NX;i=i+IDXI){
for (j=1;j<=NY;j=j+IDYI){
forward_prop_p[j][i][hin]=psp[j][i];
}
}
}
if(!ACOUSTIC){
for (i=1;i<=NX;i=i+IDXI){
for (j=1;j<=NY;j=j+IDYI){
if(VELOCITY==0){
......@@ -1101,12 +1107,6 @@ int main(int argc, char **argv){
// imat2++;
}
}
}else{
for (i=1;i<=NX;i=i+IDXI){
for (j=1;j<=NY;j=j+IDYI){
forward_prop_p[j][i][hin]=psp[j][i];
}
}
}
hin++;
......@@ -1213,9 +1213,7 @@ int main(int argc, char **argv){
}
}
}
}
else{
}else{
if (INVMAT==0){
if((INV_STF==1)&&(iter==N_STF_START)){
......@@ -1533,6 +1531,14 @@ int main(int argc, char **argv){
// imat++;
}
}
}else{
for (i=1;i<=NX;i=i+IDXI){
for (j=1;j<=NY;j=j+IDYI){
forward_prop_p[j][i][hin]=psp[j][i];
}
}
}
if(!ACOUSTIC){
for (i=1;i<=NX;i=i+IDXI){
for (j=1;j<=NY;j=j+IDYI){
if(VELOCITY==0){
......@@ -1544,12 +1550,6 @@ int main(int argc, char **argv){
// imat2++;
}
}
}else{
for (i=1;i<=NX;i=i+IDXI){
for (j=1;j<=NY;j=j+IDYI){
forward_prop_p[j][i][hin]=psp[j][i];
}
}
}
hin++;
hin1=hin1+DTINV;
......@@ -1935,7 +1935,6 @@ int main(int argc, char **argv){
}
}
/*if(nt==hin1){*/
if(DTINV_help[NT-nt+1]==1){
......@@ -1948,10 +1947,10 @@ int main(int argc, char **argv){
waveconv_rho_shot[j][i]+=(pvxp1[j][i]*forward_prop_rho_x[j][i][NTDTINV-hin+1])+(pvyp1[j][i]*forward_prop_rho_y[j][i][NTDTINV-hin+1]);
// waveconv_rho_shot[j][i]+=(pvxp1[j][i]*forward_prop_rho_x[imat])+(pvyp1[j][i]*forward_prop_rho_y[imat]);
// waveconv_shot[j][i]+= (forward_prop_x[imat]+forward_prop_y[imat])*(psxx[j][i]+psyy[j][i]);
if(!ACOUSTIC){
waveconv_shot[j][i]+= (forward_prop_x[j][i][NTDTINV-hin+1]+forward_prop_y[j][i][NTDTINV-hin+1])*(psxx[j][i]+psyy[j][i]);
// waveconv_shot[j][i]+= (forward_prop_x[imat]+forward_prop_y[imat])*(psxx[j][i]+psyy[j][i]);
}else{
waveconv_shot[j][i]+= (forward_prop_p[j][i][NTDTINV-hin+1])*(psp[j][i]);
}
......@@ -1961,14 +1960,9 @@ int main(int argc, char **argv){
lamss = prho[j][i] * ppi[j][i] * ppi[j][i] - 2.0 * muss;
if(pu[j][i]>0.0){
waveconv_u_shot[j][i]+= ((1.0/(muss*muss))*(forward_prop_u[j][i][NTDTINV-hin+1] * psxy[j][i]))
+ ((1.0/4.0) * ((forward_prop_x[j][i][NTDTINV-hin+1] + forward_prop_y[j][i][NTDTINV-hin+1]) * (psxx[j][i] + psyy[j][i])) / ((lamss+muss)*(lamss+muss)))
+ ((1.0/4.0) * ((forward_prop_x[j][i][NTDTINV-hin+1] - forward_prop_y[j][i][NTDTINV-hin+1]) * (psxx[j][i] - psyy[j][i])) / (muss*muss));
waveconv_u_shot[j][i]+= ((1.0/(muss*muss))*(forward_prop_u[j][i][NTDTINV-hin+1] * psxy[j][i])) + ((1.0/4.0) * ((forward_prop_x[j][i][NTDTINV-hin+1] + forward_prop_y[j][i][NTDTINV-hin+1]) * (psxx[j][i] + psyy[j][i])) / ((lamss+muss)*(lamss+muss))) + ((1.0/4.0) * ((forward_prop_x[j][i][NTDTINV-hin+1] - forward_prop_y[j][i][NTDTINV-hin+1]) * (psxx[j][i] - psyy[j][i])) / (muss*muss));
// waveconv_u_shot[j][i]+= ((1.0/(muss*muss))*(forward_prop_u[imat] * psxy[j][i])) + ((1.0/4.0) * ((forward_prop_x[imat] + forward_prop_y[imat]) * (psxx[j][i] + psyy[j][i])) / ((lamss+muss)*(lamss+muss))) + ((1.0/4.0) * ((forward_prop_x[imat] - forward_prop_y[imat]) * (psxx[j][i] - psyy[j][i])) / (muss*muss));}
}
// waveconv_u_shot[j][i]+= ((1.0/(muss*muss))*(forward_prop_u[imat] * psxy[j][i]))
// + ((1.0/4.0) * ((forward_prop_x[imat] + forward_prop_y[imat]) * (psxx[j][i] + psyy[j][i])) / ((lamss+muss)*(lamss+muss)))
// + ((1.0/4.0) * ((forward_prop_x[imat] - forward_prop_y[imat]) * (psxx[j][i] - psyy[j][i])) / (muss*muss));}
// imat++;
}
}
......@@ -2024,38 +2018,6 @@ int main(int argc, char **argv){
sprintf(jac,"%s_jacobian_shot%i.bin.%i.%i",JACOBIAN,ishot,POS[1],POS[2]);
remove(jac);
// /* output forward_prop_p */
// sprintf(jac,"%s_pressure_shot%i.bin.%i.%i",JACOBIAN,ishot,POS[1],POS[2]);
// FP4=fopen(jac,"wb");
// for (i=1;i<=NX;i=i+IDX){
// for (j=1;j<=NY;j=j+IDY){
// fwrite(&forward_prop_p[j][i][500],sizeof(float),1,FP4);
// }
// }
// fclose(FP4);
// MPI_Barrier(MPI_COMM_WORLD);
// sprintf(jac,"%s_pressure_shot%i.bin",JACOBIAN,ishot);
// if (MYID==0) mergemod(jac,3);
// MPI_Barrier(MPI_COMM_WORLD);
// sprintf(jac,"%s_pressure_shot%i.bin.%i.%i",JACOBIAN,ishot,POS[1],POS[2]);
// remove(jac);
//
// /* output psp */
// sprintf(jac,"%s_pressurenew_shot%i.bin.%i.%i",JACOBIAN,ishot,POS[1],POS[2]);