Commit e1797a92 authored by valerie.krampe's avatar valerie.krampe

Implementation of VTI forward solver and VTI inversion for SH component

parent 9accb585
......@@ -375,6 +375,29 @@ Small $Q$ values ($Q<50$) may lead to significant amplitude decay and velocity d
The frequency dependence of attenuation, i.e. $Q$ and phase velocity as a function of frequency, may be calculated using the Matlab functions in the directory mfiles. The Matlab script /mfiles/qplot.m can be used to plot $Q(\omega)$ for different values of L, $f_l$ and $\tau$. The m-file qapprox.m in the same directory finds optimal values for L, $f_l$ and $\tau$ that fit a desired function $Q(\omega)=const$ in a least-squares sense.
\section{Anisotropic modeling and inversion}
\label{anisotropy}
{\color{blue}{\begin{verbatim}
"Anisotropy" : "comment",
"VTI" : "0",
\end{verbatim}}}
With VTI=1, the forward modeling and the inversion is calculated for a vertically transversely isotropic medium. For the forward modeling with WAVETYPE=1, additional models of the Thomsen parameters $\varepsilon$ and $\delta$ are needed with the file name expansions ``.epsilon'' and ``.delta''. For WAVETYPE=2, the input models are density, vertical S-wave velocity and horizontal S-wave velocity (``.rho'', ``.vs'', ``.vshor''). The inversion is only implemented for SH waves (WAVETYPE=2) and should only be used with VELOCITY=1. Additional parameters that are used equivalent to those existing for the isotropic case are
{\color{blue}{\begin{verbatim}
"INV_VSHOR_ITER" : "0",
"VSHORUPPERLIM" : "5000",
"VSHORLOWERLIM" : "0",
\end{verbatim}}}
\noindent
Additionally, with
{\color{blue}{\begin{verbatim}
"GAMMA_VTI" : "0",
\end{verbatim}}}
a maximal absolute value of the Thomsen parameter $\gamma$ can be defined to constrain updates of the velocities (constraint is not active for GAMMA\_VTI=0).
\section{Wavefield snapshots}
{\color{blue}{\begin{verbatim}
"Snapshots" : "comment",
......
/*-----------------------------------------------------------------------------------------
* Copyright (C) 2005 <name of author>
*
* This file is part of DENISE.
*
* DENISE 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.
*
* DENISE 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 DENISE. See file COPYING and/or <http://www.gnu.org/licenses/gpl-2.0.html>.
-----------------------------------------------------------------------------------------*/
/*
* Model 1D linear gradient
* Vertically transversely isotropic model
*/
#include "fd.h"
void model_elastic_vti(float ** rho, float ** pi, float ** u, float ** delta, float ** epsilon, float ** vshor){
/*--------------------------------------------------------------------------*/
/* extern variables */
extern int NX, NY, NXG, NYG, POS[3], L, MYID;
extern char MFILE[STRING_SIZE];
extern char INV_MODELFILE[STRING_SIZE];
extern float DH;
/* local variables */
float vp, vs, rhov, grad1, grad2, grad3, grad4, grad5, grad6, y;
float c11v, c13v, c33v, c55v, c66v, deltav, epsilonv, vshorv;
int i, j, ii, jj;
char modfile[STRING_SIZE];
float ** pwavemod=NULL, ** swavemod=NULL;
/* parameter defintion:
* vp = vertical P-wave-velocity, vs = vertical S-wave-velocity, vshor = horizontal S-wave-velocity
* delta, epsilon = Thomsen parameters */
/* parameters for layer 1 */
const float vp1=500.0, vs1=300.0, rho1=1800.0, h=15.0;
const float delta1=0.1, epsilon1=0.2, vshor1=550;
/* parameters for layer 2 due to calculation of grad1, grad2 and grad3*/
const float vp2=1200.0, vs2=700.0, rho2=2000.0;
const float delta2=0.1, epsilon2=0.2, vshor2=1500;
/*-----------------------------------------------------------------------*/
y=h/DH;
if(y==NYG) declare_error(" \n y is equal NYG !! see src/model_grad.c \n ");
grad1=(vp2-vp1)/y;
grad2=(vs2-vs1)/y;
grad3=(rho2-rho1)/y;
grad4=(delta2-delta1)/y;
grad5=(epsilon2-epsilon1)/y;
grad6=(vshor2-vshor1)/y;
/* loop over global grid */
for (i=1;i<=NXG;i++){
for (j=1;j<=NYG;j++){
if(j<=y){
vp=vp1+(j*grad1);
vs=vs1+(j*grad2);
rhov=rho1+(j*grad3);
deltav=delta1+(j*grad4);
epsilonv=epsilon1+(j*grad5);
vshorv=vshor1+(j*grad6);
}
else{
vp=vp2;
vs=vs2;
rhov=rho2;
deltav=delta2;
epsilonv=epsilon2;
vshorv=vshor2;
}
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if ((POS[1]==((i-1)/NX)) &&
(POS[2]==((j-1)/NY))){
ii=i-POS[1]*NX;
jj=j-POS[2]*NY;
u[jj][ii]=vs;
pi[jj][ii]=vp;
rho[jj][ii]=rhov;
delta[jj][ii]=deltav;
epsilon[jj][ii]=epsilonv;
vshor[jj][ii]=vshorv;
}
}
}
sprintf(modfile,"%s_rho_it_0.bin",INV_MODELFILE);
writemod(modfile,rho,3);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0) mergemod(modfile,3);
sprintf(modfile,"%s_vs_it_0.bin",INV_MODELFILE);
writemod(modfile,u,3);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0) mergemod(modfile,3);
sprintf(modfile,"%s_vp_it_0.bin",INV_MODELFILE);
writemod(modfile,pi,3);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0) mergemod(modfile,3);
sprintf(modfile,"%s_vshor_it_0.bin",INV_MODELFILE);
writemod(modfile,vshor,3);
MPI_Barrier(MPI_COMM_WORLD);
if (MYID==0) mergemod(modfile,3);
}
......@@ -62,6 +62,9 @@
"NDT" : "1",
"SEIS_FORMAT" : "1",
"SEIS_FILE" : "su/IFOS",
"Anisotropy" : "comment",
"VTI" : "0",
"Q-approximation" : "comment",
"L" : "0",
......
......@@ -62,6 +62,9 @@
"NDT" : "1",
"SEIS_FORMAT" : "1",
"SEIS_FILE" : "su/IFOS",
"Anisotropy" : "comment",
"VTI" : "0",
"Q-approximation" : "comment",
"L" : "0",
......@@ -222,6 +225,8 @@
"VSLOWERLIM" : "0",
"RHOUPPERLIM" : "5000",
"RHOLOWERLIM" : "0",
"VSHORUPPERLIM" : "5000",
"VSHORLOWERLIM" : "0",
"Limited update of model parameters in reference to the starting model" : "comment",
"S" : "0",
......@@ -232,6 +237,9 @@
"Minimum Vp/Vs-ratio" : "comment",
"VP_VS_RATIO" : "0.0",
"Maximal gamma-value (Thomsen parameter for VTI)" : "comment",
"GAMMA_VTI" : "0",
"Definition of smoothing the models vp and vs" : "comment",
"MODEL_FILTER" : "0",
"FILT_SIZE" : "5",
......
......@@ -40,7 +40,7 @@ int main(int argc, char **argv){
float muss, lamss;
float memdyn, memmodel, memseismograms, membuffer, memtotal, eps_scale;
float fac1, fac2;
float opteps_vp, opteps_vs, opteps_rho, Vp_avg, C_vp, Vs_avg, C_vs, rho_avg, C_rho;
float opteps_vp, opteps_vs, opteps_rho, Vp_avg, C_vp, Vs_avg, C_vs, rho_avg, C_rho, vshor_avg, C_vshor;
float memfwt, memfwt1, memfwtdata;
char *buff_addr, ext[10], *fileinp;
char jac[225];
......@@ -61,8 +61,9 @@ int main(int argc, char **argv){
float ** psxx, ** psxy, ** psyy, ** psxz, ** psyz, **psp, ** ux, ** uy, ** uxy, ** uyx, ** u, ** Vp0, ** uttx, ** utty, ** Vs0, ** Rho0;
float ** pvx, ** pvy, ** pvz, **waveconv, **waveconv_lam, **waveconv_mu, **waveconv_rho, **waveconv_rho_s, **waveconv_u, **waveconvtmp, **wcpart, **wavejac,**waveconv_rho_s_z,**waveconv_u_z,**waveconv_rho_z;
float **waveconv_shot, **waveconv_u_shot, **waveconv_rho_shot, **waveconv_u_shot_z, **waveconv_rho_shot_z;
float **waveconv_c55_shot_z, **waveconv_c66_shot_z, **waveconv_c55_s_z, **waveconv_c66_s_z, **waveconv_vshor_shot_z, **waveconv_vshor_z;
float ** pvxp1, ** pvyp1, ** pvzp1, ** pvxm1, ** pvym1, ** pvzm1;
float ** gradg, ** gradp,** gradg_rho, ** gradp_rho, ** gradg_u, ** gradp_u, ** gradp_u_z,** gradp_rho_z;
float ** gradg, ** gradp,** gradg_rho, ** gradp_rho, ** gradg_u, ** gradp_u, ** gradp_u_z,** gradp_rho_z, **gradp_vshor_z;
float ** prho,** prhonp1, **prip=NULL, **prjp=NULL, **pripnp1=NULL, **prjpnp1=NULL, ** ppi, ** pu, ** punp1, ** puipjp, ** ppinp1;
float ** vpmat, ***forward_prop_x, ***forward_prop_y, ***forward_prop_rho_x, ***forward_prop_u, ***forward_prop_rho_y, ***forward_prop_p;
......@@ -86,6 +87,10 @@ int main(int argc, char **argv){
float ** psi_sxx_x, ** psi_syy_y, ** psi_sxy_y, ** psi_sxy_x, ** psi_vxx, ** psi_vyy, ** psi_vxy, ** psi_vyx, ** psi_vxxs;
float ** psi_sxz_x, ** psi_syz_y, ** psi_vzx, ** psi_vzy;
/* Variables for vertically transversely isotropic modeling */
float **pc11=NULL, **pc13=NULL, **pc33=NULL, **pc55=NULL, **pc55ipjp=NULL, **pc66=NULL, **pc66ipjp=NULL;
float **pdelta=NULL, **pepsilon=NULL, **pgamma=NULL, **pvshornp1=NULL, **pvshor=NULL;
/* Variables for viscoelastic modeling */
float **ptaus=NULL, **ptaup=NULL, *etaip=NULL, *etajm=NULL, *peta=NULL, **ptausipjp=NULL, **fipjp=NULL, ***dip=NULL, *bip=NULL, *bjm=NULL;
float *cip=NULL, *cjm=NULL, ***d=NULL, ***e=NULL, ***pr=NULL, ***pp=NULL, ***pq=NULL, **f=NULL, **g=NULL;
......@@ -115,8 +120,8 @@ int main(int argc, char **argv){
int gradient_optimization=1;
float alpha_SL_min=0, alpha_SL_max=0, alpha_SL=1.0;
float alpha_SL_old;
float ** waveconv_old,** waveconv_u_old,** waveconv_rho_old;
float ** waveconv_up,** waveconv_u_up,** waveconv_rho_up;
float ** waveconv_old,** waveconv_u_old,** waveconv_rho_old,** waveconv_vshor_old;
float ** waveconv_up,** waveconv_u_up,** waveconv_rho_up,** waveconv_vshor_up;
float L2_SL_old=0, L2_SL_new=0;
float c1_SL=1e-4, c2_SL=0.9;
int wolfe_status;
......@@ -388,7 +393,7 @@ int main(int argc, char **argv){
if(GRAD_METHOD==2) {
/* Allocate memory for L-BFGS */
if(WAVETYPE==2) LBFGS_NPAR=2;
if(WAVETYPE==2 && !VTI) LBFGS_NPAR=2;
s_LBFGS=fmatrix(1,N_LBFGS,1,LBFGS_NPAR*NX*NY);
......@@ -488,6 +493,24 @@ int main(int argc, char **argv){
}
}
if (VTI) {
/* dynamic arrays for anisotropic modeling */
pc11 = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pc13 = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pc33 = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pc55 = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pc55ipjp = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pc66 = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pc66ipjp = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pdelta = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pepsilon = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
if(WAVETYPE==2 || WAVETYPE==3) {
pgamma = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
pvshornp1 = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
}
pvshor = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
}
if (L) {
/* dynamic (wavefield) arrays for viscoelastic modeling */
pr = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,L);
......@@ -550,7 +573,16 @@ int main(int argc, char **argv){
forward_prop_z_xz = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
forward_prop_z_yz = f3tensor(-nd+1,NY+nd,-nd+1,NX+nd,1,NT/DTINV);
waveconv_rho_shot_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_u_shot_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
if (VTI) {
waveconv_c55_shot_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_c66_shot_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_c55_s_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_c66_s_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_vshor_shot_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_vshor_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
gradp_vshor_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
}
waveconv_u_shot_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_mu_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_rho_s_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_u_z = matrix(-nd+1,NY+nd,-nd+1,NX+nd);
......@@ -571,11 +603,17 @@ int main(int argc, char **argv){
c2_SL=WOLFE_C2_SL;
waveconv_old= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
if(!ACOUSTIC) waveconv_u_old= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
if(!ACOUSTIC){
waveconv_u_old= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_vshor_old= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
}
waveconv_rho_old= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_up= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
if(!ACOUSTIC) waveconv_u_up= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
if(!ACOUSTIC) {
waveconv_u_up= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
waveconv_vshor_up= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
}
waveconv_rho_up= matrix(-nd+1,NY+nd,-nd+1,NX+nd);
}
......@@ -778,7 +816,12 @@ int main(int argc, char **argv){
if(L){
if(!ACOUSTIC){
if (READMOD){
readmod(prho,ppi,pu,ptaus,ptaup,peta);
if(VTI){
readmod_vti(prho,ppi,pu,pdelta,pepsilon,pvshor,ptaus,ptaup,peta);
}
else {
readmod(prho,ppi,pu,ptaus,ptaup,peta);
}
}else{
model(prho,ppi,pu,ptaus,ptaup,peta);
}
......@@ -792,9 +835,19 @@ int main(int argc, char **argv){
}else{
if(!ACOUSTIC){
if (READMOD){
readmod_elastic(prho,ppi,pu);
if (VTI) {
readmod_el_vti(prho,ppi,pu,pdelta,pepsilon,pvshor);
}
else {
readmod_elastic(prho,ppi,pu);
}
}else{
model_elastic(prho,ppi,pu);
if(VTI){
model_elastic_vti(prho,ppi,pu,pdelta,pepsilon,pvshor);
}
else {
model_elastic(prho,ppi,pu);
}
}
}else{
if (READMOD){
......@@ -806,7 +859,7 @@ int main(int argc, char **argv){
}
/* check if the FD run will be stable and free of numerical dispersion */
checkfd(FP, prho, ppi, pu, ptaus, ptaup, peta, hc, srcpos, nsrc, recpos, ntr_glob);
checkfd(FP, prho, ppi, pu, ptaus, ptaup, peta, hc, srcpos, nsrc, recpos, ntr_glob, pepsilon, pdelta, pvshor);
/* calculate damping coefficients for CPMLs*/
if(FW>0)
......@@ -899,15 +952,28 @@ int main(int argc, char **argv){
they have to be averaged. For this, values lying at 0 and NX+1,
for example, are required on the local grid. These are now copied from the
neighbouring grids */
if (VTI){
change_parameterization_vti(prho, ppi, pu, pepsilon, pdelta, pvshor, pc11, pc13, pc33, pc55, pc66);
}
if (L){
if(!ACOUSTIC){
matcopy(prho,ppi,pu,ptaus,ptaup);
if(VTI){
matcopy_vti(prho, pc11, pc13, pc33, pc55, pc66, ptaus, ptaup);
}
else {
matcopy(prho,ppi,pu,ptaus,ptaup);
}
} else {
matcopy_viscac(prho,ppi,ptaup);
}
}else{
if(!ACOUSTIC){
matcopy_elastic(prho, ppi, pu);
if (VTI) {
matcopy_elastic_vti(prho, pc11, pc13, pc33, pc55, pc66);
}
else {
matcopy_elastic(prho, ppi, pu);
}
}else{
matcopy_acoustic(prho, ppi);
}
......@@ -929,12 +995,18 @@ int main(int argc, char **argv){
if(!ACOUSTIC) av_mue(pu,puipjp,prho);
av_rho(prho,prip,prjp);
if (!ACOUSTIC && L) av_tau(ptaus,ptausipjp);
if (VTI) av_c55c66(pc55,pc55ipjp, pc66,pc66ipjp);
/* Preparing memory variables for update_s (viscoelastic) */
if (L) {
if(!ACOUSTIC){
prepare_update_s(etajm,etaip,peta,fipjp,pu,puipjp,ppi,prho,ptaus,ptaup,ptausipjp,f,g,bip,bjm,cip,cjm,dip,d,e);
if(VTI){
prepare_update_s_vti(etajm,etaip,peta,fipjp,pc55,pc66ipjp,ppi,prho,ptaus,ptaup,ptausipjp,f,g,bip,bjm,cip,cjm,dip,d,e);
}
else {
prepare_update_s(etajm,etaip,peta,fipjp,pu,puipjp,ppi,prho,ptaus,ptaup,ptausipjp,f,g,bip,bjm,cip,cjm,dip,d,e);
}
} else {
prepare_update_p(etajm,peta,ppi,prho,ptaup,g,bjm,cjm,e);
}
......@@ -978,13 +1050,24 @@ int main(int argc, char **argv){
Vp_avg=average_matrix(ppi);
rho_avg=average_matrix(prho);
if(!ACOUSTIC) Vs_avg=average_matrix(pu);
if (VTI) {
vshor_avg=average_matrix(pvshor);
}
if(!ACOUSTIC) if(VERBOSE) printf("MYID = %d \t Vp_avg = %e \t Vs_avg = %e \t rho_avg = %e \n ",MYID,Vp_avg,Vs_avg,rho_avg);
if(!ACOUSTIC) {
if (VTI) {
if (VERBOSE) printf("MYID = %d \t Vp_avg = %e \t Vs_avg = %e \t rho_avg = %e \t vshor_avg = %e \n ",MYID,Vp_avg,Vs_avg,rho_avg,vshor_avg);
}
else if(VERBOSE) printf("MYID = %d \t Vp_avg = %e \t Vs_avg = %e \t rho_avg = %e \n ",MYID,Vp_avg,Vs_avg,rho_avg);
}
else if(VERBOSE) printf("MYID = %d \t Vp_avg = %e \t rho_avg = %e \n ",MYID,Vp_avg,rho_avg);
C_vp = Vp_avg*Vp_avg;
if(!ACOUSTIC) C_vs = Vs_avg*Vs_avg;
C_rho = rho_avg*rho_avg;
if (VTI) {
C_vshor = vshor_avg*vshor_avg;
}
}
......@@ -1057,6 +1140,9 @@ int main(int argc, char **argv){
for (i=1;i<=NX;i=i+IDX){
waveconv_rho_z[j][i]=0.0;
waveconv_u_z[j][i]=0.0;
if (VTI) {
waveconv_vshor_z[j][i]=0.0;
}
}
}
......@@ -1251,18 +1337,33 @@ int main(int argc, char **argv){
}
}
if (WAVETYPE==2 || WAVETYPE==3) {
update_s_visc_PML_SH(1, NX, 1, NY, pvz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy);
if(VTI){
update_s_visc_vti_PML_SH(1, NX, 1, NY, pvz, uxz, uyz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy, pc55,pc66ipjp,prho);
}
else {
update_s_visc_PML_SH(1, NX, 1, NY, pvz, uxz, uyz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy);
}
}
} else { /* elastic */
if (WAVETYPE==1 || WAVETYPE==3) {
if(!ACOUSTIC) {
update_s_elastic_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, ppi, pu, puipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
if (VTI) {
update_s_el_vti_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, pc11, pc13, pc33, pc55ipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
else {
update_s_elastic_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, ppi, pu, puipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
} else {
update_p_PML(1, NX, 1, NY, pvx, pvy, psp, u, ppi, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
}
if (WAVETYPE==2 || WAVETYPE==3) {
update_s_elastic_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,puipjp,pu,prho);
if (VTI) {
update_s_el_vti_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,pc55,pc66ipjp,prho);
}
else {
update_s_elastic_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,puipjp,pu,prho);
}
}
}
......@@ -1279,7 +1380,12 @@ int main(int argc, char **argv){
surface_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, pp, pq, ppi, pu, prho, ptaup, ptaus, etajm, peta, hc, K_x, a_x, b_x, psi_vxxs, ux, uy,uxy,uyz,psxz,uxz);
}else{
/* elastic */
surface_elastic_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, ppi, pu, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
if (VTI) {
surface_el_vti_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, pc11, pc13, pc33, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
}
else {
surface_elastic_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, ppi, pu, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
}
}
} else {
/* viscoelastic and elastic ACOUSTIC */
......@@ -1588,12 +1694,23 @@ int main(int argc, char **argv){
/*initialize gradient matrices for each shot with zeros SH*/
if(WAVETYPE==2 || WAVETYPE==3){
if(FORWARD_ONLY==0){
for(j=1;j<=NY;j=j+IDY){
for(i=1;i<=NX;i=i+IDX){
waveconv_rho_shot_z[j][i]=0.0;
waveconv_u_shot_z[j][i]=0.0;
}
}
if (VTI) {
for(j=1;j<=NY;j=j+IDY){
for(i=1;i<=NX;i=i+IDX){
waveconv_rho_shot_z[j][i]=0.0;
waveconv_c55_shot_z[j][i]=0.0;
waveconv_c66_shot_z[j][i]=0.0;
}
}
}
else {
for(j=1;j<=NY;j=j+IDY){
for(i=1;i<=NX;i=i+IDX){
waveconv_rho_shot_z[j][i]=0.0;
waveconv_u_shot_z[j][i]=0.0;
}
}
}
}
}
......@@ -1694,18 +1811,33 @@ int main(int argc, char **argv){
}
}
if (WAVETYPE==2 || WAVETYPE==3) {
update_s_visc_PML_SH(1, NX, 1, NY, pvz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy);
if(VTI){
update_s_visc_vti_PML_SH(1, NX, 1, NY, pvz, uxz, uyz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy, pc55,pc66ipjp,prho);
}
else {
update_s_visc_PML_SH(1, NX, 1, NY, pvz, uxz, uyz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy);
}
}
} else { /* elastic */
if (WAVETYPE==1 || WAVETYPE==3) {
if(!ACOUSTIC) {
update_s_elastic_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, ppi, pu, puipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
if (VTI) {
update_s_el_vti_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, pc11, pc13, pc33, pc55ipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
else {
update_s_elastic_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, ppi, pu, puipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
} else {
update_p_PML(1, NX, 1, NY, pvx, pvy, psp, u, ppi, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
}
if (WAVETYPE==2 || WAVETYPE==3) {
update_s_elastic_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,puipjp,pu,prho);
if (VTI) {
update_s_el_vti_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,pc55,pc66ipjp,prho);
}
else {
update_s_elastic_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,puipjp,pu,prho);
}
}
}
......@@ -1723,7 +1855,12 @@ int main(int argc, char **argv){
surface_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, pp, pq, ppi, pu, prho, ptaup, ptaus, etajm, peta, hc, K_x, a_x, b_x, psi_vxxs, ux, uy,uxy,uyz,psxz,uxz);
}else{
/* elastic */
surface_elastic_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, ppi, pu, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
if (VTI) {
surface_el_vti_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, pc11, pc13, pc33, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
}
else {
surface_elastic_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, ppi, pu, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
}
}
} else {
/* viscoelastic and elastic ACOUSTIC */
......@@ -2201,16 +2338,31 @@ int main(int argc, char **argv){
}
}
if (WAVETYPE==2 || WAVETYPE==3) {
update_s_visc_PML_SH(1, NX, 1, NY, pvz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy);
if(VTI){
update_s_visc_vti_PML_SH(1, NX, 1, NY, pvz, uxz, uyz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy, pc55,pc66ipjp,prho);
}
else {
update_s_visc_PML_SH(1, NX, 1, NY, pvz, uxz, uyz, psxz, psyz, pt, po, bip, bjm, cip, cjm, d, dip,fipjp, f, hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy);
}
}
} else{
/* elastic */
if(!ACOUSTIC){
if (WAVETYPE==1 || WAVETYPE==3) {
update_s_elastic_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, ppi, pu, puipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
if (VTI) {
update_s_el_vti_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, pc11, pc13, pc33, pc55ipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
else {
update_s_elastic_PML(1, NX, 1, NY, pvx, pvy, ux, uy, uxy, uyx, psxx, psyy, psxy, ppi, pu, puipjp, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
}
}
if (WAVETYPE==2 || WAVETYPE==3) {
update_s_elastic_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,puipjp,pu,prho);
if (VTI) {
update_s_el_vti_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,pc55,pc66ipjp,prho);
}
else {
update_s_elastic_PML_SH(1, NX, 1, NY, pvz,psxz,psyz,uxz,uyz,hc,infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half,psi_vzx, psi_vzy,puipjp,pu,prho);
}
}
} else {
update_p_PML(1, NX, 1, NY, pvx, pvy, psp, u, ppi, absorb_coeff, prho, hc, infoout, K_x, a_x, b_x, K_x_half, a_x_half, b_x_half, K_y, a_y, b_y, K_y_half, a_y_half, b_y_half, psi_vxx, psi_vyy, psi_vxy, psi_vyx);
......@@ -2229,7 +2381,12 @@ int main(int argc, char **argv){
surface_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, pp, pq, ppi, pu, prho, ptaup, ptaus, etajm, peta, hc, K_x, a_x, b_x, psi_vxxs, ux, uy,uxy,uyz,psxz,uxz);
}else{
/* elastic */
surface_elastic_PML(1, pvx, pvy, psxx, psyy, psxy,psyz, ppi, pu, prho, hc, K_x, a_x, b_x, psi_vxxs, ux, uy, uxy,uyz,psxz,uxz);
if (VTI) {