Commit befea09f authored by tilman.metz's avatar tilman.metz

rearanged terminal output and output (.out) files

parent 36b61444
......@@ -31,12 +31,12 @@ float *** uipjp, float *** ujpkp, float *** uipkp, float *** tausipjp,
float *** tausjpkp, float *** tausipkp, float *** rjp, float *** rkp, float *** rip ){
extern int NX, NY, NZ, MYID,L;
extern int NX, NY, NZ, MYID,L,VERBOSE;
extern FILE *FP;
double time1=0.0, time2=0.0;
int i, j, k;
if (MYID==0){
if ((MYID==0)&&(VERBOSE==1)){
fprintf(FP,"\n\n **Message from av_mat (written by PE %d):",MYID);
fprintf(FP,"\n Averaging of material parameters ... \n");
time1=MPI_Wtime();
......@@ -70,7 +70,7 @@ float *** tausjpkp, float *** tausipkp, float *** rjp, float *** rkp, float
if (MYID==0){
if ((MYID==0)&&(VERBOSE==1)){
time2=MPI_Wtime();
fprintf(FP," finished (real time: %4.2f s).\n",time2-time1);
}
......
......@@ -46,6 +46,7 @@ float *** ptaus, float *** ptaup, float *peta, float **srcpos, int nsrc, int **r
extern int FDCOEFF;
extern int READREC, NPROCX,NPROCY,NPROCZ, FW, ABS_TYPE, SRCREC, FREE_SURF;
extern int SNAP, SEISMO, SEIS_FORMAT[6], SNAP_FORMAT;
extern int NSHOTS_STEP;
/*extern int RUN_MULTIPLE_SHOTS; no determination is done for the output check whether the simulation runs with one or multiple shot
-> directorys specified in input file should work in both cases */
extern char SEIS_FILE[STRING_SIZE], SNAP_FILE[STRING_SIZE];
......@@ -712,8 +713,16 @@ float *** ptaus, float *** ptaup, float *peta, float **srcpos, int nsrc, int **r
fprintf(fp," You have specified a width of %i gridpoints.\n",FW);
if ((FW<20)&&(MYID==0))
warning(" Be aware of strong artificial reflections from grid boundaries ! \n");}
if (nsrc<NSHOTS_STEP) {
NSHOTS_STEP=nsrc;
if(MYID==0) {
warning(" Parameter NSHOTS_STEP is greater than number of sources. NSHOT_STEP is reduced to nsrc. \n");
fprintf(fp," NSHOTS_STEP=%d\n",NSHOTS_STEP);
}
}
}
......@@ -37,7 +37,7 @@ void conjugate(int nx,int ny,int nz, float ***grad1, float ***grad2,float ***gra
beta[0]=0.0; beta[1]=0.0; beta[2]=0.0;
fprintf(FP,"\n Calculate conjugate gradient \n");
fprintf(FP,"\n Calculate conjugate gradient ");
if(cdf==1){
for (j=1;j<=ny;j++){
......
......@@ -32,6 +32,7 @@ void filt_seis(float ** data,int ntr, int ns, float finv){
int order=4;
int method=1;
float fc=0.0;
extern int VERBOSE;
extern FILE *FP;
/*
data : 2-dimensional array containing seismograms (
......@@ -58,7 +59,8 @@ void filt_seis(float ** data,int ntr, int ns, float finv){
T0=1.0/fc;
fprintf(FP,"ns=%d; DT=%e; T0=%e",ns,DT,T0);
if (VERBOSE) fprintf(FP," ns=%d; DT=%e; T0=%e",ns,DT,T0);
for (itr=1;itr<=ntr;itr++){
for (j=1;j<=ns;j++){
......
......@@ -115,7 +115,7 @@ int main(int argc, char **argv){
if (MYID == 0){
if (argc>1) {
strncpy(FILEINP,argv[1],STRING_SIZE);
fprintf(stderr," Input parameter filename read from command line : %s. \n\n",FILEINP);
fprintf(stderr," \n Input parameter filename read from command line : %s. \n",FILEINP);
if (strlen(FILEINP)>STRING_SIZE-1) {
fprintf(stderr,"\n IFOS cannot handel pathes with more than %d characters.\n",STRING_SIZE-1);
fprintf(stderr," Error: IFOS could not read input parameter file name. -> Exit. \n\n");
......@@ -254,13 +254,13 @@ if(METHOD) nseismograms+=4;
fprintf(FP," Each process is now trying to allocate memory for:\n");
fprintf(FP," Dynamic modeling variables: \t\t %6.2f MB\n", memdyn);
fprintf(FP," Static modeling variables: \t\t %6.2f MB\n", memmodel);
fprintf(FP," Seismograms: \t\t\t %6.2f MB\n", memseismograms);
fprintf(FP," Seismograms: \t\t\t\t %6.2f MB\n", memseismograms);
fprintf(FP," Dynamic inversion variables: \t\t %6.2f MB\n", memdynf);
fprintf(FP," Static inversion variables: \t\t %6.2f MB\n", memgrad+membfgs);
fprintf(FP," Buffer arrays for grid exchange:%6.2f MB\n", membuffer);
fprintf(FP," Network Buffer for MPI_Bsend: \t %6.2f MB\n", buffsize*pow(2.0,-20.0));
fprintf(FP," Buffer arrays for grid exchange: \t %6.2f MB\n", membuffer);
fprintf(FP," Network Buffer for MPI_Bsend: \t\t %6.2f MB\n", buffsize*pow(2.0,-20.0));
fprintf(FP," ------------------------------------------------ \n");
fprintf(FP," Total memory required: \t %6.2f MB.\n\n", memtotal);
fprintf(FP," Total memory required: \t\t %6.2f MB.\n\n", memtotal);
}
MPI_Barrier(MPI_COMM_WORLD);
......@@ -689,8 +689,7 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
if(METHOD==1){
if(it_group>=itmax||iteration==1){
readinv(finv,&nf,&groupnum,itpergroup,NFMAX);
fprintf(FP,"\n itmin=%d;itmax=%d;nf=%d;finv=%4.2f;groupnum=%d\n",itpergroup[0],itpergroup[1],nf,finv[0],groupnum);
readinv(finv,&nf,&groupnum,itpergroup,NFMAX);
cdf=1;
itmax=itpergroup[1];
it_group=1;
......@@ -713,7 +712,7 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
L2=0.0;
if (MYID==0) fprintf(FI,"SHOT %d",ishot);
fprintf(FP,"\n MYID=%d ***** Starting simulation for shot %d of %d ********** \n",MYID,ishot,nshots);
fprintf(FP,"\n ********** Starting simulation for shot %d of %d ********** \n",ishot,nshots);
if (RUN_MULTIPLE_SHOTS){nsrc_loc=snum_loc[ishot];
if(nsrc_loc>0){
......@@ -746,7 +745,7 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
dummy=(1/(finv[nf-1]*TAST*DT));
ntast=(dummy);
if(!ntast) ntast=1;
fprintf(FP, "ntast=%i, TAST=%i \n", ntast, TAST);
//fprintf(FP, "ntast=%i, TAST=%i \n", ntast, TAST);
}
if(MYID==0) fprintf(FP,"\n ****************************************\n ");
......@@ -877,7 +876,7 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
/*---------------------------- backpropagation----------------------------------------------*/
fprintf(FP," *********** STARTING TIME STEPPING BACK PROPAGATION ***************\n");
fprintf(FP,"\n\n *********** STARTING TIME STEPPING BACK PROPAGATION ***************\n");
pshot_loc=1;
for(pshot=0;pshot<=hloop;pshot++){
......@@ -887,7 +886,7 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
if(pshot>0){/*only for Hessian wavefields*/
pshot1=pshot;
ntr_loc=rnum_loc[pshot];
fprintf(FP,"\nstart Hessian wavefields pshot %d, ntr=%d\n", pshot,ntr);
fprintf(FP,"\n start Hessian wavefields pshot %d, ntr=%d\n", pshot,ntr);
if(ntr_loc>0){
for(i=1;i<=4;i++) {srcpos_loc_back[i][1]=recpos_loc[i][pshot_loc];srcpos_loc_back[6][1]=1.0;}
......@@ -996,13 +995,14 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
if(HESS&&iteration==1) outgrad(NX,NY,NZ,hess1,hess2,hess3,finv[0],iteration, HESS_FILE);
/*output "raw" gradient*/
fprintf(FP,"\n raw Gradient: \n");
outgrad(NX,NY,NZ,grad1,grad2,grad3,finv[0],iteration, GRAD_FILE);
if(HESS) hess_apply(1,NX,1,NY,1,NZ,grad1,grad2,grad3,hess1,hess2,hess3,finv[0],iteration);
/*preconditioning of gradient*/
precon_grad(NX,NY,NZ,grad1,grad2,grad3,nsrc,srcpos,ntr_glob,recpos,finv[0],iteration,cdf);
outgrad(NX,NY,NZ,grad1,grad2,grad3,finv[0],iteration+1000, GRAD_FILE);
//outgrad(NX,NY,NZ,grad1,grad2,grad3,finv[0],iteration+1000, GRAD_FILE);
if(LBFGS){
if(it_group>1){
/*lbfgs(grad1, hess1, bfgsscale1, bfgsmod1, bfgsgrad1,iteration);*/
......@@ -1016,7 +1016,7 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
/*---------------------------------------steplength calculation----------------------------------------------------------------*/
fprintf(FP,"\n STEPLENGTH CALCULATION ITERATION %d \n", iteration);
fprintf(FP,"\n\n *********** STEPLENGTH CALCULATION ITERATION %d *********** \n", iteration);
if(LBFGS||!LBFGS){
for (steptest=1;steptest<=2;steptest++){
if(cdf==1) step[4]=0.02;
......@@ -1026,7 +1026,8 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
if(iteration>20)step[steptest]=0.01*steptest;
if(iteration>30) step[steptest]=0.005*steptest;
if(iteration>50) step[steptest]=0.003*steptest;*/
fprintf(FP,"step[%d]=%e",steptest,step[steptest]);
fprintf(FP,"\n\n %d. test steplength: step[%d]=%.2e \n",steptest,steptest,step[steptest]);
fprintf(FP," ------------------------------------ \n");
if(MYID==0) fprintf(FI,"\n steptest %d: steplength=%e \n",steptest ,step[steptest]);
......@@ -1038,12 +1039,13 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
L2=0.0;
L2f=0.0;
for (ishot=1;ishot<=NSHOTS_STEP;ishot++){
ishot1=(nshots/NSHOTS_STEP)*(ishot-1)+1;
fprintf(FP,"\n MYID=%d ***** Starting simulation for shot %d of %d ********** \n",MYID,ishot1,nshots);
fprintf(FP,"\n ********** Starting simulation for shot %d of %d ********** \n",ishot1,nshots);
if (RUN_MULTIPLE_SHOTS){
nsrc_loc=snum_loc[ishot1];
......@@ -1063,8 +1065,13 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
lsamp=NDTSHIFT+1;
nlsamp=1;
if(MYID==0) fprintf(FP,"\n ****************************************\n ");
for (nt=1;nt<=NT;nt++){
if(MYID==0) if(!(nt%(NT/40))) fprintf(FP,"*");
time_v_update[nt]=0.0;
time_s_update[nt]=0.0;
......@@ -1120,15 +1127,16 @@ CPML_coeff(K_x,alpha_prime_x,a_x,b_x,K_x_half,alpha_prime_x_half,a_x_half,b_x_ha
misfit[steptest]=0.0;
misfit[steptest]=L2;
if(MYID==0)fprintf(FI,"\n L2=%e",misfit[steptest]);
} /*steptest*/
if(MYID==0)fprintf(FP,"\n\n\n Steplength Parabel \n");
if(MYID==0)fprintf(FP,"\n\n Steplength Parabel \n");
MPI_Barrier(MPI_COMM_WORLD);
steplength(misfit,step,iteration); /*find optimal steplength*/
}
if(MYID==0)fprintf(FP,"\n stepength calculation finished\n");
if(MYID==0)fprintf(FP,"\n Modelupdate \n");
modelupdate(NX,NY,NZ,grad1,grad2,grad3,rho,pi,u,bfgsmod1,step[3],beta,it_group);
if(MYID==0)fprintf(FP,"\n Modeloutput \n");
......
......@@ -41,9 +41,9 @@ int read_objects_from_intputfile(FILE *fp, char *input_file,char **varname_list,
if (fp_in==NULL) {
fprintf(fp, "\n==================================================================\n");
fprintf(fp, "\n ==================================================================\n");
fprintf(fp, " ERROR: Could not open input file '%s'!", input_file);
fprintf(fp, "\n==================================================================\n");
fprintf(fp, "\n ==================================================================\n");
sprintf(errormessage, "\n in: <read_par_json.c> \n");
err(errormessage);
}
......@@ -233,15 +233,15 @@ int read_objects_from_intputfile(FILE *fp, char *input_file,char **varname_list,
void print_objectlist_screen(FILE *fp, int number_readobject,char **varname_list,char **value_list) {
int ii;
fprintf(fp, "\n===========================================================\n");
fprintf(fp, "|| Object # | object name \t| object value ||");
fprintf(fp, "\n===========================================================\n");
fprintf(fp, "\n ===========================================================\n");
fprintf(fp, " || Object # | object name \t| object value ||");
fprintf(fp, "\n ===========================================================\n");
for (ii=0; ii<number_readobject; ii++) {
fprintf(fp, " %2.0i | %18s | %s \n",ii+1, varname_list[ii],value_list[ii]);
}
printf("========================================================\n\n");
printf(" ========================================================\n\n");
}
int count_occure_charinstring(char stringline[STRING_SIZE2], char teststring[]) {
......
......@@ -32,7 +32,7 @@ void matcopy(float *** rho, float *** pi, float *** u,
float *** taus, float *** taup){
extern int MYID, NX, NY, NZ, INDEX[7],L;
extern int MYID, NX, NY, NZ, INDEX[7],L,VERBOSE;
extern const int TAG1,TAG2,TAG3,TAG4,TAG5,TAG6;
extern FILE *FP;
......@@ -52,7 +52,7 @@ float *** taus, float *** taup){
bufferbac_to_fro = f3tensor(0,NY+1,0,NX+1,1,5);
if (MYID==0){
if ((MYID==0)&&(VERBOSE==1)){
fprintf(FP,"\n\n **Message from matcopy (written by PE %d):",MYID);
fprintf(FP,"\n Copy material properties at inner boundaries ... \n");
time1=MPI_Wtime();
......@@ -290,7 +290,7 @@ float *** taus, float *** taup){
}
if (MYID==0){
if ((MYID==0)&&(VERBOSE==1)){
time2=MPI_Wtime();
fprintf(FP," finished (real time: %4.2f s).\n",time2-time1);
}
......
......@@ -31,7 +31,7 @@ void mergemod(char modfile[STRING_SIZE], int format){
extern int MYID, NPROCX, NPROCY, NPROCZ;
extern int NX, NY, NZ, NPROC, IDX, IDY, IDZ;
extern int NX, NY, NZ, NPROC, IDX, IDY, IDZ, VERBOSE;
extern FILE *FP;
......@@ -45,9 +45,9 @@ void mergemod(char modfile[STRING_SIZE], int format){
err(" merge.c: constant expression NPROC?_MAX < NPROC? ");
printf(" PE %d starts merge of %d model files \n",MYID,NPROC);
if (VERBOSE) printf(" PE %d starts merge of %d model files \n",MYID,NPROC);
fprintf(FP,"\n writing merged model file to %s \n",modfile);
fprintf(FP," writing merged model file to %s \n",modfile);
fpout=fopen(modfile,"w");
......@@ -59,7 +59,7 @@ void mergemod(char modfile[STRING_SIZE], int format){
if (fp[jp][ip][kp]==NULL) err("merge: can't read modfile !");
}
fprintf(FP," ... finished. \n");
//fprintf(FP," ... finished. \n");
......
......@@ -52,7 +52,7 @@ void modelupdate(int nx, int ny, int nz, float ***gradvp, float ***gradvs, float
if(LBFGS) {w=it_group%BFGSNUM;
if(w==0) w=BFGSNUM;}
fprintf(FP,"Modelupdatefunction \n");
fprintf(FP,"\n Message from modelupdate.c ");
/*find and exchange model maxima*/
for (j=1;j<=ny;j++){
......@@ -76,7 +76,8 @@ void modelupdate(int nx, int ny, int nz, float ***gradvp, float ***gradvs, float
max[0]=buf[0];
max[1]=buf[1];
max[2]=buf[2];
fprintf(FP,"rhomax=%4.2f, vpmax=%4.2f, vsmax=%4.2f \n", max[2], max[0], max[1]);
fprintf(FP,"\n Maximum values in current model:\n");
fprintf(FP," rhomax=%4.2f, vpmax=%4.2f, vsmax=%4.2f \n", max[2], max[0], max[1]);
/*if(iteration==1){vs0=vs0*vs0;
vp0=vp0*vp0;}
......@@ -104,7 +105,7 @@ void modelupdate(int nx, int ny, int nz, float ***gradvp, float ***gradvs, float
max1[1]=dummy[1];
max1[2]=dummy[2];
if(max1[2]==0.0) max1[2]=1.0;
fprintf(FP,"max1[0]=%e,max1[1]=%e \n",max1[0],max1[1]);
//fprintf(FP," max1[0]=%e,max1[1]=%e \n",max1[0],max1[1]);
if (max1[0]>0.0 && max1[1]>0.0){
for (j=1;j<=ny;j++){
......@@ -117,7 +118,7 @@ void modelupdate(int nx, int ny, int nz, float ***gradvp, float ***gradvs, float
}
}
}
else fprintf(FP,"max1*max2*max3 =0 \n");
else fprintf(FP,"Warning: One of the gradients is zero: max1*max2*max3 =0 \n");
}
/*if(it_group==1){scale1=4.0; scale2=4.0;}*/
l=0;
......
......@@ -40,7 +40,7 @@ void precon_grad(int nx,int ny,int nz, float ***grad1, float ***grad2,float ***g
/*h=FW+40;*/
fprintf(FP,"\nGradient preconditioning\n");
fprintf(FP,"\n Gradient preconditioning\n");
if(DAMPTYPE==1){
for (j=1;j<=ny;j++){
......
......@@ -50,11 +50,14 @@ int read_par(FILE *fp_in){
/*extern float F_INV;*/
extern float TESTSTEP, WATER_HESS[3], WEIGHT[3], VP0, VS0, RHO0;
extern int BFGSNUM, NUMPAR;
extern int VERBOSE;
/* definition of local variables */
char s[256], cline[256]="";
int lineno=0, l, nvarin=0;
//Default Value for Verbose Mode
VERBOSE=1;
if (fp_in==NULL) err(" Could not open input parameter file (ifos3d.inp)! ");
......@@ -442,7 +445,7 @@ int read_par(FILE *fp_in){
}
}
LOG=0;
if(lineno<85) fprintf(stderr," Warning: only %d non-commentary lines of input parameters read (expected 83).\n",lineno);
if(lineno<85) fprintf(stderr," Warning: only %d non-commentary lines of input parameters read (expected 85).\n",lineno);
/* else if (lineno>71) fprintf(stderr," Warning: %d non-commentary lines of input parameters read \n \t(expected and interpreted: 67).\n",lineno); */
/* else fprintf(stderr," %d non-commentary lines of input parameters read.\n",lineno); */
fclose(fp_in);
......
......@@ -67,11 +67,11 @@ void read_par_json(FILE *fp, char *fileinp) {
/* read in objects from file */
number_readobjects=read_objects_from_intputfile(fp, fileinp, varname_list, value_list);
fprintf(fp,"\nFrom input file %s, %i objects have been read in. \n",fileinp, number_readobjects);
fprintf(fp,"\n From input file %s, %i objects have been read in. \n",fileinp, number_readobjects);
/* print objects to screen */
fprintf(fp, "\n===========================================================");
fprintf(fp, "\n= List of Parameters read by the built in Json Parser =");
fprintf(fp, "\n ===========================================================");
fprintf(fp, "\n = List of Parameters read by the built in Json Parser =");
print_objectlist_screen(fp, number_readobjects, varname_list, value_list);
/* extract variables form object list */
......@@ -137,18 +137,18 @@ void read_par_json(FILE *fp, char *fileinp) {
/*=================================
section source parameters
=================================*/
fprintf(fp,"The following default values are set:\n");
fprintf(fp,"=====================================\n\n");
fprintf(fp," The following default values are set:\n");
fprintf(fp," =====================================\n\n");
if (get_int_from_objectlist("SOURCE_SHAPE",number_readobjects,&SOURCE_SHAPE,varname_list, value_list)) {
err("Variable SOURCE_SHAPE could not be retrieved from the json input file!");
err(" Variable SOURCE_SHAPE could not be retrieved from the json input file!");
}
else {
if (SOURCE_SHAPE==3) {
if (get_string_from_objectlist("SIGNAL_FILE",number_readobjects,SIGNAL_FILE,varname_list, value_list)) {
err("Variable SIGNAL_FILE could not be retrieved from the json input file!");
err(" Variable SIGNAL_FILE could not be retrieved from the json input file!");
} else {
if (get_int_from_objectlist("SIGNAL_FORMAT",number_readobjects,&SIGNAL_FORMAT,varname_list, value_list)) {
......@@ -159,24 +159,24 @@ void read_par_json(FILE *fp, char *fileinp) {
}
if (get_int_from_objectlist("SOURCE_TYPE",number_readobjects,&SOURCE_TYPE,varname_list, value_list)) {
err("Variable SOURCE_TYPE could not be retrieved from the json input file!");
err(" Variable SOURCE_TYPE could not be retrieved from the json input file!");
}
else {
if (SOURCE_TYPE==5) {
if (get_float_from_objectlist("ALPHA",number_readobjects,&ALPHA,varname_list, value_list)) {
err("Variable ALPHA could not be retrieved from the json input file!");
err(" Variable ALPHA could not be retrieved from the json input file!");
}
if (get_float_from_objectlist("BETA",number_readobjects,&BETA,varname_list, value_list)) {
err("Variable BETA could not be retrieved from the json input file!");
err(" Variable BETA could not be retrieved from the json input file!");
}
}
}
if (get_int_from_objectlist("SRCREC",number_readobjects,&SRCREC,varname_list, value_list)) {
err("Variable SRCREC could not be retrieved from the json input file!");
err(" Variable SRCREC could not be retrieved from the json input file!");
} else {
if (get_int_from_objectlist("SRC_MF",number_readobjects,&SRC_MF,varname_list, value_list)) {
......@@ -185,27 +185,27 @@ void read_par_json(FILE *fp, char *fileinp) {
if (get_float_from_objectlist("REFSRCX",number_readobjects,&REFSRC[0],varname_list, value_list)) {
REFSRC[0]=0.0;
fprintf(fp,"Variable REFSRCX is set to default value %1f.\n",REFSRC[0]);
fprintf(fp," Variable REFSRCX is set to default value %.1f.\n",REFSRC[0]);
}
if (get_float_from_objectlist("REFSRCZ",number_readobjects,&REFSRC[1],varname_list, value_list)) {
REFSRC[1]=0.0;
fprintf(fp,"Variable REFSRCZ is set to default value %1f.\n",REFSRC[1]);
fprintf(fp," Variable REFSRCZ is set to default value %.1f.\n",REFSRC[1]);
}
if (get_float_from_objectlist("REFSRCY",number_readobjects,&REFSRC[2],varname_list, value_list)) {
REFSRC[2]=0.0;
fprintf(fp,"Variable REFSRCY is set to default value %1f.\n",REFSRC[2]);
fprintf(fp," Variable REFSRCY is set to default value %.1f.\n",REFSRC[2]);
}
if (SRCREC==1) {
if (get_string_from_objectlist("SOURCE_FILE",number_readobjects,SOURCE_FILE,varname_list, value_list)) {
err("Variable SOURCE_FILE could not be retrieved from the json input file!");
err(" Variable SOURCE_FILE could not be retrieved from the json input file!");
}
if (get_int_from_objectlist("RUN_MULTIPLE_SHOTS",number_readobjects,&RUN_MULTIPLE_SHOTS,varname_list, value_list)) {
err("Variable RUN_MULTIPLE_SHOTS could not be retrieved from the json input file!");
err(" Variable RUN_MULTIPLE_SHOTS could not be retrieved from the json input file!");
} else {
if (get_float_from_objectlist("SRCTSHIFT",number_readobjects,&SRCTSHIFT,varname_list, value_list)) {
......@@ -218,7 +218,7 @@ void read_par_json(FILE *fp, char *fileinp) {
if (SRCREC==2) {
if (get_float_from_objectlist("PLANE_WAVE_DEPTH",number_readobjects,&PLANE_WAVE_DEPTH,varname_list, value_list)) {
err("Variable PLANE_WAVE_DEPTH could not be retrieved from the json input file!");
err(" Variable PLANE_WAVE_DEPTH could not be retrieved from the json input file!");
} else {
if (PLANE_WAVE_DEPTH>0) {
......@@ -261,7 +261,7 @@ void read_par_json(FILE *fp, char *fileinp) {
if (get_int_from_objectlist("L",number_readobjects,&L,varname_list, value_list)) {
L=0;
fprintf(fp,"Variable L is set to default value %d.\n",L);
fprintf(fp," Variable L is set to default value %d.\n",L);
} else {
FL=vector(1,L);
......@@ -299,7 +299,7 @@ void read_par_json(FILE *fp, char *fileinp) {
if (get_int_from_objectlist("BOUNDARY",number_readobjects,&BOUNDARY,varname_list, value_list)) {
BOUNDARY=0;
fprintf(fp,"Variable BOUNDARY is set to default value %d.\n",BOUNDARY);
fprintf(fp," Variable BOUNDARY is set to default value %d.\n",BOUNDARY);
}
if (get_int_from_objectlist("ABS_TYPE",number_readobjects,&ABS_TYPE,varname_list, value_list)) {
......@@ -367,17 +367,17 @@ void read_par_json(FILE *fp, char *fileinp) {
/* increments are read in any case, because they will be also used as increment for model output */
if (get_int_from_objectlist("IDX",number_readobjects,&IDX,varname_list, value_list)) {
IDX=1;
fprintf(fp,"Variable IDX is set to default value %d.\n",IDX);
fprintf(fp," Variable IDX is set to default value %d.\n",IDX);
}
if (get_int_from_objectlist("IDZ",number_readobjects,&IDY,varname_list, value_list)) {
IDY=1;
fprintf(fp,"Variable IDZ is set to default value %d.\n",IDY);
fprintf(fp," Variable IDZ is set to default value %d.\n",IDY);
}
if (get_int_from_objectlist("IDY",number_readobjects,&IDZ,varname_list, value_list)) {
IDZ=1;
fprintf(fp,"Variable IDY is set to default value %d.\n",IDZ);
fprintf(fp," Variable IDY is set to default value %d.\n",IDZ);
}
/*=================================
......@@ -484,7 +484,7 @@ void read_par_json(FILE *fp, char *fileinp) {
REFREC[0]=0.0;
REFREC[1]=0.0;
REFREC[2]=0.0;
fprintf(fp,"Variable REFREC is set to default value (%.2f,%.2f,%.2f).\n",REFREC[0],REFREC[1],REFREC[2]);
fprintf(fp," Variable REFREC is set to default value (%.1f,%.1f,%.1f).\n",REFREC[0],REFREC[1],REFREC[2]);
}
}
......@@ -494,12 +494,12 @@ void read_par_json(FILE *fp, char *fileinp) {
if (get_int_from_objectlist("NDT",number_readobjects,&NDT,varname_list, value_list)) {
NDT=1;
fprintf(fp,"Variable NDT is set to default value %d.\n",NDT);
fprintf(fp," Variable NDT is set to default value %d.\n",NDT);
}
if (get_int_from_objectlist("NDTSHIFT",number_readobjects,&NDTSHIFT,varname_list, value_list)) {
NDTSHIFT=0;
fprintf(fp,"Variable NDTSHIFT is set to default value %d.\n",NDT);
fprintf(fp," Variable NDTSHIFT is set to default value %d.\n",NDT);
}
if (get_int_from_objectlist("SEIS_FORMAT",number_readobjects,&SEIS_FORMAT[0],varname_list, value_list)) {
......@@ -697,13 +697,13 @@ void read_par_json(FILE *fp, char *fileinp) {
else {/* only forward modeling is applied */
ITMIN=1;
fprintf(fp,"Variable ITMIN is set to default value %d.\n",ITMIN);
fprintf(fp," Variable ITMIN is set to default value %d.\n",ITMIN);
ITMAX=1;
fprintf(fp,"Variable ITMAX is set to default value %d.\n",ITMAX);
fprintf(fp," Variable ITMAX is set to default value %d.\n",ITMAX);
if (get_int_from_objectlist("FILT",number_readobjects,&FILT,varname_list, value_list)) {
FILT=0;
fprintf(fp,"Variable FILT is set to default value %d.\n",FILT);
fprintf(fp," Variable FILT is set to default value %d.\n",FILT);
}
......@@ -711,8 +711,8 @@ void read_par_json(FILE *fp, char *fileinp) {
}
fprintf(fp,"\nEnd of setting default values\n");
fprintf(fp,"=====================================\n\n");
fprintf(fp,"\n End of setting default values\n");
fprintf(fp," =====================================\n\n");
/********************************************/
......
......@@ -26,7 +26,7 @@ void readinv(float *finv, int *nf, int *groupnum,int *itpergroup,int nfmax){
extern char INV_FILE[STRING_SIZE];
extern FILE *FP;
extern int MYID;
extern int MYID, VERBOSE;
char buffer[256];
int idummy;
float fdummy;
......@@ -36,10 +36,12 @@ void readinv(float *finv, int *nf, int *groupnum,int *itpergroup,int nfmax){
FILE *fpinv=NULL;
fprintf(FP,"INV_FILE:%s",INV_FILE);
*groupnum+=1;
fprintf(FP,"\n\n ********** INVERSION STAGE NR. %d ********** \n",*groupnum);
if (VERBOSE) fprintf(FP," INV_FILE:%s\n",INV_FILE);
if(MYID==0){
fpinv=fopen(INV_FILE,"r");
......@@ -52,12 +54,15 @@ void readinv(float *finv, int *nf, int *groupnum,int *itpergroup,int nfmax){
fscanf(fpinv,"%d%d%f%d%f%f%f%f%d",&itpergroup[0],&itpergroup[1],&abort,&mute,&twin[0],&twin[1],&owin[0],&owin[1],nf);
fprintf(FP,"\n\n itmin=%d;itmax=%d;abort=%4.2f;mute=%d; twinmin=%4.2f; twinmax=%4.2f;owinmin=%4.2f; owinmax=%4.2f; nf=%d \n\n",itpergroup[0],itpergroup[1],abort,mute,twin[0],twin[1],owin[0],owin[1],*nf);
fprintf(FP,"\n\n itmin=%d; itmax=%d; \n",itpergroup[0],itpergroup[1]);
fprintf(FP,"\n Number of Frequencies in Stage Nr.%d: nf=%d \n\n",*groupnum,*nf);
//fprintf(FP,"\n\n itmin=%d;itmax=%d;abort=%4.2f;mute=%d; twinmin=%4.2f; twinmax=%4.2f;owinmin=%4.2f; owinmax=%4.2f; nf=%d \n\n",itpergroup[0],itpergroup[1],abort,mute,twin[0],twin[1],owin[0],owin[1],*nf);
for(i=0;i<=*nf-1;i++){
fscanf(fpinv,"%f",&finv[i]);
fprintf(FP,"finv[%d]=%4.2f\n",i,finv[i]);
fprintf(FP," finv[%d]=%4.2f; ",i,finv[i]);
}
......@@ -70,7 +75,7 @@ void readinv(float *finv, int *nf, int *groupnum,int *itpergroup,int nfmax){
if(nfmax>1){
MPI_Bcast(finv,nfmax,MPI_FLOAT,0,MPI_COMM_WORLD);}
else MPI_Bcast(&finv[0],1,MPI_FLOAT,0,MPI_COMM_WORLD);
fprintf(FP,"\n");
/*MPI_Bcast(&abort,1,MPI_FLOAT,0,MPI_COMM_WORLD);
MPI_Bcast(&mute,1,MPI_INT,0,MPI_COMM_WORLD);
MPI_Bcast(&owin,2,MPI_FLOAT,0,MPI_COMM_WORLD);
......
......@@ -28,7 +28,7 @@ void readseis(int ishot, float **section, float **sectionf, int ntr, int ns, int
extern FILE *FP;
extern int MYID, RUN_MULTIPLE_SHOTS;
extern int MYID, RUN_MULTIPLE_SHOTS,VERBOSE;
extern char SEIS_OBS_FILE[STRING_SIZE];
char file_ext[5];
FILE *fpdata;
......@@ -36,7 +36,7 @@ void readseis(int ishot, float **section, float **sectionf, int ntr, int ns, int
int i,j;
memset(data, '\0', sizeof(data));
fprintf(FP,"comp=%i",comp);
//fprintf(FP,"comp=%i",comp);
sprintf(file_ext,"su");
......@@ -51,7 +51,7 @@ void readseis(int ishot, float **section, float **sectionf, int ntr, int ns, int
if(comp==2){sprintf(data,"%s_vy.%s.shot%d.%d",SEIS_OBS_FILE,file_ext,ishot,MYID);}
if(comp==3){sprintf(data,"%s_vz.%s.shot%d.%d",SEIS_OBS_FILE,file_ext,ishot,MYID);}
}
fprintf(FP,"\nreads %s\n",data);
fprintf(FP,"\n reads %s",data);
if(ntr>0){
fpdata=fopen(data,"r");
......@@ -67,7 +67,7 @@ void readseis(int ishot, float **section, float **sectionf, int ntr, int ns, int
fclose(fpdata);
}
fprintf(FP," readseis finished\n");
//fprintf(FP," readseis finished\n");
}
\ No newline at end of file
......@@ -42,7 +42,7 @@ void readseis_split(int ishot, float **section, int ntr,int *rnum_loc, int ns, i
if(comp==2) sprintf(data,"%s_vz_ext.%s.shot%d",SEIS_OBS_FILE,file_ext,ishot);
if(comp==3) sprintf(data,"%s_vy_ext.%s.shot%d",SEIS_OBS_FILE,file_ext,ishot);
fprintf(FP,"\nreads %s\n",data);
fprintf(FP,"\n reads %s",data);
if(ntr>0){
fpdata=fopen(data,"r");
......@@ -62,5 +62,5 @@ void readseis_split(int ishot, float **section, int ntr,int *rnum_loc, int ns, i
}
fclose(fpdata);
}
fprintf(FP," readseis_split finished\n");
// fprintf(FP," readseis_split finished\n");
}
\ No newline at end of file
......@@ -30,8 +30,9 @@ int **receiver(FILE *fp, int *ntr) {
extern float XREC1, YREC1, ZREC1, XREC2, YREC2, ZREC2;
extern float DX, DY, DZ, REFREC[4], REC_ARRAY_DEPTH, REC_ARRAY_DIST;
extern int READREC, NGEOPH, NXG, NZG, REC_ARRAY, BOUNDARY;
extern int MYID, DRX, DRY, FW;
extern int MYID, DRX, DRY, FW, VERBOSE;
int kmax;
int **recpos1, **recpos=NULL, nxrec=0, nyrec=0, nzrec=0;
int itr=1, itr1=0, itr2=0, recflag=0, i, j, k, ifw, n;
int nxrec1, nxrec2, nyrec1, nyrec2, nzrec1, nzrec2;
......@@ -226,10 +227,11 @@ int **receiver(FILE *fp, int *ntr) {
fprintf(fp," Receiver positions (in gridpoints) in the global model-system:\n");
fprintf(fp," x \ty \tz \n");
fprintf(fp," - \t- \t- \n");
for (k=1; k<=*ntr; k++)
if (!VERBOSE) kmax=30; else kmax=*ntr;
for (k=1; k<=kmax; k++)
fprintf(fp," %5.2f %5.2f %5.2f\n",recpos[1][k]*DX,recpos[3][k]*DZ,recpos[2][k]*DY);
if (!VERBOSE) fprintf(fp," ...\n Only %d of %d receiver positions displayed here",kmax,*ntr);
fprintf(fp,"\n\n");
}
......
......@@ -25,7 +25,7 @@
int **splitrec(int **recpos,int *ntr_loc, int ntr, int *rnum_loc)
{
extern int IENDX, IENDY, IENDZ, MYID, POS[4];
extern int IENDX, IENDY, IENDZ, MYID, POS[4], VERBOSE;