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

cleanup and small bugfix in json reading

parent befea09f
......@@ -69,5 +69,7 @@
"Method" : "comment",
"METHOD" : "0"
"METHOD" : "0",
"MOD_OUT_FILE" : "./model/toy"
}
......@@ -30,7 +30,7 @@ int main(int argc, char **argv){
int lsnap, nsnap=0, lsamp=0, nlsamp=0, buffsize;
int ntr=0, ntr_loc=0, ntr_glob=0, nsrc=0, nsrc_loc=0, ishot, ishot1, nshots;
double time1=0.0, time2=0.0, time3=0.0, time4=0.0;
double time1=0.0, time2=0.0, time4=0.0;
double * time_v_update, * time_s_update, * time_s_exchange,* time_v_exchange, * time_timestep;
int * xb, * yb, * zb, l,i,j;
......@@ -84,11 +84,11 @@ int main(int argc, char **argv){
MPI_Request *req_send, *req_rec, *sreq_send, *sreq_rec;
MPI_Status *send_statuses, *rec_statuses;
/* MPI_Status *send_statuses, *rec_statuses; */
float memdyn, memmodel, memseismograms, membuffer, memtotal,memcpml=0.0,memdynf=0.0, memgrad=0.0, membfgs=0.0;
float fac1, fac2,fac3;
char *buff_addr, ext[10];
char *buff_addr;// ext[10];
char buffer[STRING_SIZE], bufferstring[10];
/*char comp[6];*/
FILE * fpsrc=NULL;
......@@ -275,8 +275,8 @@ MPI_Barrier(MPI_COMM_WORLD);
req_rec=(MPI_Request *)malloc(REQUEST_COUNT*sizeof(MPI_Request));
sreq_send=(MPI_Request *)malloc(REQUEST_COUNT*sizeof(MPI_Request));
sreq_rec=(MPI_Request *)malloc(REQUEST_COUNT*sizeof(MPI_Request));
send_statuses=(MPI_Status *)malloc(REQUEST_COUNT*sizeof(MPI_Status));
rec_statuses=(MPI_Status *)malloc(REQUEST_COUNT*sizeof(MPI_Status));
/* send_statuses=(MPI_Status *)malloc(REQUEST_COUNT*sizeof(MPI_Status));
rec_statuses=(MPI_Status *)malloc(REQUEST_COUNT*sizeof(MPI_Status)); */
/* allocation for timing arrays used for performance analysis */
time_v_update=dvector(1,NT);
......
......@@ -34,7 +34,7 @@ void modelupdate(int nx, int ny, int nz, float ***gradvp, float ***gradvs, float
float vpnew,vsnew,rhonew;
float max[3],buf[3],max1[3],dummy[3];
float vp,vs;
int w;
int w=0;
float scale1=0.0, scale2=0.0, scale3=0.0;
buf[0]=0.0;buf[1]=0.0;buf[2]=0.0;
......
......@@ -31,7 +31,7 @@ void precon_grad(int nx,int ny,int nz, float ***grad1, float ***grad2,float ***g
extern int POS[4], NXG, NYG, NZG, FW, DAMPTYPE, FREE_SURF;
extern FILE *FP;
int i,j,k,l,n,ii=0,kk=0,jj=0,sx=0,sy=0,sz=0,rx,ry,rz,h;
int i,j,k,l,n,ii=0,kk=0,jj=0,sx=0,sy=0,sz=0,rx,ry,rz;//,h;
int sh, rh; /*distance of source and receiver arrays to model edge (grid points)*/
float r=0.0, G[3];
G[0]=0.0; G[1]=0.0; G[2]=0.0;
......@@ -222,8 +222,8 @@ void precon_grad(int nx,int ny,int nz, float ***grad1, float ***grad2,float ***g
for (k=1;k<=nz;k++){
/*-------------------------------------------*/
/*damping y-direction*/
h=0;
h=iround(srcpos[2][1]/DY);
//h=0;
//h=iround(srcpos[2][1]/DY);
r=0.0;
r=(jj-sh)*1.0;
if(r<0) G[0]=0.0;
......
......@@ -705,6 +705,10 @@ void read_par_json(FILE *fp, char *fileinp) {
FILT=0;
fprintf(fp," Variable FILT is set to default value %d.\n",FILT);
if (get_string_from_objectlist("MOD_OUT_FILE",number_readobjects,MOD_OUT_FILE,varname_list, value_list)) {
err("Variable MOD_OUT_FILE could not be retrieved from the json input file!");
}
}
}
......
......@@ -45,15 +45,15 @@ void readhess(int nx, int ny, int nz, float *** hess1, float *** hess2, float
fprintf(FP,"\n...reading hess information from hess-files...\n");
/*sprintf(filename,"hess/hess.vp");*/
sprintf(filename,"%s.vp_%4.2fHz_it%d",HESS_FILE,finv,iteration,POS[1],POS[2],POS[3]);
sprintf(filename,"%s.vp_%4.2fHz_it%d",HESS_FILE,finv,iteration);
fp_vp=fopen(filename,"r");
if (fp_vp==NULL) err(" Could not open hess_vp ! ");
sprintf(filename,"%s.vs_%4.2fHz_it%d",HESS_FILE,finv,iteration,POS[1],POS[2],POS[3]);
sprintf(filename,"%s.vs_%4.2fHz_it%d",HESS_FILE,finv,iteration);
fp_vs=fopen(filename,"r");
if (fp_vs==NULL) err(" Could not open hess_vs! ");
sprintf(filename,"%s.rho_%4.2fHz_it%d",HESS_FILE,finv,iteration,POS[1],POS[2],POS[3]);
sprintf(filename,"%s.rho_%4.2fHz_it%d",HESS_FILE,finv,iteration);
fp_rho=fopen(filename,"r");
if (fp_rho==NULL) err(" Could not open hess_rho ! ");
......
......@@ -28,8 +28,6 @@ void readinv(float *finv, int *nf, int *groupnum,int *itpergroup,int nfmax){
extern FILE *FP;
extern int MYID, VERBOSE;
char buffer[256];
int idummy;
float fdummy;
int mute,i;
float twin[2],owin[2];
float abort;
......
......@@ -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,VERBOSE;
extern int MYID, RUN_MULTIPLE_SHOTS;
extern char SEIS_OBS_FILE[STRING_SIZE];
char file_ext[5];
FILE *fpdata;
......
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