Commit 14beb822 authored by fabian.kuehn's avatar fabian.kuehn

Added Reverse Time Migration (RTM)

parent 04ca7c45
This diff is collapsed.
...@@ -19,19 +19,19 @@ EXEC= ../bin ...@@ -19,19 +19,19 @@ EXEC= ../bin
# LINUX with OpenMPI / IntelMPI and INTEL Compiler # LINUX with OpenMPI / IntelMPI and INTEL Compiler
# Use icc whenever possible, this will be much faster than gcc # Use icc whenever possible, this will be much faster than gcc
#CC=mpiicc
#LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lstdc++
#CFLAGS=-O3
#SFLAGS=-L./../contrib/libcseife -L./../contrib/bin
#IFLAGS=-I./../contrib/libcseife -I./../contrib/header -I.
# LINUX with OpenMPI / IntelMPI and GCC Compiler
CC=mpicc CC=mpicc
LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lstdc++ LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lstdc++
CFLAGS=-O3 CFLAGS=-O3
SFLAGS=-L./../contrib/libcseife -L./../contrib/bin SFLAGS=-L./../contrib/libcseife -L./../contrib/bin
IFLAGS=-I./../contrib/libcseife -I./../contrib/header -I. IFLAGS=-I./../contrib/libcseife -I./../contrib/header -I.
# LINUX with OpenMPI / IntelMPI and GCC Compiler
#CC=mpicc
#LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lstdc++
#CFLAGS=-O3
#SFLAGS=-L./../contrib/libcseife -L./../contrib/bin
#IFLAGS=-I./../contrib/libcseife -I./../contrib/header -I.
ifeq ($(TERM_PROGRAM),Apple_Terminal) ifeq ($(TERM_PROGRAM),Apple_Terminal)
LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lc++ LFLAGS=-lm -lcseife -lstfinv -laff -lfourierxx -lfftw3 -lc++
CC=mpicc CC=mpicc
...@@ -70,7 +70,6 @@ IFOS2D= \ ...@@ -70,7 +70,6 @@ IFOS2D= \
IFOS2D.c \ IFOS2D.c \
stf.c \ stf.c \
window_cos.c \ window_cos.c \
alloc_sections.c \
calc_mat_change_test.c \ calc_mat_change_test.c \
calc_res.c \ calc_res.c \
calc_misfit.c \ calc_misfit.c \
......
/*-----------------------------------------------------------------------------------------
* Copyright (C) 2016 For the list of authors, see file AUTHORS.
*
* This file is part of IFOS.
*
* IFOS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.0 of the License only.
*
* IFOS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with IFOS. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
/* Computation of local source coordinates
*
*
*/
#include "fd.h"
void alloc_sections(int ntr,int ns,float ***sectionvx,float ***sectionvy,float ***sectionvz,float ***sectionp,float ***sectionpnp1,float ***sectionpn,float ***sectioncurl,float ***sectiondiv,
float ***sectionpdata,float ***sectionpdiff,float ***sectionpdiffold,float ***sectionvxdata,float ***sectionvxdiff,float ***sectionvxdiffold,float ***sectionvydata,
float ***sectionvydiff,float ***sectionvydiffold,float ***sectionvzdata,float ***sectionvzdiff,float ***sectionvzdiffold)
{
extern int SEISMO, WAVETYPE;
extern FILE *FP;
switch (SEISMO){
case 1 : /* particle velocities only */
switch (WAVETYPE) {
case 1:
*sectionvx=matrix(1,ntr,1,ns);
*sectionvy=matrix(1,ntr,1,ns);
break;
case 2:
*sectionvz=matrix(1,ntr,1,ns);
break;
case 3:
*sectionvx=matrix(1,ntr,1,ns);
*sectionvy=matrix(1,ntr,1,ns);
*sectionvz=matrix(1,ntr,1,ns);
break;
}
break;
case 2 : /* pressure only */
*sectionp=matrix(1,ntr,1,ns);
*sectionpnp1=matrix(1,ntr,1,ns);
*sectionpn=matrix(1,ntr,1,ns);
break;
case 3 : /* curl and div only */
*sectioncurl=matrix(1,ntr,1,ns);
*sectiondiv=matrix(1,ntr,1,ns);
break;
case 4 : /* everything */
switch (WAVETYPE) {
case 1:
*sectionvx=matrix(1,ntr,1,ns);
*sectionvy=matrix(1,ntr,1,ns);
break;
case 2:
*sectionvz=matrix(1,ntr,1,ns);
break;
case 3:
*sectionvx=matrix(1,ntr,1,ns);
*sectionvy=matrix(1,ntr,1,ns);
*sectionvz=matrix(1,ntr,1,ns);
break;
}
*sectioncurl=matrix(1,ntr,1,ns);
*sectiondiv=matrix(1,ntr,1,ns);
*sectionp=matrix(1,ntr,1,ns);
break;
case 5 : /* everything except curl and div*/
switch (WAVETYPE) {
case 1:
*sectionvx=matrix(1,ntr,1,ns);
*sectionvy=matrix(1,ntr,1,ns);
break;
case 2:
*sectionvz=matrix(1,ntr,1,ns);
break;
case 3:
*sectionvx=matrix(1,ntr,1,ns);
*sectionvy=matrix(1,ntr,1,ns);
*sectionvz=matrix(1,ntr,1,ns);
break;
}
*sectionp=matrix(1,ntr,1,ns);
break;
}
*sectionpdata=matrix(1,ntr,1,ns);
*sectionpdiff=matrix(1,ntr,1,ns);
*sectionpdiffold=matrix(1,ntr,1,ns);
switch (WAVETYPE) {
case 1:
*sectionvxdata=matrix(1,ntr,1,ns);
*sectionvxdiff=matrix(1,ntr,1,ns);
*sectionvxdiffold=matrix(1,ntr,1,ns);
*sectionvydata=matrix(1,ntr,1,ns);
*sectionvydiff=matrix(1,ntr,1,ns);
*sectionvydiffold=matrix(1,ntr,1,ns);
break;
case 2:
*sectionvzdata=matrix(1,ntr,1,ns);
*sectionvzdiff=matrix(1,ntr,1,ns);
*sectionvzdiffold=matrix(1,ntr,1,ns);
break;
case 3:
*sectionvxdata=matrix(1,ntr,1,ns);
*sectionvxdiff=matrix(1,ntr,1,ns);
*sectionvxdiffold=matrix(1,ntr,1,ns);
*sectionvydata=matrix(1,ntr,1,ns);
*sectionvydiff=matrix(1,ntr,1,ns);
*sectionvydiffold=matrix(1,ntr,1,ns);
*sectionvzdata=matrix(1,ntr,1,ns);
*sectionvzdiff=matrix(1,ntr,1,ns);
*sectionvzdiffold=matrix(1,ntr,1,ns);
break;
}
}
void dealloc_sections(int ntr,int ns,int **recpos_loc,float **sectionvx,float **sectionvy,float **sectionvz,float **sectionp,float **sectionpnp1,float **sectionpn,float **sectioncurl,float **sectiondiv,
float **sectionpdata,float **sectionpdiff,float **sectionpdiffold,float **sectionvxdata,float **sectionvxdiff,float **sectionvxdiffold,float **sectionvydata,
float **sectionvydiff,float **sectionvydiffold,float **sectionvzdata,float **sectionvzdiff,float **sectionvzdiffold)
{
extern int SEISMO, WAVETYPE;
extern FILE *FP;
free_imatrix(recpos_loc,1,3,1,ntr);
switch (SEISMO){
case 1 : /* particle velocities only */
if (WAVETYPE==1 || WAVETYPE==3) {
free_matrix(sectionvx,1,ntr,1,ns);
free_matrix(sectionvy,1,ntr,1,ns);
}
if (WAVETYPE==2 || WAVETYPE==3) {
free_matrix(sectionvz,1,ntr,1,ns);
}
break;
case 2 : /* pressure only */
if (WAVETYPE==1 || WAVETYPE==3) {
free_matrix(sectionp,1,ntr,1,ns);
free_matrix(sectionpn,1,ntr,1,ns);
free_matrix(sectionpnp1,1,ntr,1,ns);
}
break;
case 3 : /* curl and div only */
if (WAVETYPE==1 || WAVETYPE==3) {
free_matrix(sectioncurl,1,ntr,1,ns);
free_matrix(sectiondiv,1,ntr,1,ns);
}
break;
case 4 : /* everything */
if (WAVETYPE==1 || WAVETYPE==3) {
free_matrix(sectionvx,1,ntr,1,ns);
free_matrix(sectionvy,1,ntr,1,ns);
free_matrix(sectionp,1,ntr,1,ns);
free_matrix(sectioncurl,1,ntr,1,ns);
free_matrix(sectiondiv,1,ntr,1,ns);
}
if (WAVETYPE==2 || WAVETYPE==3) {
free_matrix(sectionvz,1,ntr,1,ns);
}
break;
case 5 : /* everything except curl and div */
if (WAVETYPE==1 || WAVETYPE==3) {
free_matrix(sectionvx,1,ntr,1,ns);
free_matrix(sectionvy,1,ntr,1,ns);
free_matrix(sectionp,1,ntr,1,ns);
}
if (WAVETYPE==2 || WAVETYPE==3) {
free_matrix(sectionvz,1,ntr,1,ns);
}
break;
}
if (WAVETYPE==1 || WAVETYPE==3) {
free_matrix(sectionvxdata,1,ntr,1,ns);
free_matrix(sectionvxdiff,1,ntr,1,ns);
free_matrix(sectionvydata,1,ntr,1,ns);
free_matrix(sectionvydiff,1,ntr,1,ns);
free_matrix(sectionvydiffold,1,ntr,1,ns);
free_matrix(sectionvxdiffold,1,ntr,1,ns);
free_matrix(sectionpdata,1,ntr,1,ns);
free_matrix(sectionpdiff,1,ntr,1,ns);
free_matrix(sectionpdiffold,1,ntr,1,ns);
}
if (WAVETYPE==2 || WAVETYPE==3) {
free_matrix(sectionvzdata,1,ntr,1,ns);
free_matrix(sectionvzdiff,1,ntr,1,ns);
free_matrix(sectionvzdiffold,1,ntr,1,ns);
}
}
\ No newline at end of file
...@@ -31,14 +31,12 @@ void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[ST ...@@ -31,14 +31,12 @@ void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[ST
/* extern variables */ /* extern variables */
extern int INV_RHO_ITER,INV_VS_ITER,INV_VP_ITER; extern int INV_RHO_ITER,INV_VS_ITER,INV_VP_ITER;
extern int TIME_FILT,MYID; extern int TIME_FILT,MYID;
extern float F_HIGH_PASS;
extern float PRO; extern float PRO;
extern int WAVETYPE; extern int WAVETYPE;
extern float JOINT_INVERSION_PSV_SH_ALPHA_VS; extern float JOINT_INVERSION_PSV_SH_ALPHA_VS;
extern float JOINT_INVERSION_PSV_SH_ALPHA_RHO; extern float JOINT_INVERSION_PSV_SH_ALPHA_RHO;
extern int EPRECOND; extern int EPRECOND;
extern float EPSILON_WE; extern float EPSILON_WE;
extern float GAMMA;
extern int GRAD_METHOD; extern int GRAD_METHOD;
extern int WORKFLOW_STAGE; extern int WORKFLOW_STAGE;
...@@ -90,47 +88,42 @@ void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[ST ...@@ -90,47 +88,42 @@ void apply_workflow(float ** workflow,int workflow_lines,char workflow_header[ST
PRO=workflow[WORKFLOW_STAGE][5]; PRO=workflow[WORKFLOW_STAGE][5];
/* Frequency filtering */ /* Frequency filtering */
if( TIME_FILT == 1 ) { if(TIME_FILT==1) {
TIME_FILT=workflow[WORKFLOW_STAGE][6]; TIME_FILT=workflow[WORKFLOW_STAGE][6];
if(*F_LOW_PASS>workflow[WORKFLOW_STAGE][7]&&(workflow[WORKFLOW_STAGE][6]>0)) {
if( TIME_FILT > 0 ) { if(MYID==0)printf("\n Due to the abort criteriom F_LOW_PASS is already higher than specified in workflow\n");
if( F_HIGH_PASS != workflow[WORKFLOW_STAGE][7] ) *LBFGS_iter_start=*iter; if(MYID==0)printf(" therefore instead of %.2f HZ F_LOW_PASS=%.2f HZ is used\n",workflow[WORKFLOW_STAGE][7],*F_LOW_PASS);
F_HIGH_PASS=workflow[WORKFLOW_STAGE][7]; } else {
if(*F_LOW_PASS!=workflow[WORKFLOW_STAGE][7]) *LBFGS_iter_start=*iter;
if( *F_LOW_PASS != workflow[WORKFLOW_STAGE][8] ) *LBFGS_iter_start=*iter; *F_LOW_PASS=workflow[WORKFLOW_STAGE][7];
*F_LOW_PASS=workflow[WORKFLOW_STAGE][8];
} }
} else { } else {
if(MYID==0&&(workflow[WORKFLOW_STAGE][6]>0))printf("\n TIME_FILT cannot be activated due to it is not activated in the JSON File \n"); if(MYID==0&&(workflow[WORKFLOW_STAGE][6]>0))printf("\n TIME_FILT cannot be activated due to it is not activated in the JSON File \n");
} }
/* Change of wavetype */ /* Change of wavetype */
if(wavetype_start!=3&&(WAVETYPE!=workflow[WORKFLOW_STAGE][9])){ if(wavetype_start!=3&&(WAVETYPE!=workflow[WORKFLOW_STAGE][8])){
if(MYID==0)printf("\n Sorry, change of WAVETYPE with workflow only possible if WAVETYPE==3 in *.json"); if(MYID==0)printf("\n Sorry, change of WAVETYPE with workflow only possible if WAVETYPE==3 in *.json");
if(MYID==0)printf("\n WAVETYPE will remain unchanged %i",WAVETYPE); if(MYID==0)printf("\n WAVETYPE will remain unchanged %i",WAVETYPE);
} else { } else {
/* detect change and reset some things */ /* detect change and reset some things */
if(WAVETYPE!=workflow[WORKFLOW_STAGE][9]) { if(WAVETYPE!=workflow[WORKFLOW_STAGE][8]) {
*change_wavetype_iter=*iter; *change_wavetype_iter=*iter;
*LBFGS_iter_start=*iter; *LBFGS_iter_start=*iter;
} }
WAVETYPE=workflow[WORKFLOW_STAGE][9]; WAVETYPE=workflow[WORKFLOW_STAGE][8];
} }
/* Joint inversion PSV and SH */ /* Joint inversion PSV and SH */
JOINT_INVERSION_PSV_SH_ALPHA_VS=workflow[WORKFLOW_STAGE][10]; JOINT_INVERSION_PSV_SH_ALPHA_VS=workflow[WORKFLOW_STAGE][9];
JOINT_INVERSION_PSV_SH_ALPHA_RHO=workflow[WORKFLOW_STAGE][11]; JOINT_INVERSION_PSV_SH_ALPHA_RHO=workflow[WORKFLOW_STAGE][10];
/* Approx. Hessian */ /* Approx. Hessian */
if(EPRECOND==0 && workflow[WORKFLOW_STAGE][12]!=0){ if(EPRECOND==0 && workflow[WORKFLOW_STAGE][11]!=0){
if(MYID==0) printf(" WARNING: EPRECOND have to be set >0 in JSON (if so, ignore this message)"); if(MYID==0) printf(" WARNING: EPRECOND have to be set >0 in JSON (if so, ignore this message)");
} }
EPRECOND=workflow[WORKFLOW_STAGE][11];
EPRECOND=workflow[WORKFLOW_STAGE][12]; EPSILON_WE=workflow[WORKFLOW_STAGE][12];
EPSILON_WE=workflow[WORKFLOW_STAGE][13];
GAMMA=workflow[WORKFLOW_STAGE][14];
if(*LBFGS_iter_start==*iter && GRAD_METHOD==2){ if(*LBFGS_iter_start==*iter && GRAD_METHOD==2){
if(MYID==0)printf("\n L-BFGS will be used from iteration %d on.",*LBFGS_iter_start+1); if(MYID==0)printf("\n L-BFGS will be used from iteration %d on.",*LBFGS_iter_start+1);
......
...@@ -29,7 +29,7 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN ...@@ -29,7 +29,7 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN
extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN; extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN;
extern char TRKILL_FILE[STRING_SIZE]; extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY; extern int VELOCITY;
extern int WRITE_FILTERED_DATA;
int i,j; int i,j;
float l2; float l2;
int h; int h;
...@@ -180,10 +180,8 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN ...@@ -180,10 +180,8 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN
abs_sectiondata+=intseis_sectiondata[i][j]*intseis_sectiondata[i][j]; abs_sectiondata+=intseis_sectiondata[i][j]*intseis_sectiondata[i][j];
abs_section+=intseis_section[i][j]*intseis_section[i][j]; abs_section+=intseis_section[i][j]*intseis_section[i][j];
} }
if (abs_sectiondata==0) abs_sectiondata=1; abs_sectiondata=sqrt(abs_sectiondata);
else abs_sectiondata=sqrt(abs_sectiondata); abs_section=sqrt(abs_section);
if (abs_section==0) abs_section==1;
else abs_section=sqrt(abs_section);
} }
/* calculate L2 residuals */ /* calculate L2 residuals */
...@@ -202,15 +200,6 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN ...@@ -202,15 +200,6 @@ double calc_misfit(float **sectiondata, float **section, int ntr, int ns, int LN
} }
} }
if(WRITE_FILTERED_DATA==2){
for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){
sectiondata[i][j]=intseis_sectiondata[i][j];
section[i][j]=intseis_section[i][j];
}
}
}
l2=L2; l2=L2;
/* printf("\n MYID = %i IN CALC_MISFIT: L2 = %10.12f \n",MYID,l2); */ /* printf("\n MYID = %i IN CALC_MISFIT: L2 = %10.12f \n",MYID,l2); */
......
...@@ -27,6 +27,7 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float ...@@ -27,6 +27,7 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float
extern float DT, WATERLEVEL_LNORM8; extern float DT, WATERLEVEL_LNORM8;
extern int REC1, REC2, MYID, ACOUSTIC; extern int REC1, REC2, MYID, ACOUSTIC;
extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN; extern int TRKILL, NORMALIZE, F_LOW_PASS, TIMEWIN;
extern int RTM;
extern char TRKILL_FILE[STRING_SIZE]; extern char TRKILL_FILE[STRING_SIZE];
extern int VELOCITY, USE_WORKFLOW, WORKFLOW_STAGE; extern int VELOCITY, USE_WORKFLOW, WORKFLOW_STAGE;
float RMS, signL1; float RMS, signL1;
...@@ -207,10 +208,8 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float ...@@ -207,10 +208,8 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float
abs_section+=intseis_section[i][j]*intseis_section[i][j]; abs_section+=intseis_section[i][j]*intseis_section[i][j];
sectiondata_mult_section+=intseis_sectiondata[i][j]*intseis_section[i][j]; /* calculation of dot product for measured (section) and synthetic (sectiondata) data*/ sectiondata_mult_section+=intseis_sectiondata[i][j]*intseis_section[i][j]; /* calculation of dot product for measured (section) and synthetic (sectiondata) data*/
} }
if (abs_sectiondata==0) abs_sectiondata=1; abs_sectiondata=sqrt(abs_sectiondata);
else abs_sectiondata=sqrt(abs_sectiondata); abs_section=sqrt(abs_section);
if (abs_section==0) abs_section==1;
else abs_section=sqrt(abs_section);
} }
/* calculate residual seismograms and norm */ /* calculate residual seismograms and norm */
...@@ -275,6 +274,12 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float ...@@ -275,6 +274,12 @@ double calc_res(float **sectiondata, float **section, float **sectiondiff, float
L2+=fabs(sectiondiff[i][invtime])*fabs(sectiondiffold[i][j]); L2+=fabs(sectiondiff[i][invtime])*fabs(sectiondiffold[i][j]);
} }
/* replace residuals for reverse time migration*/
if(RTM==1){
sectiondiff[i][invtime]=sectiondata[i][j];
}
sectiondiff[i][invtime]=sectiondata[i][j];
/*L2+=sectiondiff[i][invtime];*/ /*L2+=sectiondiff[i][invtime];*/
invtime--; /* reverse time direction */ invtime--; /* reverse time direction */
......
...@@ -277,7 +277,7 @@ void checkfd(FILE *fp, float ** prho, float ** ppi, float ** pu, float ** ptaus, ...@@ -277,7 +277,7 @@ void checkfd(FILE *fp, float ** prho, float ** ppi, float ** pu, float ** ptaus,
therefore we determine the minimum/maximum position in y-direction by the ZREC1 variable and vice versa. therefore we determine the minimum/maximum position in y-direction by the ZREC1 variable and vice versa.
this has to be considered for the receiver line coordinates specified in both the input file and separate source/receiver files*/ this has to be considered for the receiver line coordinates specified in both the input file and separate source/receiver files*/
if (READREC==0 || READREC==2) { if (READREC==0) {
if (XREC1>XREC2) { if (XREC1>XREC2) {
srec_maxx=XREC1; srec_maxx=XREC1;
srec_minx=XREC2; srec_minx=XREC2;
......
...@@ -30,7 +30,7 @@ void exchange_par(void){ ...@@ -30,7 +30,7 @@ void exchange_par(void){
extern float XREC1, XREC2, YREC1, YREC2, FPML; extern float XREC1, XREC2, YREC1, YREC2, FPML;
extern float REC_ARRAY_DEPTH, REC_ARRAY_DIST, MUN, EPSILON, EPSILON_u, EPSILON_rho; extern float REC_ARRAY_DEPTH, REC_ARRAY_DIST, MUN, EPSILON, EPSILON_u, EPSILON_rho;
extern int SEISMO, NDT, NGEOPH, SEIS_FORMAT, FREE_SURF, READMOD, READREC, SRCREC; extern int SEISMO, NDT, NGEOPH, SEIS_FORMAT, FREE_SURF, READMOD, READREC, SRCREC;
extern int BOUNDARY, REC_ARRAY, DRX, FW, STF_FULL; extern int BOUNDARY, REC_ARRAY, DRX, FW;
extern int SNAPSHOT_START,SNAPSHOT_END,SNAPSHOT_INCR; extern int SNAPSHOT_START,SNAPSHOT_END,SNAPSHOT_INCR;
extern float TSNAP1, TSNAP2, TSNAPINC, REFREC[4]; extern float TSNAP1, TSNAP2, TSNAPINC, REFREC[4];
extern char MFILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE],SIGNAL_FILE_SH[STRING_SIZE], LOG_FILE[STRING_SIZE]; extern char MFILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE],SIGNAL_FILE_SH[STRING_SIZE], LOG_FILE[STRING_SIZE];
...@@ -59,9 +59,10 @@ void exchange_par(void){ ...@@ -59,9 +59,10 @@ void exchange_par(void){
extern float npower, k_max_PML; extern float npower, k_max_PML;
extern int INV_STF, N_STF, N_STF_START; extern int INV_STF, N_STF, N_STF_START;
extern char PARA[STRING_SIZE]; extern char PARA[STRING_SIZE];
extern int TIME_FILT, ORDER,WRITE_FILTERED_DATA; extern int TIME_FILT, ORDER, ZERO_PHASE,WRITE_FILTERED_DATA;
extern float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS; extern float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS;
extern int LNORM, DTINV; extern int LNORM, DTINV;
extern int RTM;
extern int STEPMAX; extern int STEPMAX;
extern float EPS_SCALE, SCALEFAC; extern float EPS_SCALE, SCALEFAC;
extern float PRO; extern float PRO;
...@@ -95,7 +96,6 @@ void exchange_par(void){ ...@@ -95,7 +96,6 @@ void exchange_par(void){
extern int WAVETYPE; extern int WAVETYPE;
extern int SOURCE_SHAPE_SH; extern int SOURCE_SHAPE_SH;
extern int JOINT_INVERSION_PSV_SH_TYPE; extern int JOINT_INVERSION_PSV_SH_TYPE;
extern int JOINT_EQUAL_WEIGHTING;
/* Workflow */ /* Workflow */
extern char FILE_WORKFLOW[STRING_SIZE]; extern char FILE_WORKFLOW[STRING_SIZE];
extern int USE_WORKFLOW; extern int USE_WORKFLOW;
...@@ -326,7 +326,7 @@ void exchange_par(void){ ...@@ -326,7 +326,7 @@ void exchange_par(void){
idum[85] = NO_OF_TESTSHOTS; idum[85] = NO_OF_TESTSHOTS;
// idum[86] = EMPTY; idum[86] = ZERO_PHASE;
idum[87] = VELOCITY; idum[87] = VELOCITY;
...@@ -376,8 +376,8 @@ void exchange_par(void){ ...@@ -376,8 +376,8 @@ void exchange_par(void){
idum[115]=TRKILL_STF_OFFSET; idum[115]=TRKILL_STF_OFFSET;
idum[116]=TRKILL_STF_OFFSET_INVERT; idum[116]=TRKILL_STF_OFFSET_INVERT;
idum[117]=JOINT_EQUAL_WEIGHTING; idum[117]=RTM;
idum[118]=STF_FULL;
} /** if (MYID == 0) **/ } /** if (MYID == 0) **/
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
...@@ -612,7 +612,7 @@ void exchange_par(void){ ...@@ -612,7 +612,7 @@ void exchange_par(void){
NO_OF_TESTSHOTS = idum[85]; NO_OF_TESTSHOTS = idum[85];
// EMPTY = idum[86]; ZERO_PHASE = idum[86];
VELOCITY = idum[87]; VELOCITY = idum[87];
...@@ -663,8 +663,8 @@ void exchange_par(void){ ...@@ -663,8 +663,8 @@ void exchange_par(void){
TRKILL_STF_OFFSET=idum[115]; TRKILL_STF_OFFSET=idum[115];
TRKILL_STF_OFFSET_INVERT=idum[116]; TRKILL_STF_OFFSET_INVERT=idum[116];
JOINT_EQUAL_WEIGHTING=idum[117]; RTM=idum[117];
STF_FULL=idum[118];
if ( MYID!=0 && L>0 ) { if ( MYID!=0 && L>0 ) {
FL=vector(1,L); FL=vector(1,L);
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define STRING_SIZE 74 #define STRING_SIZE 74
#define STRING_SIZE2 256 #define STRING_SIZE2 256
#define REQUEST_COUNT 4 #define REQUEST_COUNT 4
#define WORKFLOW_MAX_VAR 14 #define WORKFLOW_MAX_VAR 12
/* declaration of functions */ /* declaration of functions */
...@@ -47,10 +47,6 @@ void spat_filt(float ** waveconv, int iter, int sws); ...@@ -47,10 +47,6 @@ void spat_filt(float ** waveconv, int iter, int sws);
float norm(float ** waveconv, int iter, int sws); float norm(float ** waveconv, int iter, int sws);
void alloc_sections(int ntr,int ns,float ***sectionvx,float ***sectionvy,float ***sectionvz,float ***sectionp,float ***sectionpnp1,float ***sectionpn,float ***sectioncurl,float ***sectiondiv,
float ***sectionpdata,float ***sectionpdiff,float ***sectionpdiffold,float ***sectionvxdata,float ***sectionvxdiff,float ***sectionvxdiffold,float ***sectionvydata,
float ***sectionvydiff,float ***sectionvydiffold,float ***sectionvzdata,float ***sectionvzdiff,float ***sectionvzdiffold);
void av_mat(float ** pi, float ** u, void av_mat(float ** pi, float ** u,
float ** ppijm, float ** puip, float ** pujm); float ** ppijm, float ** puip, float ** pujm);
...@@ -99,10 +95,6 @@ void count_killed_traces(int ntr, int swstestshot, int ntr_glob, int **recpos_lo ...@@ -99,10 +95,6 @@ void count_killed_traces(int ntr, int swstestshot, int ntr_glob, int **recpos_lo
void create_trkill_table(int ** killtable, int ntr_glob, int **recpos, int nsrc_glob, float **srcpos, int ishot, float kill_offset_lower, float kill_offset_upper); void create_trkill_table(int ** killtable, int ntr_glob, int **recpos, int nsrc_glob, float **srcpos, int ishot, float kill_offset_lower, float kill_offset_upper);
void dealloc_sections(int ntr,int ns,int **recpos_loc,float **sectionvx,float **sectionvy,float **sectionvz,float **sectionp,float **sectionpnp1,float **sectionpn,float **sectioncurl,float **sectiondiv,
float **sectionpdata,float **sectionpdiff,float **sectionpdiffold,float **sectionvxdata,float **sectionvxdiff,float **sectionvxdiffold,float **sectionvydata,
float **sectionvydiff,float **sectionvydiffold,float **sectionvzdata,float **sectionvzdiff,float **sectionvzdiffold);
float exchange_L2(float L2, int sw, int bcast_l2); float exchange_L2(float L2, int sw, int bcast_l2);
void exchange_rsg(float ** vx, float ** vy, float ** vz, void exchange_rsg(float ** vx, float ** vy, float ** vz,
...@@ -234,7 +226,7 @@ void readmod_elastic(float ** rho, float ** pi, float ** u); ...@@ -234,7 +226,7 @@ void readmod_elastic(float ** rho, float ** pi, float ** u);
void readmod_elastic_es(float ** rho, float ** pi, float ** u, float ** matmod, int is); void readmod_elastic_es(float ** rho, float ** pi, float ** u, float ** matmod, int is);
int **receiver(int* ntr, float** srcpos, int shotno); int **receiver(FILE *fp, int *ntr);
void save_checkpoint(int nx1, int nx2, int ny1, int ny2, void save_checkpoint(int nx1, int nx2, int ny1, int ny2,
float ** vx, float ** vy, float ** sxx, float ** syy, float ** sxy); float ** vx, float ** vy, float ** sxx, float ** syy, float ** sxy);
...@@ -507,7 +499,7 @@ void update_v_acoustic_PML(int nx1, int nx2, int ny1, int ny2, int nt, ...@@ -507,7 +499,7 @@ void update_v_acoustic_PML(int nx1, int nx2, int ny1, int ny2, int nt,
float ** psi_sxx_x, float ** psi_syy_y); float ** psi_sxx_x, float ** psi_syy_y);
void update_p_PML(int nx1, int nx2, int ny1, int ny2, void update_p_PML(int nx1, int nx2, int ny1, int ny2,
float ** vx, float ** vy, float ** sp, float ** u, float ** pi, float ** absorb_coeff, float **rho, float *hc, int infoout, float ** vx, float ** vy, float ** sp, float ** pi, float ** absorb_coeff, float **rho, float *hc, int infoout,
float * K_x, float * a_x, float * b_x, float * K_x_half, float * a_x_half, float * b_x_half, float * K_x, float * a_x, float * b_x, float * K_x_half, float * a_x_half, float * b_x_half,
float * K_y, float * a_y, float * b_y, float * K_y_half, float * a_y_half, float * b_y_half, float * K_y, float * a_y, float * b_y, float * K_y_half, float * a_y_half, float * b_y_half,
float ** psi_vxx, float ** psi_vyy, float ** psi_vxy, float ** psi_vyx); float ** psi_vxx, float ** psi_vyy, float ** psi_vxy, float ** psi_vyx);
...@@ -534,8 +526,6 @@ float average_matrix(float ** matrix); ...@@ -534,8 +526,6 @@ float average_matrix(float ** matrix);
float global_maximum(float ** gradiant_1); float global_maximum(float ** gradiant_1);
void write_matrix_disk(float ** gradient,char path_name[STRING_SIZE]); void write_matrix_disk(float ** gradient,char path_name[STRING_SIZE]);
float matrix_product(float ** matrix1, float **matrix2); float matrix_product(float ** matrix1, float **matrix2);
void get_local_from_global_matrix(float ** global_matrix,float ** local_matrix);
float ** get_global_from_local_matrix(float ** local_matrix);
/* L-BFGS */ /* L-BFGS */
void lbfgs(float **grad1, float **grad2, float **grad3,float Vs_avg,float rho_avg,float Vp_avg, float *bfgsscale, float **bfgsmod, float **bfgsgrad,int bfgsnum,int bfgspar, int iteration, int * LBFGS_iter_start); void lbfgs(float **grad1, float **grad2, float **grad3,float Vs_avg,float rho_avg,float Vp_avg, float *bfgsscale, float **bfgsmod, float **bfgsgrad,int bfgsnum,int bfgspar, int iteration, int * LBFGS_iter_start);
......
...@@ -14,7 +14,7 @@ float XREC1, XREC2, YREC1, YREC2; ...@@ -14,7 +14,7 @@ float XREC1, XREC2, YREC1, YREC2;
float REC_ARRAY_DEPTH, REC_ARRAY_DIST; float REC_ARRAY_DEPTH, REC_ARRAY_DIST;
float REFREC[4]={0.0, 0.0, 0.0, 0.0}, FPML; float REFREC[4]={0.0, 0.0, 0.0, 0.0}, FPML;
int SEISMO, NDT, NGEOPH, NSRC=1, SEIS_FORMAT, FREE_SURF, READMOD, READREC, SRCREC, FW=0; int SEISMO, NDT, NGEOPH, NSRC=1, SEIS_FORMAT, FREE_SURF, READMOD, READREC, SRCREC, FW=0;
int NX, NY, NT, SOURCE_SHAPE,SOURCE_SHAPE_SH, SOURCE_TYPE, SNAP, SNAP_FORMAT, REC_ARRAY, RUN_MULTIPLE_SHOTS, NTRG,STF_FULL; int NX, NY, NT, SOURCE_SHAPE,SOURCE_SHAPE_SH, SOURCE_TYPE, SNAP, SNAP_FORMAT, REC_ARRAY, RUN_MULTIPLE_SHOTS, NTRG;
int L, BOUNDARY, DC, DRX, NXG, NYG, IDX, IDY, FDORDER, MAXRELERROR; int L, BOUNDARY, DC, DRX, NXG, NYG, IDX, IDY, FDORDER, MAXRELERROR;
char SNAP_FILE[STRING_SIZE], SOURCE_FILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE], SIGNAL_FILE_SH[STRING_SIZE]; char SNAP_FILE[STRING_SIZE], SOURCE_FILE[STRING_SIZE], SIGNAL_FILE[STRING_SIZE], SIGNAL_FILE_SH[STRING_SIZE];
char MFILE[STRING_SIZE], REC_FILE[STRING_SIZE]; char MFILE[STRING_SIZE], REC_FILE[STRING_SIZE];
...@@ -72,11 +72,12 @@ int TAPER_STF; ...@@ -72,11 +72,12 @@ int TAPER_STF;
int INV_STF, N_STF, N_STF_START,TW_IND; int INV_STF, N_STF, N_STF_START,TW_IND;
char PARA[STRING_SIZE]; char PARA[STRING_SIZE];
int TIME_FILT, ORDER; int TIME_FILT, ORDER, ZERO_PHASE;
int WRITE_FILTERED_DATA; int WRITE_FILTERED_DATA;
float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS; float F_LOW_PASS_START, F_LOW_PASS_END, F_LOW_PASS_INCR, F_HIGH_PASS;
int LNORM, DTINV; int LNORM, DTINV;
int RTM;
int STEPMAX; int STEPMAX;
float EPS_SCALE, SCALEFAC; float EPS_SCALE, SCALEFAC;
...@@ -143,8 +144,6 @@ int VERBOSE; ...@@ -143,8 +144,6 @@ int VERBOSE;
int WAVETYPE; int WAVETYPE;
int JOINT_INVERSION_PSV_SH_TYPE; int JOINT_INVERSION_PSV_SH_TYPE;
int JOINT_EQUAL_WEIGHTING;
float JOINT_INVERSION_PSV_SH_ALPHA_VS;