PLUTO
emf_boundary.c File Reference
#include "pluto.h"
Include dependency graph for emf_boundary.c:

Go to the source code of this file.

Functions

void EMF_BOUNDARY (EMF *emf, Grid *grid)
 

Function Documentation

void EMF_BOUNDARY ( EMF emf,
Grid grid 
)

Definition at line 8 of file emf_boundary.c.

52 {
53  int side[6] = {X1_BEG, X1_END, X2_BEG, X2_END, X3_BEG, X3_END};
54  int type[6], is;
55  int par_dim[3] = {0, 0, 0};
56  double ***e1, ***e2, vsign;
57 
58  D_EXPAND(par_dim[0] = grid[IDIR].nproc > 1; ,
59  par_dim[1] = grid[JDIR].nproc > 1; ,
60  par_dim[2] = grid[KDIR].nproc > 1;)
61 
62  #ifdef PARALLEL
63  MPI_Barrier (MPI_COMM_WORLD);
64 
65  AL_Exchange_dim ((char *)emf->ezj[0][0], par_dim, SZ);
66  AL_Exchange_dim ((char *)emf->ezi[0][0], par_dim, SZ);
67  #if DIMENSIONS == 3
68  AL_Exchange_dim ((char *)emf->exj[0][0], par_dim, SZ);
69  AL_Exchange_dim ((char *)emf->exk[0][0], par_dim, SZ);
70  AL_Exchange_dim ((char *)emf->eyi[0][0], par_dim, SZ);
71  AL_Exchange_dim ((char *)emf->eyk[0][0], par_dim, SZ);
72  #endif
73 /*
74  AL_Exchange (emf->ezj[0][0], SZ);
75  AL_Exchange (emf->ezi[0][0], SZ);
76  #if DIMENSIONS == 3
77  AL_Exchange (emf->exj[0][0], SZ);
78  AL_Exchange (emf->exk[0][0], SZ);
79  AL_Exchange (emf->eyi[0][0], SZ);
80  AL_Exchange (emf->eyk[0][0], SZ);
81  #endif
82 */
83  MPI_Barrier (MPI_COMM_WORLD);
84 
85  #endif
86 
87 return;
88 
89 
90  type[0] = grid[IDIR].lbound;
91  type[1] = grid[IDIR].rbound;
92 
93  type[2] = grid[JDIR].lbound;
94  type[3] = grid[JDIR].rbound;
95 
96  type[4] = grid[KDIR].lbound;
97  type[5] = grid[KDIR].rbound;
98 
99 /* --------------------------------------------------------
100  Loop on directions
101  -------------------------------------------------------- */
102 
103  for (is = 0; is < 2*DIMENSIONS; is++){
104 
105  if (type[is] == 0) continue; /* no physical boundary: skip */
106 
107  /* -- set pointers to the emf components
108  that need boundaries -- */
109 
110  if (side[is] == X1_BEG || side[is] == X1_END){
111  D_EXPAND( , e1 = emf->ezj;, e2 = emf->eyk;)
112  } else if (side[is] == X2_BEG || side[is] == X2_END){
113  D_EXPAND( , e1 = emf->ezi;, e2 = emf->exk;)
114  } else if (side[is] == X3_BEG || side[is] == X3_END){
115  D_EXPAND( , e1 = emf->exj;, e2 = emf->eyi;)
116  }
117 
118  if (type[is] == OUTFLOW){
119 /* --> replace in OutflowBound(..)
120  D_EXPAND( ,
121  OUTFLOW_BOUND(e1, grid + (is/2), -1, side[is]); ,
122  OUTFLOW_BOUND(e2, grid + (is/2), -1, side[is]);)
123 */
124  }else if ( (type[is] == REFLECTIVE)
125  || (type[is] == AXISYMMETRIC)
126  || (type[is] == EQTSYMMETRIC) ){
127 
128  vsign = -1.0;
129  if (type[is] == EQTSYMMETRIC) vsign = 1.0;
130 /* -- > replace in ReflectiveBound(...)
131  D_EXPAND( ,
132  REFLECTIVE_BOUND(e1, -1, side[is], vsign); ,
133  REFLECTIVE_BOUND(e2, -1, side[is], vsign);)
134 */
135  }else if (type[is] == USERDEF) {
136 
137  /* -------------------------------------------------
138  for userdef boundaries, ghost EMF must be
139  computed from the time marching algorithm by
140  extending integration in the corresponding
141  (transverse) boundary zones.
142  ------------------------------------------------- */
143 
144  EMF_USERDEF_BOUNDARY (emf, side[is], FACE_EMF, grid);
145 
146  }else if (type[is] == PERIODIC){
147 
148 
149  if (!par_dim[is/2]) {
150 
151 /* -- replace in PeriodicBound
152  D_EXPAND( ,
153  PERIODIC_BOUND(e1, -1, side[is]); ,
154  PERIODIC_BOUND(e2, -1, side[is]);)
155 */
156  }
157 /*
158  #ifndef PARALLEL
159  D_EXPAND( ,
160  PERIODIC_BOUND(e1, side[is]); ,
161  PERIODIC_BOUND(e2, side[is]);)
162  #endif
163 */
164  }
165  }
166 }
#define X3_BEG
Boundary region at X3 beg.
Definition: pluto.h:150
int AL_Exchange_dim(char *buf, int *dims, int sz_ptr)
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
int lbound
When different from zero, it specifies the boundary condition to be applied at leftmost grid side whe...
Definition: structs.h:105
int rbound
Same as lbound, but for the right edge of the grid.
Definition: structs.h:112
#define X1_END
Boundary region at X1 end.
Definition: pluto.h:147
#define KDIR
Definition: pluto.h:195
void EMF_USERDEF_BOUNDARY(EMF *emf, int side, int loc, Grid *grid)
Definition: emf_userdef.c:4
double *** ezi
Ez available at x-faces (i+1/2);.
Definition: ct.h:79
#define IDIR
Definition: pluto.h:193
#define USERDEF
Definition: pluto.h:139
double *** exk
Ex available at z-faces (k+1/2);.
Definition: ct.h:76
#define X2_END
Boundary region at X2 end.
Definition: pluto.h:149
#define X3_END
Boundary region at X3 end.
Definition: pluto.h:151
#define OUTFLOW
Definition: pluto.h:133
double *** eyi
Ey available at x-faces (i+1/2);.
Definition: ct.h:77
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
Definition: analysis.c:27
double *** eyk
Ey available at z-faces (k+1/2);.
Definition: ct.h:78
#define REFLECTIVE
Definition: pluto.h:134
double *** ezj
Ez available at y-faces (j+1/2);.
Definition: ct.h:80
#define FACE_EMF
Definition: ct.h:38
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
#define AXISYMMETRIC
Definition: pluto.h:135
#define PERIODIC
Definition: pluto.h:137
Definition: al_hidden.h:38
#define EQTSYMMETRIC
Definition: pluto.h:136
#define JDIR
Definition: pluto.h:194
double *** exj
Ex available at y-faces (j+1/2);.
Definition: ct.h:75
int nproc
number of processors for this grid.
Definition: structs.h:120
#define DIMENSIONS
Definition: definitions_01.h:2

Here is the call graph for this function: