Commit a65059e3 authored by Tilman Steinweg's avatar Tilman Steinweg

Switched coordinatesystem for model in/output

Switched coord. system for the model input and output to be similar to
Sofi3D. Unlike in the code where z is the fast dimension, the in/output
uses y (depth) as fast and z as slow dimension.
That means by using for example ximage(2D) to visualisze the model you will see NZ x-y planes.
parent 43f4d06d
...@@ -42,7 +42,7 @@ void mergemod(char modfile[STRING_SIZE], int format){ ...@@ -42,7 +42,7 @@ void mergemod(char modfile[STRING_SIZE], int format){
if ((NPROCX>NPROCX_MAX)||(NPROCY>NPROCY_MAX)||(NPROCZ>NPROCZ_MAX)) if ((NPROCX>NPROCX_MAX)||(NPROCY>NPROCY_MAX)||(NPROCZ>NPROCZ_MAX))
err(" merge.c: constant expression NPROC?_MAX < NPROC? "); err(" mergemod.c: constant expression NPROC?_MAX < NPROC? ");
if (VERBOSE) printf(" PE %d starts merge of %d model files \n",MYID,NPROC); if (VERBOSE) printf(" PE %d starts merge of %d model files \n",MYID,NPROC);
...@@ -56,7 +56,7 @@ void mergemod(char modfile[STRING_SIZE], int format){ ...@@ -56,7 +56,7 @@ void mergemod(char modfile[STRING_SIZE], int format){
for (jp=0;jp<=NPROCY-1; jp++){ for (jp=0;jp<=NPROCY-1; jp++){
sprintf(file,"%s.%i.%i.%i",modfile,ip,jp,kp); sprintf(file,"%s.%i.%i.%i",modfile,ip,jp,kp);
fp[jp][ip][kp]=fopen(file,"r"); fp[jp][ip][kp]=fopen(file,"r");
if (fp[jp][ip][kp]==NULL) err("merge: can't read modfile !"); if (fp[jp][ip][kp]==NULL) err("mergemod.c: can't read modfile !");
} }
//fprintf(FP," ... finished. \n"); //fprintf(FP," ... finished. \n");
...@@ -65,12 +65,13 @@ void mergemod(char modfile[STRING_SIZE], int format){ ...@@ -65,12 +65,13 @@ void mergemod(char modfile[STRING_SIZE], int format){
fprintf(FP," Copying..."); fprintf(FP," Copying...");
for (jp=0;jp<=NPROCY-1; jp++)
for (j=1;j<=NY;j+=IDY)
for (ip=0;ip<=NPROCX-1; ip++)
for (i=1;i<=NX;i+=IDX)
for (kp=0;kp<=NPROCZ-1; kp++) for (kp=0;kp<=NPROCZ-1; kp++)
for (k=1;k<=NZ;k+=IDZ){ for (k=1;k<=NZ;k+=IDZ)
for (ip=0;ip<=NPROCX-1; ip++)
for (i=1;i<=NX;i+=IDX)
for (jp=0;jp<=NPROCY-1; jp++)
for (j=1;j<=NY;j+=IDY){
a=readdsk(fp[jp][ip][kp],format); a=readdsk(fp[jp][ip][kp],format);
writedsk(fpout,a,format); writedsk(fpout,a,format);
} }
......
...@@ -49,11 +49,10 @@ void outgrad(int nx,int ny,int nz,float ***grad1, float ***grad2,float ***grad3, ...@@ -49,11 +49,10 @@ void outgrad(int nx,int ny,int nz,float ***grad1, float ***grad2,float ***grad3,
fpmod2=fopen(gradfile2,"w"); fpmod2=fopen(gradfile2,"w");
fpmod3=fopen(gradfile3,"w"); fpmod3=fopen(gradfile3,"w");
for (j=1;j<=ny;j++){ for (k=1;k<=nz;k++){
for (i=1;i<=nx;i++){ for (i=1;i<=nx;i++){
for (k=1;k<=nz;k++){ for (j=1;j<=ny;j++){
fwrite(&grad1[j][i][k], sizeof(float), 1,fpmod1); fwrite(&grad1[j][i][k], sizeof(float), 1,fpmod1);
fwrite(&grad2[j][i][k], sizeof(float), 1,fpmod2); fwrite(&grad2[j][i][k], sizeof(float), 1,fpmod2);
fwrite(&grad3[j][i][k], sizeof(float), 1,fpmod3); fwrite(&grad3[j][i][k], sizeof(float), 1,fpmod3);
......
...@@ -46,9 +46,10 @@ void outmod(int nx,int ny,int nz,float ***rho, float ***pi,float ***u, int itera ...@@ -46,9 +46,10 @@ void outmod(int nx,int ny,int nz,float ***rho, float ***pi,float ***u, int itera
fpmod2=fopen(modfile2,"w"); fpmod2=fopen(modfile2,"w");
fpmod3=fopen(modfile3,"w"); fpmod3=fopen(modfile3,"w");
for (j=1;j<=ny;j++){
for (i=1;i<=nx;i++){ for (k=1;k<=nz;k++){
for (k=1;k<=nz;k++){ for (i=1;i<=nx;i++){
for (j=1;j<=ny;j++){
vp=sqrt(pi[j][i][k]/rho[j][i][k]); vp=sqrt(pi[j][i][k]/rho[j][i][k]);
vs=sqrt(u[j][i][k]/rho[j][i][k]); vs=sqrt(u[j][i][k]/rho[j][i][k]);
......
...@@ -60,9 +60,10 @@ void readhess(int nx, int ny, int nz, float *** hess1, float *** hess2, float ...@@ -60,9 +60,10 @@ void readhess(int nx, int ny, int nz, float *** hess1, float *** hess2, float
/* loop over global grid */ /* loop over global grid */
for (j=1;j<=NYG;j++){ for (k=1;k<=NZG;k++){
for (i=1;i<=NXG;i++){ for (i=1;i<=NXG;i++){
for (k=1;k<=NZG;k++){ for (j=1;j<=NYG;j++){
vp=readdsk(fp_vp, format); vp=readdsk(fp_vp, format);
vs=readdsk(fp_vs, format); vs=readdsk(fp_vs, format);
rhov=readdsk(fp_rho , format); rhov=readdsk(fp_rho , format);
......
...@@ -96,9 +96,10 @@ float *** taus, float *** taup, float * eta){ ...@@ -96,9 +96,10 @@ float *** taus, float *** taup, float * eta){
*/ */
/* loop over global grid */ /* loop over global grid */
for (j=1;j<=NYG;j++){ for (k=1;k<=NZG;k++){
for (i=1;i<=NXG;i++){ for (i=1;i<=NXG;i++){
for (k=1;k<=NZG;k++){ for (j=1;j<=NYG;j++){
vp=readdsk(fp_vp, format); vp=readdsk(fp_vp, format);
vs=readdsk(fp_vs, format); vs=readdsk(fp_vs, format);
rhov=readdsk(fp_rho , format); rhov=readdsk(fp_rho , format);
......
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