Commit 7ec03a56 authored by tilman.metz's avatar tilman.metz

several changes on input reading and processing

defined optinal parameters
READREC is now the switch for 0-receiver line / 1-from file / 2-receiver array
using only one receiver specified in the input file is now possible.
if rec array is used checkfd_ssg was checking the wrong input parameters from the .inp files
etc.
parent 690bd3bf
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"Source" : "comment", "Source" : "comment",
"SOURCE_SHAPE" : "4", "SOURCE_SHAPE" : "4",
"SOURCE_TYPE" : "4", "SOURCE_TYPE" : "4",
"SIGNAL_FILE" : "./STF/stf.su",
"SRCREC" : "1", "SRCREC" : "1",
"SOURCE_FILE" : "./sources/sources_toy.dat", "SOURCE_FILE" : "./sources/sources_toy.dat",
"RUN_MULTIPLE_SHOTS" : "1", "RUN_MULTIPLE_SHOTS" : "1",
...@@ -37,8 +36,6 @@ ...@@ -37,8 +36,6 @@
"Q-approximation" : "comment", "Q-approximation" : "comment",
"L" : "0", "L" : "0",
"FL1" : "1000.0",
"TAU" : "0.000001",
"Free Surface" : "comment", "Free Surface" : "comment",
"FREE_SURF" : "0", "FREE_SURF" : "0",
...@@ -49,26 +46,13 @@ ...@@ -49,26 +46,13 @@
"FW" : "10", "FW" : "10",
"VPPML" : "6200.0", "VPPML" : "6200.0",
"FPML" : "200.00", "FPML" : "200.00",
"BOUNDARY" : "0",
"Snapshots" : "comment", "Snapshots" : "comment",
"SNAP" : "0", "SNAP" : "0",
"TSNAP1" : "0.01",
"TSNAP2" : "0.24",
"TSNAPINC" : "0.0075",
"IDX, IDY, IDZ" : "1,1,1",
"SNAP_FORMAT" : "4",
"SNAP_FILE" : "./snap/back",
"SNAP_PLANE" : "1",
"Receiver" : "comment", "Receiver" : "comment",
"SEISMO" : "1", "SEISMO" : "1",
"READREC" : "0", "READREC" : "2",
"REC_FILE" : "./receiver/receiver.dat",
"REFRECX, REFRECY, REFRECZ" : "0.0 , 0.0, 0.0",
"XREC1, YREC1, ZREC1" : "90.0 , 90.0, 90.0",
"XREC2, YREC2, ZREC2" : "90.0 , 90.0, 90.0",
"NGEOPH" : "1",
"Receiver array" : "comment", "Receiver array" : "comment",
"REC_ARRAY" : "1", "REC_ARRAY" : "1",
...@@ -80,9 +64,10 @@ ...@@ -80,9 +64,10 @@
"Seismograms" : "comment", "Seismograms" : "comment",
"NDT" : "1", "NDT" : "1",
"NDTSHIFT" : "0",
"SEIS_FORMAT" : "1", "SEIS_FORMAT" : "1",
"SEIS_FILE" : "./su_obs/obs_toy", "SEIS_FILE" : "./su/cal_toy",
"VERBOSE" : "0",
"Method" : "comment", "Method" : "comment",
...@@ -96,15 +81,14 @@ ...@@ -96,15 +81,14 @@
"SEIS_OBS_FILE" : "./su_obs/obs_toy", "SEIS_OBS_FILE" : "./su_obs/obs_toy",
"EXTOBS" : "0", "EXTOBS" : "0",
"INV_FILE" : "./in_and_out/workflow_toy.dat", "INV_FILE" : "./in_and_out/workflow_toy.dat",
"HESS_FILE" : "./hess/toy_hess",
"General" : "comment", "General" : "comment",
"ITMIN, ITMAX" : "1 , 60", "ITMIN, ITMAX" : "1 , 60",
"FILT" : "0", "FILT" : "1",
"NFMAX" : "5", "NFMAX" : "5",
"TAST" : "100", "TAST" : "100",
"VP0, VS0, RHO0" : "6200.0, 3600.0, 2800.0", "VP0, VS0, RHO0" : "6200.0, 3600.0, 2800.0",
"WEIGHT" : "1.0, 1.0, 0.0", "WEIGHT_VP,WEIGHT_VS,WEIGHT_RHO" : "1.0, 1.0, 0.0",
"Steplength estimation" : "comment", "Steplength estimation" : "comment",
"NSHOTS_STEP" : "4", "NSHOTS_STEP" : "4",
...@@ -115,12 +99,7 @@ ...@@ -115,12 +99,7 @@
"Hessian" : "comment", "Hessian" : "comment",
"HESS" : "0", "HESS" : "0",
"READ_HESS" : "0",
"REC_HESS" : "1",
"WATER_HESS_VP, WATER_HESS_VS, WATER_HESS_RHO" : "0.0192, 0.0192, 1.0e-14",
"L-BFGS" : "comment", "L-BFGS" : "comment",
"LBFGS" : "0", "LBFGS" : "0"
"NUMPAR" : "2",
"BFGSNUM" : "5"
} }
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"Source" : "comment", "Source" : "comment",
"SOURCE_SHAPE" : "4", "SOURCE_SHAPE" : "4",
"SOURCE_TYPE" : "4", "SOURCE_TYPE" : "4",
"SIGNAL_FILE" : "./STF/stf.su",
"SRCREC" : "1", "SRCREC" : "1",
"SOURCE_FILE" : "./sources/sources_toy.dat", "SOURCE_FILE" : "./sources/sources_toy.dat",
"RUN_MULTIPLE_SHOTS" : "1", "RUN_MULTIPLE_SHOTS" : "1",
...@@ -37,8 +36,6 @@ ...@@ -37,8 +36,6 @@
"Q-approximation" : "comment", "Q-approximation" : "comment",
"L" : "0", "L" : "0",
"FL1" : "1000.0",
"TAU" : "0.000001",
"Free Surface" : "comment", "Free Surface" : "comment",
"FREE_SURF" : "0", "FREE_SURF" : "0",
...@@ -49,26 +46,13 @@ ...@@ -49,26 +46,13 @@
"FW" : "10", "FW" : "10",
"VPPML" : "6200.0", "VPPML" : "6200.0",
"FPML" : "200.00", "FPML" : "200.00",
"BOUNDARY" : "0",
"Snapshots" : "comment", "Snapshots" : "comment",
"SNAP" : "0", "SNAP" : "0",
"TSNAP1" : "0.01",
"TSNAP2" : "0.24",
"TSNAPINC" : "0.0075",
"IDX, IDY, IDZ" : "1,1,1",
"SNAP_FORMAT" : "4",
"SNAP_FILE" : "./snap/back",
"SNAP_PLANE" : "1",
"Receiver" : "comment", "Receiver" : "comment",
"SEISMO" : "1", "SEISMO" : "1",
"READREC" : "0", "READREC" : "2",
"REC_FILE" : "./receiver/receiver.dat",
"REFRECX, REFRECY, REFRECZ" : "0.0 , 0.0, 0.0",
"XREC1, YREC1, ZREC1" : "90.0 , 90.0, 90.0",
"XREC2, YREC2, ZREC2" : "90.0 , 90.0, 90.0",
"NGEOPH" : "1",
"Receiver array" : "comment", "Receiver array" : "comment",
"REC_ARRAY" : "1", "REC_ARRAY" : "1",
...@@ -80,7 +64,6 @@ ...@@ -80,7 +64,6 @@
"Seismograms" : "comment", "Seismograms" : "comment",
"NDT" : "1", "NDT" : "1",
"NDTSHIFT" : "0",
"SEIS_FORMAT" : "1", "SEIS_FORMAT" : "1",
"SEIS_FILE" : "./su_obs/obs_toy", "SEIS_FILE" : "./su_obs/obs_toy",
......
...@@ -69,7 +69,7 @@ PARTMODEL_SCR = \ ...@@ -69,7 +69,7 @@ PARTMODEL_SCR = \
util.c util.c
FDMPI_UTIL = \ IFOS_UTIL = \
absorb.c \ absorb.c \
av_mat.c \ av_mat.c \
comm_ini.c \ comm_ini.c \
...@@ -99,7 +99,7 @@ FDMPI_UTIL = \ ...@@ -99,7 +99,7 @@ FDMPI_UTIL = \
writepar.c \ writepar.c \
rwsegy.c \ rwsegy.c \
FDMPI_SRC = \ IFOS_SRC = \
ifos3d.c \ ifos3d.c \
comm_ini_s.c \ comm_ini_s.c \
checkfd_ssg.c \ checkfd_ssg.c \
...@@ -146,12 +146,12 @@ FDMPI_SRC = \ ...@@ -146,12 +146,12 @@ FDMPI_SRC = \
lbfgs_save.c \ lbfgs_save.c \
constant_boundary.c \ constant_boundary.c \
$(MODEL_SCR) \ $(MODEL_SCR) \
$(FDMPI_UTIL) $(IFOS_UTIL)
# model_gauss.c \ # model_gauss.c \
FDMPI_OBJ = $(FDMPI_SRC:%.c=%.o) IFOS_OBJ = $(IFOS_SRC:%.c=%.o)
FDMPI_OBJ_RSG = $(FDMPI_SRC_RSG:%.c=%.o) IFOS_OBJ_RSG = $(IFOS_SRC_RSG:%.c=%.o)
# FDMPI_ACOUSTIC_OBJ = $(FDMPI_ACOUSTIC_SRC:%.c=%.o) # FDMPI_ACOUSTIC_OBJ = $(FDMPI_ACOUSTIC_SRC:%.c=%.o)
# SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o) # SNAPMERGE_OBJ = $(SNAPMERGE_SCR:%.c=%.o)
# PARTMODEL_OBJ = $(PARTMODEL_SCR:%.c=%.o) # PARTMODEL_OBJ = $(PARTMODEL_SCR:%.c=%.o)
...@@ -166,8 +166,8 @@ snapmerge: $(SNAPMERGE_OBJ) ...@@ -166,8 +166,8 @@ snapmerge: $(SNAPMERGE_OBJ)
# part_model: $(PARTMODEL_OBJ) # part_model: $(PARTMODEL_OBJ)
# $(CC) $(LFLAGS) $(PARTMODEL_OBJ) -o ../bin/partmodel # $(CC) $(LFLAGS) $(PARTMODEL_OBJ) -o ../bin/partmodel
ifos3d: $(FDMPI_OBJ) ifos3d: $(IFOS_OBJ)
$(CC) $(SFLAGS) $(FDMPI_OBJ) $(LFLAGS) -o ../bin/ifos3d $(CC) $(SFLAGS) $(IFOS_OBJ) $(LFLAGS) -o ../bin/ifos3d
clean: clean:
......
...@@ -590,7 +590,7 @@ float *** ptaus, float *** ptaup, float *peta, float **srcpos, int nsrc, int **r ...@@ -590,7 +590,7 @@ float *** ptaus, float *** ptaup, float *peta, float **srcpos, int nsrc, int **r
srec_miny=ZREC1; srec_miny=ZREC1;
} }
} }
if (READREC==1) { if ((READREC==1) || (READREC=2)){
/* find maximum and minimum source positions coordinate ---- from receiver file*/ /* find maximum and minimum source positions coordinate ---- from receiver file*/
for (k=1;k<=ntr;k++){ for (k=1;k<=ntr;k++){
/* find maximum source positions coordinate*/ /* find maximum source positions coordinate*/
......
...@@ -145,7 +145,7 @@ int read_par(FILE *fp_in){ ...@@ -145,7 +145,7 @@ int read_par(FILE *fp_in){
} }
break; break;
case 21 : case 21 :
nvarin=sscanf(cline,"%s =%s , %i , %i , %i , %i , %i , %i",s,SIGNAL_FILE,&SIGNAL_FORMAT); nvarin=sscanf(cline,"%s =%s , %i ",s,SIGNAL_FILE,&SIGNAL_FORMAT);
switch(nvarin){ switch(nvarin){
case 0: case 0:
case 1: strcpy(SIGNAL_FILE,"\0"); case 1: strcpy(SIGNAL_FILE,"\0");
...@@ -192,7 +192,7 @@ int read_par(FILE *fp_in){ ...@@ -192,7 +192,7 @@ int read_par(FILE *fp_in){
} }
break; break;
case 25 : case 25 :
nvarin=sscanf(cline,"%s =%i , %i , %i , %i , %i , %i , %i",s,&READMOD,&MOD_FORMAT); nvarin=sscanf(cline,"%s =%i , %i ",s,&READMOD,&MOD_FORMAT);
switch(nvarin){ switch(nvarin){
case 0: case 0:
case 1: READMOD=0; case 1: READMOD=0;
......
This diff is collapsed.
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "fd.h" #include "fd.h"
int **receiver(FILE *fp, int *ntr){ int **receiver(FILE *fp, int *ntr) {
/* declaration of extern variables */ /* declaration of extern variables */
extern char REC_FILE[STRING_SIZE]; extern char REC_FILE[STRING_SIZE];
...@@ -41,19 +41,21 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -41,19 +41,21 @@ int **receiver(FILE *fp, int *ntr){
FILE *fpr; FILE *fpr;
if (MYID==0){ if (MYID==0) {
if (READREC){ /* read receiver positions from file */ switch (READREC) { /* read receiver positions from file */
case 1:
fprintf(fp,"\n Reading receiver positions from file: \n\t%s\n",REC_FILE); fprintf(fp,"\n Reading receiver positions from file: \n\t%s\n",REC_FILE);
fpr=fopen(REC_FILE,"r"); fpr=fopen(REC_FILE,"r");
if (fpr==NULL) err(" Receiver file could not be opened !"); if (fpr==NULL) err(" Receiver file could not be opened !");
*ntr=0; *ntr=0;
/* counts the number of receivers in the receiver file */ /* counts the number of receivers in the receiver file */
while(fgets(buffer, STRING_SIZE, fpr)) while (fgets(buffer, STRING_SIZE, fpr)) {
{
sscanf(buffer,"%s",bufferstring); sscanf(buffer,"%s",bufferstring);
/*testbuff=sscanf(buffer,"%s",bufferstring); /*testbuff=sscanf(buffer,"%s",bufferstring);
fprintf(fp," bufferstring : _%s_with test=_%i_\n",bufferstring,testbuff); */ fprintf(fp," bufferstring : _%s_with test=_%i_\n",bufferstring,testbuff); */
/* checks if the line contains a '%'character which indicates a comment line, /* checks if the line contains a '%'character which indicates a comment line,
...@@ -64,7 +66,8 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -64,7 +66,8 @@ int **receiver(FILE *fp, int *ntr){
rewind(fpr); rewind(fpr);
recpos1=imatrix(1,3,1,*ntr); recpos1=imatrix(1,3,1,*ntr);
for (itr=1;itr<=*ntr;itr++){
for (itr=1; itr<=*ntr; itr++) {
fscanf(fpr,"%f%f%f\n",&xrec, &zrec, &yrec); fscanf(fpr,"%f%f%f\n",&xrec, &zrec, &yrec);
/*note that internally "y" is used for the vertical coordinate, /*note that internally "y" is used for the vertical coordinate,
for usability reasons, we switch the "y" and "z" coordinate for usability reasons, we switch the "y" and "z" coordinate
...@@ -75,56 +78,68 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -75,56 +78,68 @@ int **receiver(FILE *fp, int *ntr){
recpos1[2][itr]=iround((yrec+REFREC[2])/DZ); recpos1[2][itr]=iround((yrec+REFREC[2])/DZ);
recpos1[3][itr]=iround((zrec+REFREC[3])/DY); recpos1[3][itr]=iround((zrec+REFREC[3])/DY);
} }
fclose(fpr); fclose(fpr);
fprintf(fp," Message from function receiver (written by PE %d):\n",MYID); fprintf(fp," Message from function receiver (written by PE %d):\n",MYID);
fprintf(fp," Number of receiver positions found: %i\n",*ntr); fprintf(fp," Number of receiver positions found: %i\n",*ntr);
/* check if more than one receiver is located /* check if more than one receiver is located
at the same gridpoint */ at the same gridpoint */
for (itr=1;itr<=(*ntr-1);itr++) for (itr=1; itr<=(*ntr-1); itr++)
for (itr1=itr+1;itr1<=*ntr;itr1++) for (itr1=itr+1; itr1<=*ntr; itr1++)
if ((recpos1[1][itr]==recpos1[1][itr1]) if ((recpos1[1][itr]==recpos1[1][itr1])
&& (recpos1[2][itr]==recpos1[2][itr1]) && (recpos1[2][itr]==recpos1[2][itr1])
&& (recpos1[3][itr]==recpos1[3][itr1])) && (recpos1[3][itr]==recpos1[3][itr1]))
recpos1[1][itr1]=-(++recflag); recpos1[1][itr1]=-(++recflag);
recpos=imatrix(1,3,1,*ntr-recflag); recpos=imatrix(1,3,1,*ntr-recflag);
for (itr=1;itr<=*ntr;itr++)
if (recpos1[1][itr]>0){ for (itr=1; itr<=*ntr; itr++)
if (recpos1[1][itr]>0) {
recpos[1][++itr2]=recpos1[1][itr]; recpos[1][++itr2]=recpos1[1][itr];
recpos[2][itr2]=recpos1[2][itr]; recpos[2][itr2]=recpos1[2][itr];
recpos[3][itr2]=recpos1[3][itr]; recpos[3][itr2]=recpos1[3][itr];
} }
*ntr=itr2; *ntr=itr2;
if ((recflag>0)||(itr2<(itr-1))){
if ((recflag>0)||(itr2<(itr-1))) {
fprintf(fp,"\n\n"); fprintf(fp,"\n\n");
fprintf(fp," Warning:\n"); fprintf(fp," Warning:\n");
fprintf(fp," Several receivers located at the same gridpoint !\n"); fprintf(fp," Several receivers located at the same gridpoint !\n");
fprintf(fp," Number of receivers reduced to %i\n", *ntr); fprintf(fp," Number of receivers reduced to %i\n", *ntr);
fprintf(fp,"\n\n"); fprintf(fp,"\n\n");
} }
free_imatrix(recpos1,1,3,1,*ntr); free_imatrix(recpos1,1,3,1,*ntr);
break;
} case 2 : /* REC ARRAY */
else if (REC_ARRAY>0){
ifw=FW+10; /* frame width in gridpoints */ ifw=FW+10; /* frame width in gridpoints */
if (BOUNDARY==1) ifw=0; if (BOUNDARY==1) ifw=0;
*ntr=((1+(NZG-2*ifw)/DRY)*(1+(NXG-2*ifw)/DRX))*REC_ARRAY; *ntr=((1+(NZG-2*ifw)/DRY)*(1+(NXG-2*ifw)/DRX))*REC_ARRAY;
recpos=imatrix(1,3,1,*ntr); recpos=imatrix(1,3,1,*ntr);
itr=0; itr=0;
for (n=0;n<=REC_ARRAY-1;n++){
for (n=0; n<=REC_ARRAY-1; n++) {
j=iround((REC_ARRAY_DEPTH+REC_ARRAY_DIST*(float)n)/DY); j=iround((REC_ARRAY_DEPTH+REC_ARRAY_DIST*(float)n)/DY);
for (k=ifw;k<=NZG-ifw;k+=DRY)
for (i=ifw;i<=NXG-ifw;i+=DRX){ for (k=ifw; k<=NZG-ifw; k+=DRY)
for (i=ifw; i<=NXG-ifw; i+=DRX) {
itr++; itr++;
recpos[1][itr]=i; recpos[1][itr]=i;
recpos[2][itr]=j; recpos[2][itr]=j;
recpos[3][itr]=k; recpos[3][itr]=k;
} }
} }
}
else{ /* straight horizontal or vertical line of receivers */ break;
if ((XREC1>XREC2) || ((YREC1>YREC2) ||(ZREC1>ZREC2))){
case 0 : /* straight horizontal or vertical line of receivers */
if ((XREC1>XREC2) || ((YREC1>YREC2) ||(ZREC1>ZREC2))) {
fprintf(fp," Coordinates of first receiver specified in input file :\n"); fprintf(fp," Coordinates of first receiver specified in input file :\n");
fprintf(fp," %5.2f (x) , %5.2f (y) , %5.2f (z) :\n", XREC1,YREC1,ZREC1); fprintf(fp," %5.2f (x) , %5.2f (y) , %5.2f (z) :\n", XREC1,YREC1,ZREC1);
fprintf(fp," Coordinates of last receiver specified in input file :\n"); fprintf(fp," Coordinates of last receiver specified in input file :\n");
...@@ -138,26 +153,36 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -138,26 +153,36 @@ int **receiver(FILE *fp, int *ntr){
nyrec2=iround(YREC2/DY); nyrec2=iround(YREC2/DY);
nzrec1=iround(ZREC1/DZ); nzrec1=iround(ZREC1/DZ);
nzrec2=iround(ZREC2/DZ); nzrec2=iround(ZREC2/DZ);
if ((abs(nyrec2-nyrec1)<=abs(nxrec2-nxrec1))|| if ((abs(nyrec2-nyrec1)<=abs(nxrec2-nxrec1))||
(abs(nyrec2-nyrec1)<=abs(nzrec2-nzrec1))){ (abs(nyrec2-nyrec1)<=abs(nzrec2-nzrec1))) {
if (abs(nzrec2-nzrec1)<=abs(nxrec2-nxrec1)){
if (abs(nzrec2-nzrec1)<=abs(nxrec2-nxrec1)) {
/* geophone-array horizontal x-dirextion */ /* geophone-array horizontal x-dirextion */
*ntr=iround((nxrec2-nxrec1)/NGEOPH)+1; *ntr=iround((nxrec2-nxrec1)/NGEOPH)+1;
recpos=imatrix(1,3,1,*ntr); recpos=imatrix(1,3,1,*ntr);
for (nxrec=nxrec1;nxrec<=nxrec2;nxrec+=NGEOPH){ for (nxrec=nxrec1; nxrec<=nxrec2; nxrec+=NGEOPH) {
if ((nyrec2-nyrec1==0) && (nzrec2-nzrec1==0)) {
nyrec=nyrec1;
nzrec=nzrec1;
} else {
nyrec=nyrec1+((nyrec2-nyrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1)); nyrec=nyrec1+((nyrec2-nyrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1));
nzrec=nzrec1+((nzrec2-nzrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1)); nzrec=nzrec1+((nzrec2-nzrec1)/(nxrec2-nxrec1)*(nxrec-nxrec1));
}
itr=iround((nxrec-nxrec1)/NGEOPH)+1; itr=iround((nxrec-nxrec1)/NGEOPH)+1;
recpos[1][itr]=nxrec; recpos[1][itr]=nxrec;
recpos[2][itr]=nyrec; recpos[2][itr]=nyrec;
recpos[3][itr]=nzrec; recpos[3][itr]=nzrec;
} }
}
else{ /* geophone-array horizontal z-direction */ } else { /* geophone-array horizontal z-direction */
*ntr=iround((nzrec2-nzrec1)/NGEOPH)+1; *ntr=iround((nzrec2-nzrec1)/NGEOPH)+1;
/*fprintf(fp,"ntr=%d,nzrec2=%d, nzrec1=%d",ntr,nzrec2, nzrec1);*/ /*fprintf(fp,"ntr=%d,nzrec2=%d, nzrec1=%d",ntr,nzrec2, nzrec1);*/
recpos=imatrix(1,3,1,*ntr); recpos=imatrix(1,3,1,*ntr);
for (nzrec=nzrec1;nzrec<=nzrec2;nzrec+=NGEOPH){
for (nzrec=nzrec1; nzrec<=nzrec2; nzrec+=NGEOPH) {
nyrec=nyrec1+((nyrec2-nyrec1)/(nzrec2-nzrec1)*(nzrec-nzrec1)); nyrec=nyrec1+((nyrec2-nyrec1)/(nzrec2-nzrec1)*(nzrec-nzrec1));
nxrec=nxrec1+((nxrec2-nxrec1)/(nzrec2-nzrec1)*(nzrec-nzrec1)); nxrec=nxrec1+((nxrec2-nxrec1)/(nzrec2-nzrec1)*(nzrec-nzrec1));
itr=iround((nzrec-nzrec1)/NGEOPH)+1; itr=iround((nzrec-nzrec1)/NGEOPH)+1;
...@@ -166,11 +191,12 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -166,11 +191,12 @@ int **receiver(FILE *fp, int *ntr){
recpos[3][itr]=nzrec; recpos[3][itr]=nzrec;
} }
} }
}
else{ /* receiver-line vertical */ } else { /* receiver-line vertical */
*ntr=iround((nyrec2-nyrec1)/NGEOPH)+1; *ntr=iround((nyrec2-nyrec1)/NGEOPH)+1;
recpos=imatrix(1,3,1,*ntr); recpos=imatrix(1,3,1,*ntr);
for (nyrec=nyrec1;nyrec<=nyrec2;nyrec+=NGEOPH){
for (nyrec=nyrec1; nyrec<=nyrec2; nyrec+=NGEOPH) {
nxrec=nxrec1+((nxrec2-nxrec1)/(nyrec2-nyrec1)*(nyrec-nyrec1)); nxrec=nxrec1+((nxrec2-nxrec1)/(nyrec2-nyrec1)*(nyrec-nyrec1));
nzrec=nzrec1+((nzrec2-nzrec1)/(nyrec2-nyrec1)*(nyrec-nyrec1)); nzrec=nzrec1+((nzrec2-nzrec1)/(nyrec2-nyrec1)*(nyrec-nyrec1));
itr=iround((nyrec-nyrec1)/NGEOPH)+1; itr=iround((nyrec-nyrec1)/NGEOPH)+1;
...@@ -180,22 +206,30 @@ int **receiver(FILE *fp, int *ntr){ ...@@ -180,22 +206,30 @@ int **receiver(FILE *fp, int *ntr){
} }
} }
break;
default :
err(" invalid READREC in receiver.c!");
} }
} }
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast(ntr,1,MPI_INT,0,MPI_COMM_WORLD); MPI_Bcast(ntr,1,MPI_INT,0,MPI_COMM_WORLD);
if (MYID!=0) recpos=imatrix(1,3,1,*ntr); if (MYID!=0) recpos=imatrix(1,3,1,*ntr);
MPI_Bcast(&recpos[1][1],(*ntr)*3,MPI_INT,0,MPI_COMM_WORLD); MPI_Bcast(&recpos[1][1],(*ntr)*3,MPI_INT,0,MPI_COMM_WORLD);
if (MYID==0){ if (MYID==0) {
fprintf(fp,"\n **Message from function receiver (written by PE %d):\n",MYID); fprintf(fp,"\n **Message from function receiver (written by PE %d):\n",MYID);
fprintf(fp," Number of receiver positions found: %i\n",*ntr); fprintf(fp," Number of receiver positions found: %i\n",*ntr);
fprintf(fp," Receiver positions (in gridpoints) in the global model-system:\n"); fprintf(fp," Receiver positions (in gridpoints) in the global model-system:\n");
fprintf(fp," x \ty \tz \n"); fprintf(fp," x \ty \tz \n");
fprintf(fp," - \t- \t- \n"); fprintf(fp," - \t- \t- \n");
for (k=1;k<=*ntr;k++)
fprintf(fp," %5.2f %5.2f %5.2f\n",recpos[1][k]*DX,recpos[2][k]*DZ,recpos[3][k]*DY); for (k=1; k<=*ntr; k++)
fprintf(fp," %5.2f %5.2f %5.2f\n",recpos[1][k]*DX,recpos[3][k]*DZ,recpos[2][k]*DY);
fprintf(fp,"\n\n"); fprintf(fp,"\n\n");
} }
......
...@@ -43,6 +43,7 @@ void writepar(FILE *fp, int ns){ ...@@ -43,6 +43,7 @@ void writepar(FILE *fp, int ns){
extern int NP, NPROCX, NPROCY, NPROCZ, MYID; extern int NP, NPROCX, NPROCY, NPROCZ, MYID;
extern int ITMIN, ITMAX, FILT, NFMAX, TAST, NSHOTS_STEP, DAMPTYPE, HESS, READ_HESS, REC_HESS, LBFGS,EXTOBS; extern int ITMIN, ITMAX, FILT, NFMAX, TAST, NSHOTS_STEP, DAMPTYPE, HESS, READ_HESS, REC_HESS, LBFGS,EXTOBS;
extern int NUMPAR, BFGSNUM; extern int NUMPAR, BFGSNUM;
extern int VERBOSE;
extern float TESTSTEP,WATER_HESS[3], WEIGHT[3], VP0, VS0, RHO0; extern float TESTSTEP,WATER_HESS[3], WEIGHT[3], VP0, VS0, RHO0;
/* definition of local variables */ /* definition of local variables */
...@@ -150,21 +151,23 @@ void writepar(FILE *fp, int ns){ ...@@ -150,21 +151,23 @@ void writepar(FILE *fp, int ns){
if (SEISMO){ if (SEISMO){
fprintf(fp," ------------------------- RECEIVER ------- -------------------\n"); fprintf(fp," ------------------------- RECEIVER ------- -------------------\n");
if (READREC){ switch (READREC){
case 1:
fprintf(fp," Reading receiver positions from file \n"); fprintf(fp," Reading receiver positions from file \n");
fprintf(fp,"\t%s\n\n",REC_FILE); fprintf(fp,"\t%s\n\n",REC_FILE);
fprintf(fp," reference_point_for_receiver_coordinate_system:\n"); fprintf(fp," reference_point_for_receiver_coordinate_system:\n");
fprintf(fp," x=%f \ty=%f\t z=%f\n",REFREC[1], REFREC[3], REFREC[2]); fprintf(fp," x=%f \ty=%f\t z=%f\n",REFREC[1], REFREC[3], REFREC[2]);
break;
case 2:
} else if (REC_ARRAY>0){
fprintf(fp," Horitontal plane of receivers.\n"); fprintf(fp," Horitontal plane of receivers.\n");
fprintf(fp," Number of planes: %d \n",REC_ARRAY); fprintf(fp," Number of planes: %d \n",REC_ARRAY);
fprintf(fp," Depth of upper plane: %e m \n",REC_ARRAY_DEPTH); fprintf(fp," Depth of upper plane: %e m \n",REC_ARRAY_DEPTH);
fprintf(fp," Vertical increment between planes: %e m \n",REC_ARRAY_DIST); fprintf(fp," Vertical increment between planes: %e m \n",REC_ARRAY_DIST);
fprintf(fp," Distance between receivers in x-direction within plane: %i \n", DRX); fprintf(fp," Distance between receivers in x-direction within plane: %i Gridpoints\n", DRX);
fprintf(fp," Distance between receivers in y-direction within plane: %i \n", DRY); fprintf(fp," Distance between receivers in y-direction within plane: %i Gridpoints\n", DRY);
} break;
else{ case 0 :
fprintf(fp," Receiver line: \n"); fprintf(fp," Receiver line: \n");
fprintf(fp," First receiver position (XREC1,YREC1,ZREC1) = (%5.3f, %5.3f, %5.3f m\n", fprintf(fp," First receiver position (XREC1,YREC1,ZREC1) = (%5.3f, %5.3f, %5.3f m\n",
XREC1,ZREC1,YREC1); XREC1,ZREC1,YREC1);
...@@ -172,6 +175,10 @@ void writepar(FILE *fp, int ns){ ...@@ -172,6 +175,10 @@ void writepar(FILE *fp, int ns){
XREC2,ZREC2,YREC2); XREC2,ZREC2,YREC2);
fprintf(fp,"\n Receiver Array: %i \n",REC_ARRAY); fprintf(fp,"\n Receiver Array: %i \n",REC_ARRAY);
fprintf(fp,"\n"); fprintf(fp,"\n");
break;
default :
err(" invalid READREC in write_par!");
break;
} }
} }
fprintf(fp," ------------------------- FREE SURFACE ------------------------\n"); fprintf(fp," ------------------------- FREE SURFACE ------------------------\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