Commit bcd714ae authored by Tilman Steinweg's avatar Tilman Steinweg

fixed bug in hh_visco.c

fixed bug which caused segmentation fault by using WRITE_MODELFILE=2
parent 8637f7d5
...@@ -54,12 +54,13 @@ void model_visco(float *** rho, float *** pi, float *** u, ...@@ -54,12 +54,13 @@ void model_visco(float *** rho, float *** pi, float *** u,
/*-----------------material property definition -------------------------*/ /*-----------------material property definition -------------------------*/
/* parameters for layer 1 */ /* parameters for layer 1 */
const float vp1=3500.0, vs1=2000.0, rho1=2000.0, h=1000000, qp1=20.0, qs1=10.0; const float vp1=3500.0, vs1=2000.0, rho1=2000.0, h=100000.0, qp1=20.0, qs1=10.0;
/* parameters for layer 2 */ /* parameters for layer 2 */
const float vp2=5700.0, vs2=3400.0, rho2=2500.0, qp2=200.0, qs2=100.0; const float vp2=5700.0, vs2=3400.0, rho2=2500.0, qp2=200.0, qs2=100.0;
/*internal switch for writing all models to file (WRITE_MODELFILES=1) /*internal switch for writing all models to file (WRITE_MODELFILES=1)
* or just density (WRITE_MODELFILES=0) * or just density (WRITE_MODELFILES=0)
* BE AWARE that the output of additional models besides density * BE AWARE that the output of additional models besides density
...@@ -155,7 +156,7 @@ void model_visco(float *** rho, float *** pi, float *** u, ...@@ -155,7 +156,7 @@ void model_visco(float *** rho, float *** pi, float *** u,
taup[jj][ii][kk]=TAU; taup[jj][ii][kk]=TAU;
} }
if (WRITE_MODELFILES) { if (WRITE_MODELFILES==1) {
pwavemod[jj][ii][kk]=Vp; pwavemod[jj][ii][kk]=Vp;
swavemod[jj][ii][kk]=Vs; swavemod[jj][ii][kk]=Vs;
qsmod[jj][ii][kk]=2/taus[jj][ii][kk]; qsmod[jj][ii][kk]=2/taus[jj][ii][kk];
...@@ -166,6 +167,7 @@ void model_visco(float *** rho, float *** pi, float *** u, ...@@ -166,6 +167,7 @@ void model_visco(float *** rho, float *** pi, float *** u,
} }
} }
} }
} }
/* each PE writes his model to disk */ /* each PE writes his model to disk */
...@@ -219,7 +221,7 @@ void model_visco(float *** rho, float *** pi, float *** u, ...@@ -219,7 +221,7 @@ void model_visco(float *** rho, float *** pi, float *** u,
} }
free_vector(pts,1,L); free_vector(pts,1,L);
if (WRITE_MODELFILES) { if (WRITE_MODELFILES==1) {
free_f3tensor(pwavemod,0,NY+1,0,NX+1,0,NZ+1); free_f3tensor(pwavemod,0,NY+1,0,NX+1,0,NZ+1);
free_f3tensor(swavemod,0,NY+1,0,NX+1,0,NZ+1); free_f3tensor(swavemod,0,NY+1,0,NX+1,0,NZ+1);
if ((L) && (TAU==0.0)){ if ((L) && (TAU==0.0)){
......
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