Commit a32598a2 authored by tilman.metz's avatar tilman.metz

bugfix

copying of material parameters at the global boundaries should be avoided
except when periodic boundaries are used left <-> right exchange should be done
parent c5646bd5
......@@ -27,7 +27,7 @@
void matcopy_elastic(float ** rho, float ** pi, float ** u){
extern int MYID, NX, NY, INDEX[5];
extern int MYID, NX, NY, INDEX[5],POS[3], BOUNDARY, NPROCY, NPROCX;
extern const int TAG1,TAG2,TAG5,TAG6;
extern FILE *FP;
......@@ -40,8 +40,8 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
bufferlef_to_rig = matrix(0,NY+1,1,3);
bufferrig_to_lef = matrix(0,NY+1,1,3);
buffertop_to_bot = matrix(0,NX+1,1,3);
bufferbot_to_top = matrix(0,NX+1,1,3);
buffertop_to_bot = matrix(1,NX,1,3);
bufferbot_to_top = matrix(1,NX,1,3);
fprintf(FP,"\n\n **Message from matcopy_elastic (written by PE %d):",MYID);
......@@ -51,8 +51,8 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
/* if (POS[2]!=0)*/ /* no boundary exchange at top of global grid */
for (i=0;i<=NX+1;i++){
if (POS[2]!=0) /* no boundary exchange at top of global grid */
for (i=1;i<=NX;i++){
/* storage of top of local volume into buffer */
buffertop_to_bot[i][1] = rho[1][i];
buffertop_to_bot[i][2] = pi[1][i];
......@@ -60,8 +60,8 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
}
/* if (POS[2]!=NPROCY-1)*/ /* no boundary exchange at bottom of global grid */
for (i=0;i<=NX+1;i++){
if (POS[2]!=NPROCY-1) /* no boundary exchange at bottom of global grid */
for (i=1;i<=NX;i++){
/* storage of bottom of local volume into buffer */
bufferbot_to_top[i][1] = rho[NY][i];
......@@ -80,15 +80,15 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
MPI_Recv(&bufferbot_to_top[1][1],NX*3,MPI_FLOAT,INDEX[3],TAG6,MPI_COMM_WORLD,&status);
/* if (POS[2]!=NPROCY-1)*/ /* no boundary exchange at bottom of global grid */
for (i=0;i<=NX+1;i++){
if (POS[2]!=NPROCY-1) /* no boundary exchange at bottom of global grid */
for (i=1;i<=NX;i++){
rho[NY+1][i] = buffertop_to_bot[i][1];
pi[NY+1][i] = buffertop_to_bot[i][2];
u[NY+1][i] = buffertop_to_bot[i][3];
}
/* if (POS[2]!=0)*/ /* no boundary exchange at top of global grid */
for (i=0;i<=NX+1;i++){
if (POS[2]!=0) /* no boundary exchange at top of global grid */
for (i=1;i<=NX;i++){
rho[0][i] = bufferbot_to_top[i][1];
pi[0][i] = bufferbot_to_top[i][2];
u[0][i] = bufferbot_to_top[i][3];
......@@ -97,7 +97,7 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
/* if (POS[1]!=0)*/ /* no boundary exchange at left edge of global grid */
if ((POS[1]!=0) || (BOUNDARY!=0)) /* no boundary exchange at left edge of global grid */
for (j=0;j<=NY+1;j++)
{
/* storage of left edge of local volume into buffer */
......@@ -107,7 +107,7 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
}
/* if (POS[1]!=NPROCX-1)*/ /* no boundary exchange at right edge of global grid */
if ((POS[1]!=NPROCX-1) || (BOUNDARY!=0)) /* no boundary exchange at right edge of global grid */
for (j=0;j<=NY+1;j++){
/* storage of right edge of local volume into buffer */
bufferrig_to_lef[j][1] = rho[j][NX];
......@@ -125,14 +125,14 @@ void matcopy_elastic(float ** rho, float ** pi, float ** u){
MPI_Recv(&bufferrig_to_lef[0][1],(NY+2)*3,MPI_FLOAT,INDEX[1],TAG2,MPI_COMM_WORLD,&status);
/* if (POS[1]!=NPROCX-1)*/ /* no boundary exchange at right edge of global grid */
if ((POS[1]!=NPROCX-1) || (BOUNDARY!=0)) /* no boundary exchange at right edge of global grid */
for (j=0;j<=NY+1;j++){
rho[j][NX+1] = bufferlef_to_rig[j][1];
pi[j][NX+1] = bufferlef_to_rig[j][2];
u[j][NX+1] = bufferlef_to_rig[j][3];
}
/* if (POS[1]!=0)*/ /* no boundary exchange at left edge of global grid */
if ((POS[1]!=0) || (BOUNDARY!=0)) /* no boundary exchange at left edge of global grid */
for (j=0;j<=NY+1;j++){
rho[j][0] = bufferrig_to_lef[j][1];
pi[j][0] = bufferrig_to_lef[j][2];
......
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