Commit f6697382 authored by Florian Wittkamp's avatar Florian Wittkamp

Taper: Check if EOF is reached

Changed output of L2 to STDOUT if WAVETYPE != 3
parent 0d135133
...@@ -2802,7 +2802,7 @@ int main(int argc, char **argv){ ...@@ -2802,7 +2802,7 @@ int main(int argc, char **argv){
energy_sum_all_shots = 0.0; energy_sum_all_shots = 0.0;
MPI_Allreduce(&energy_all_shots,&energy_sum_all_shots,1,MPI_FLOAT,MPI_SUM,MPI_COMM_WORLD); MPI_Allreduce(&energy_all_shots,&energy_sum_all_shots,1,MPI_FLOAT,MPI_SUM,MPI_COMM_WORLD);
if(MYID==0) printf("\n\n PSV: L2=%f",L2sum_all_shots/energy_sum_all_shots); if(MYID==0&&(WAVETYPE==3)) printf("\n\n PSV: L2=%f",L2sum_all_shots/energy_sum_all_shots);
} }
if(WAVETYPE==2||WAVETYPE==3){ if(WAVETYPE==2||WAVETYPE==3){
L2sum_SH = 0.0; L2sum_SH = 0.0;
...@@ -2814,7 +2814,7 @@ int main(int argc, char **argv){ ...@@ -2814,7 +2814,7 @@ int main(int argc, char **argv){
energy_sum_all_shots_SH = 0.0; energy_sum_all_shots_SH = 0.0;
MPI_Allreduce(&energy_all_shots_SH,&energy_sum_all_shots_SH,1,MPI_FLOAT,MPI_SUM,MPI_COMM_WORLD); MPI_Allreduce(&energy_all_shots_SH,&energy_sum_all_shots_SH,1,MPI_FLOAT,MPI_SUM,MPI_COMM_WORLD);
if(MYID==0) printf("\n\n SH: L2=%f",L2sum_all_shots_SH/energy_sum_all_shots_SH); if(MYID==0&&(WAVETYPE==3)) printf("\n SH: L2=%f",L2sum_all_shots_SH/energy_sum_all_shots_SH);
} }
sum_killed_traces=0; sum_killed_traces=0;
MPI_Allreduce(&killed_traces,&sum_killed_traces,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD); MPI_Allreduce(&killed_traces,&sum_killed_traces,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
...@@ -2835,7 +2835,7 @@ int main(int argc, char **argv){ ...@@ -2835,7 +2835,7 @@ int main(int argc, char **argv){
L2t[1]+=L2sum_SH/energy_sum_SH; L2t[1]+=L2sum_SH/energy_sum_SH;
L2t[4]+=L2sum_all_shots_SH/energy_sum_all_shots_SH; L2t[4]+=L2sum_all_shots_SH/energy_sum_all_shots_SH;
} }
if(MYID==0) printf("\n\n Sum: L2=%f",L2t[4]); if(MYID==0&&(WAVETYPE==3)) printf("\n Sum: L2=%f",L2t[4]);
break; break;
case 7: case 7:
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with DENISE. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>. * along with DENISE. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/ -----------------------------------------------------------------------------------------*/
/* /*
* taper gradient with a gaussian frame to damp inversion artefacts near the sources and receivers * taper gradient with a gaussian frame to damp inversion artefacts near the sources and receivers
...@@ -399,9 +399,9 @@ void taper_grad(float ** waveconv,float ** taper_coeff, float **srcpos, int nsho ...@@ -399,9 +399,9 @@ void taper_grad(float ** waveconv,float ** taper_coeff, float **srcpos, int nsho
} }
} }
/* for (iy=1;iy<=NYG;iy++) /* for (iy=1;iy<=NYG;iy++)
for (ix=1;ix<=NXG;ix++) msum[iy][ix] += mm[iy][ix]; for (ix=1;ix<=NXG;ix++) msum[iy][ix] += mm[iy][ix];
*/ */
for (iy=1;iy<=NYG;iy++) for (iy=1;iy<=NYG;iy++)
for (ix=1;ix<=NXG;ix++) for (ix=1;ix<=NXG;ix++)
if (msum[iy][ix] > mm[iy][ix]) if (msum[iy][ix] > mm[iy][ix])
...@@ -426,9 +426,9 @@ void taper_grad(float ** waveconv,float ** taper_coeff, float **srcpos, int nsho ...@@ -426,9 +426,9 @@ void taper_grad(float ** waveconv,float ** taper_coeff, float **srcpos, int nsho
} }
}*/ }*/
/* for (iy=1;iy<=NYG;iy++) Die kommenden zwei Zeilen wurden von Daniel auskommentiert. /* for (iy=1;iy<=NYG;iy++) Die kommenden zwei Zeilen wurden von Daniel auskommentiert.
for (ix=1;ix<=NXG;ix++) msum[iy][ix] += mm[iy][ix]; for (ix=1;ix<=NXG;ix++) msum[iy][ix] += mm[iy][ix];
*/ */
/* for (iy=1;iy<=NYG;iy++) /* for (iy=1;iy<=NYG;iy++)
for (ix=1;ix<=NXG;ix++) for (ix=1;ix<=NXG;ix++)
if (msum[iy][ix] > mm[iy][ix]) if (msum[iy][ix] > mm[iy][ix])
...@@ -566,10 +566,18 @@ void taper_grad(float ** waveconv,float ** taper_coeff, float **srcpos, int nsho ...@@ -566,10 +566,18 @@ void taper_grad(float ** waveconv,float ** taper_coeff, float **srcpos, int nsho
fp_taper=fopen(taper_file,"r"); fp_taper=fopen(taper_file,"r");
} }
if(fp_taper==NULL) {
err("Taper file could not opened");
}
/* loop over global grid */ /* loop over global grid */
for (i=1;i<=NXG;i++){ for (i=1;i<=NXG;i++){
for (j=1;j<=NYG;j++){ for (j=1;j<=NYG;j++){
if(feof(fp_taper)){
err("Taper file is to small. Check NX*NY of taper file.");
}
fread(&grad_tap, sizeof(float), 1, fp_taper); fread(&grad_tap, sizeof(float), 1, fp_taper);
if ((POS[1]==((i-1)/NX)) && (POS[2]==((j-1)/NY))){ if ((POS[1]==((i-1)/NX)) && (POS[2]==((j-1)/NY))){
......
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