Commit 44acf6f6 authored by niklas.thiel's avatar niklas.thiel

BUGFIX with using NDT

+ test on input parameter
parent 4399e0af
......@@ -156,6 +156,8 @@ int main(int argc, char **argv){
float *F_LOW_PASS_EXT=NULL;
int nfrq=0;
int FREQ_NR=1;
char pf[STRING_SIZE];
FILE *fprec, *FPL2;
......@@ -764,6 +766,7 @@ int main(int argc, char **argv){
break;
}
sectionp=matrix(1,ntr,1,ns);
break;
}
}
......@@ -1427,14 +1430,14 @@ int main(int argc, char **argv){
/* wavefield separation*/
if (WAVESEP==1) {
if (MYID == 0) fprintf(FP,"\n start wavefield separation...");
if (MYID == 0) pup(fulldata_p, fulldata_vy, FP, ntr_glob,recpos,recpos_loc,ntr_glob,srcpos,ishot,ns,iter,1);
if ((VERBOSE)&&(MYID == 0)) fprintf(FP,"\n wavefield separation finished");
if (MYID == 0) pup(fulldata_p, fulldata_vy, FP, ntr_glob,recpos,recpos_loc,srcpos,ishot,ns,iter,1);
if ((VERBOSE==1)&&(MYID == 0)) fprintf(FP,"\n wavefield separation finished");
MPI_Barrier(MPI_COMM_WORLD);
inseis(fprec,ishot,sectionread,ntr_glob,ns,3,iter);
MPI_Bcast( &fulldata_p[1][1], ntr_glob*ns, MPI_FLOAT, 0, MPI_COMM_WORLD);
h=1;
for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){
sectionp[h][j]=sectionread[recpos_loc[3][i]][j];
sectionp[h][j]=fulldata_p[recpos_loc[3][i]][j];
}
h++;
}
......@@ -1973,24 +1976,27 @@ int main(int argc, char **argv){
/* wavefield separation */
if (WAVESEP==1) {
if (MYID == 0) fprintf(FP,"\n start wavefield separation...");
if (MYID == 0) pup(fulldata_p, fulldata_vy, FP, ntr_glob,recpos,recpos_loc,ntr_glob,srcpos,ishot,ns,iter,1);
if ((VERBOSE) && (MYID == 0)) fprintf(FP,"wavefield separation finished.");
if (MYID == 0) pup(fulldata_p, fulldata_vy, FP, ntr_glob,recpos,recpos_loc,srcpos,ishot,ns,iter,1);
if ((VERBOSE==1) && (MYID == 0)) fprintf(FP,"wavefield separation finished.");
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast( &fulldata_p[1][1], ntr_glob*ns, MPI_FLOAT, 0, MPI_COMM_WORLD);
if (FORWARD_ONLY==0) {
MPI_Barrier(MPI_COMM_WORLD);
inseis(fprec,ishot,sectionread,ntr_glob,ns,3,iter);
h=1;
for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){
sectionp[h][j]=sectionread[recpos_loc[3][i]][j];
}
h++;
}
}
if(ntr>0) {
h=1;
for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){
sectionp[h][j]=fulldata_p[recpos_loc[3][i]][j];
}
h++;
}
}
}
}
break;
} /* end of switch (SEISMO) */
/*---------------------------------------------------------------*/
/*---------------------- start of inversion process ------------*/
/*---------------------------------------------------------------*/
......@@ -2067,6 +2073,8 @@ int main(int argc, char **argv){
if ((TIME_FILT==1 )|| (TIME_FILT==2)){
timedomain_filt(sectionread,F_LOW_PASS,ORDER,ntr_glob,ns,1);
}
sprintf(pf,"%s_pup_data.su.shot%i",SEIS_FILE,ishot);
outseis_glob(FP,fopen(pf,"w"), 0, sectionread,recpos,recpos_loc,ntr_glob,srcpos,1,ns,SEIS_FORMAT,ishot,1);
h=1;
for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){
......@@ -3514,14 +3522,14 @@ int main(int argc, char **argv){
catseis(sectionvy, fulldata_vy, recswitch, ntr_glob, MPI_COMM_WORLD);
catseis(sectionp, fulldata_p, recswitch, ntr_glob, MPI_COMM_WORLD);
if (MYID == 0) fprintf(FP,"\n start wavefield separation...");
if (MYID == 0) pup(fulldata_p, fulldata_vy, FP, ntr_glob,recpos,recpos_loc,ntr_glob,srcpos,ishot,ns,iter,2);
if ((VERBOSE) && (MYID == 0)) fprintf(FP,"\n wavefield separation finished");
MPI_Barrier(MPI_COMM_WORLD);
inseis(fprec,ishot,sectionread,ntr_glob,ns,4,iter);
if (MYID == 0) pup(fulldata_p, fulldata_vy, FP, ntr_glob,recpos,recpos_loc,srcpos,ishot,ns,iter,2);
if ((VERBOSE==1) && (MYID == 0)) fprintf(FP,"\n wavefield separation finished");
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast( &fulldata_p[1][1], ntr_glob*ns, MPI_FLOAT, 0, MPI_COMM_WORLD);
h=1;
for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){
sectionp[h][j]=sectionread[recpos_loc[3][i]][j];
sectionp[h][j]=fulldata_p[recpos_loc[3][i]][j];
}
h++;
}
......@@ -4359,8 +4367,7 @@ int main(int argc, char **argv){
free_matrix(sectionvzdiff,1,ntr,1,ns);
free_matrix(sectionvzdiffold,1,ntr,1,ns);
}
free_matrix(sectionread,1,ntr_glob,1,ns);
free_matrix(sectionread,1,ntr_glob,1,ns);
if((INV_STF==1)||(TIME_FILT==1) || (TIME_FILT==2)) {
/* free memory for inversion of source time function */
......
......@@ -228,7 +228,7 @@ void psource(int nt, float ** sxx, float ** syy, float ** sp,
void psource_rsg(int nt, float ** sxx, float ** syy,
float ** srcpos_loc, float ** signals, int nsrc);
void pup(float **data_p, float **data_vz, FILE *fp, int ntr_glob, int **recpos, int **recpos_loc,int ntr, float ** srcpos, int ishot, int ns, int iter, int sw );
void pup(float **data_p, float **data_vz, FILE *fp, int ntr_glob, int **recpos, int **recpos_loc, float ** srcpos, int ishot, int ns, int iter, int sw );
float *rd_sour(int *nts,FILE* fp_source);
......
......@@ -24,37 +24,39 @@
void fft2(float **array, float **arrayim, int NYG, int NXG, int dir) {
extern FILE *FP;
COMPLEX *C;
int j, i, k, nx, ny, nxy;
float **RE, **IM;
char pf1[STRING_SIZE];
FILE *file;
extern char SEIS_FILE[STRING_SIZE];
nx = NXG;
ny = NYG;
C = cplxvector(1, ny*nx);
if (dir==1) {
extern FILE *FP;
COMPLEX *C;
int j, i, k, nx, ny, nxy;
float **RE, **IM;
char pf1[STRING_SIZE];
FILE *file;
extern char SEIS_FILE[STRING_SIZE];
nx = NXG;
ny = NYG;
C = cplxvector(1, ny*nx);
if (dir==1) {
k = 1;
for (i=1;i<=nx;i++)
for (j=1;j<=ny;j++) {
for (i=1; i<=nx; i++)
for (j=1; j<=ny; j++) {
C[k].re = array[j][i];
C[k].im = 0.0;
k++;
}
forward_fft2f(C, ny, nx);
k = 1;
for (i=1;i<=nx;i++)
for (j=1;j<=ny;j++) {
for (i=1; i<=nx; i++)
for (j=1; j<=ny; j++) {
array[j][i] = C[k].re;
arrayim[j][i] = C[k].im;
k++;
......@@ -63,22 +65,25 @@ void fft2(float **array, float **arrayim, int NYG, int NXG, int dir) {
} else {
k = 1;
for (i=1;i<=nx;i++)
for (j=1;j<=ny;j++) {
for (i=1; i<=nx; i++)
for (j=1; j<=ny; j++) {
C[k].re = array[j][i];
C[k].im = arrayim[j][i];
k++;
}
inverse_fft2f(C, ny, nx);
k = 1;
for (i=1;i<=nx;i++)
for (j=1;j<=ny;j++) {
for (i=1; i<=nx; i++)
for (j=1; j<=ny; j++) {
array[j][i] = C[k].re;
arrayim[j][i] = 0.0;
k++;
}
}
free_cplxvector(C, 1, ny*nx);
}
\ No newline at end of file
}
This diff is collapsed.
......@@ -41,15 +41,15 @@ void inseis(FILE *fp, int comp, float **section, int ntr, int ns, int sws, int
}
if(sws==3){ /* open forward modeled seismic data pup*/
sprintf(data,"%s_pup.su.shot%i",SEIS_FILE,comp);
sprintf(data,"%s_pup.su.shot%d",SEIS_FILE,comp);
}
if(sws==4){ /* open forward modeled seismic data pup used for step length calculation */
sprintf(data,"%s_pup.su.step.shot%i",SEIS_FILE,comp);
sprintf(data,"%s_pup.su.step.shot%d",SEIS_FILE,comp);
}
if(sws==5){ /* open seismic data pup */
sprintf(data,"%s_pup.su.shot%i",DATA_DIR,comp);
sprintf(data,"%s_pup.su.shot%d",DATA_DIR,comp);
}
/* SWS==6 not used */
......
This diff is collapsed.
......@@ -395,44 +395,7 @@ void read_par_json(FILE *fp, char *fileinp){
declare_error("Variable REFRECY could not be retrieved from the json input file!");
}
}
/*=================================
section wavefield separation
=================================*/
if (get_int_from_objectlist("WAVESEP",number_readobjects,&WAVESEP,varname_list, value_list)){
WAVESEP=0;
fprintf(fp,"Variable WAVESEP is set to default value %i.\n",WAVESEP);}
else {
if (SEISMO < 4 && WAVESEP == 1) {
WAVESEP=0;
fprintf(fp,"Variable SEISMO has to be set to 4 or 5 to use wavefield separation. WAVESEP is set to %i now.\n",WAVESEP);
}
if (ADJOINT_TYPE != 4 && WAVESEP == 1) {
WAVESEP=0;
fprintf(fp,"Variable ADJOINT_TYPE has to be set to 4 to use wavefield separation. WAVESEP is set to %i now.\n",WAVESEP);
}
if (WAVETYPE == 2 && WAVESEP == 1) {
WAVESEP=0;
fprintf(fp,"Variable WAVETYPE has to be set to 1 or 3 to use wavefield separation. WAVESEP is set to %i now.\n",WAVESEP);
}
if (WAVESEP==1) {
if (get_float_from_objectlist("VEL",number_readobjects,&VEL,varname_list, value_list)){
VEL=1500;
fprintf(fp,"Variable VEL is set to default value %f.\n",VEL);}
if (get_float_from_objectlist("DENS",number_readobjects,&DENS,varname_list, value_list)){
DENS=1000;
fprintf(fp,"Variable DENS is set to default value %f.\n",DENS);}
if (get_float_from_objectlist("ANGTAPI",number_readobjects,&ANGTAPI,varname_list, value_list)){
ANGTAPI=0;
fprintf(fp,"Variable ANGTAPI is set to default value %f.\n",ANGTAPI);}
if (get_float_from_objectlist("ANGTAPO",number_readobjects,&ANGTAPO,varname_list, value_list)){
ANGTAPO=70;
fprintf(fp,"Variable ANGTAPO is set to default value %f.\n",ANGTAPO);}
}
}
/*=================================
section general model and log parameters
......@@ -1019,6 +982,45 @@ void read_par_json(FILE *fp, char *fileinp){
}
/*=================================
section wavefield separation
=================================*/
if (get_int_from_objectlist("WAVESEP",number_readobjects,&WAVESEP,varname_list, value_list)){
WAVESEP=0;
fprintf(fp,"Variable WAVESEP is set to default value %i.\n",WAVESEP);}
else {
if (SEISMO < 4 && WAVESEP == 1) {
WAVESEP=0;
fprintf(fp,"Variable SEISMO has to be set to 4 or 5 to use wavefield separation. WAVESEP is set to %i now.\n",WAVESEP);
}
if (ADJOINT_TYPE != 4 && WAVESEP == 1 && FORWARD_ONLY == 0) {
WAVESEP=0;
fprintf(fp,"Variable ADJOINT_TYPE has to be set to 4 to use wavefield separation. WAVESEP is set to %i now.\n",WAVESEP);
}
if (WAVETYPE == 2 && WAVESEP == 1) {
WAVESEP=0;
fprintf(fp,"Variable WAVETYPE has to be set to 1 or 3 to use wavefield separation. WAVESEP is set to %i now.\n",WAVESEP);
}
if (WAVESEP==1) {
if (get_float_from_objectlist("VEL",number_readobjects,&VEL,varname_list, value_list)){
VEL=1500;
fprintf(fp,"Variable VEL is set to default value %f.\n",VEL);}
if (get_float_from_objectlist("DENS",number_readobjects,&DENS,varname_list, value_list)){
DENS=1000;
fprintf(fp,"Variable DENS is set to default value %f.\n",DENS);}
if (get_float_from_objectlist("ANGTAPI",number_readobjects,&ANGTAPI,varname_list, value_list)){
ANGTAPI=0;
fprintf(fp,"Variable ANGTAPI is set to default value %f.\n",ANGTAPI);}
if (get_float_from_objectlist("ANGTAPO",number_readobjects,&ANGTAPO,varname_list, value_list)){
ANGTAPO=70;
fprintf(fp,"Variable ANGTAPO is set to default value %f.\n",ANGTAPO);}
}
}
fprintf(fp,"\nEnd of setting default values\n");
fprintf(fp,"=====================================\n\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