55 int is, nv, fargo_velocity_has_changed;
57 int type[6], sbeg, send, vsign[
NVAR];
58 int par_dim[3] = {0, 0, 0};
77 fargo_velocity_has_changed =
NO;
80 fargo_velocity_has_changed =
YES;
88 #if INTERNAL_BOUNDARY == YES
97 MPI_Barrier (MPI_COMM_WORLD);
98 for (nv = 0; nv <
NVAR; nv++) {
107 MPI_Barrier (MPI_COMM_WORLD);
133 for (is = sbeg; is <= send; is++){
135 if (type[is] == 0)
continue;
143 for (nv = 0; nv <
NVAR; nv++){
167 FlipSign (side[is], type[is], vsign);
168 for (nv = 0; nv <
NVAR; nv++){
184 if (!par_dim[is/2]) {
185 for (nv = 0; nv <
NVAR; nv++){
208 print1 (
"! BOUNDARY: shearingbox can only be assigned at an X1 boundary\n");
211 if (grid[
IDIR].nproc == 1){
212 for (nv = 0; nv <
NVAR; nv++) {
233 }
else if (type[is] ==
USERDEF) {
279 if (fargo_velocity_has_changed){
321 #if GEOMETRY == CARTESIAN
322 q[
k][
j][
i] = 2.0*q[
k][
j][i+1] - q[
k][
j][i+2];
324 dB = (A[i+2]*q[
k][
j][i+2] - A[i+1]*q[
k][
j][i+1])/dV[i+2];
325 q[
k][
j][
i] = (q[
k][
j][i+1]*A[i+1] - dV[i+1]*
dB)/A[i];
330 }
else if (side ==
X1_END){
336 #if GEOMETRY == CARTESIAN
337 q[
k][
j][
i] = 2.0*q[
k][
j][i-1] - q[
k][
j][i-2];
339 dB = (A[i-1]*q[
k][
j][i-1] - A[i-2]*q[
k][
j][i-2])/dV[i-1];
340 q[
k][
j][
i] = (q[
k][
j][i-1]*A[i-1] + dV[
i]*
dB)/A[i];
345 }
else if (side ==
X2_BEG){
351 #if GEOMETRY == CARTESIAN
352 q[
k][
j][
i] = 2.0*q[
k][j+1][
i] - q[
k][j+2][
i];
354 dB = (A[j+2]*q[
k][j+2][
i] - A[j+1]*q[
k][j+1][
i])/dV[j+2];
355 q[
k][
j][
i] = (q[
k][j+1][
i]*A[j+1] - dV[j+1]*
dB)/A[j];
360 }
else if (side ==
X2_END){
366 #if GEOMETRY == CARTESIAN
367 q[
k][
j][
i] = 2.0*q[
k][j-1][
i] - q[
k][j-2][
i];
369 dB = (A[j-1]*q[
k][j-1][
i] - A[j-2]*q[
k][j-2][
i])/dV[j-1];
370 q[
k][
j][
i] = (q[
k][j-1][
i]*A[j-1] + dV[
j]*
dB)/A[j];
375 }
else if (side ==
X3_BEG){
381 #if GEOMETRY == CARTESIAN
382 q[
k][
j][
i] = 2.0*q[k+1][
j][
i] - q[k+2][
j][
i];
384 dB = (A[k+2]*q[k+2][
j][
i] - A[k+1]*q[k+1][
j][
i])/dV[k+2];
385 q[
k][
j][
i] = (q[k+1][
j][
i]*A[k+1] - dV[k+1]*
dB)/A[k];
390 }
else if (side ==
X3_END){
396 #if GEOMETRY == CARTESIAN
397 q[
k][
j][
i] = 2.0*q[k-1][
j][
i] - q[k-2][
j][
i];
399 dB = (A[k-1]*q[k-1][
j][
i] - A[k-2]*q[k-2][
j][
i])/dV[k-1];
400 q[
k][
j][
i] = (q[k-1][
j][
i]*A[k-1] + dV[
k]*
dB)/A[k];
441 #if PHYSICS == ADVECTION
442 for (nv = 0; nv <
NVAR; nv++) vsign[nv] = 1.0;
453 #if PHYSICS == MHD || PHYSICS == RMHD
458 #if PHYSICS == MHD || PHYSICS == RMHD
463 #if PHYSICS == MHD || PHYSICS == RMHD
472 for (nv = 0; nv <
NVAR; nv++) vsign[nv] = 1.0;
475 #if PHYSICS == MHD || PHYSICS == RMHD
482 #if PHYSICS == MHD || PHYSICS == RMHD
488 #if PHYSICS == MHD || PHYSICS == RMHD
490 EXPAND(vsign[Bn] = 1.0; ,
525 }
else if (side ==
X1_END){
533 }
else if (side ==
X2_BEG){
541 }
else if (side ==
X2_END){
548 }
else if (side ==
X3_BEG){
556 }
else if (side ==
X3_END){
581 }
else if (side ==
X1_END){
585 }
else if (side ==
X2_BEG){
589 }
else if (side ==
X2_END){
593 }
else if (side ==
X3_BEG){
597 }
else if (side ==
X3_END){
#define X3_BEG
Boundary region at X3 beg.
void Boundary(const Data *d, int idim, Grid *grid)
int AL_Exchange_dim(char *buf, int *dims, int sz_ptr)
#define X1_BEG
Boundary region at X1 beg.
int lbound
When different from zero, it specifies the boundary condition to be applied at leftmost grid side whe...
double **** Vs
The main four-index data array used for face-centered staggered magnetic fields.
void OutflowBound(double ***q, int side, int vpos, Grid *grid)
long int NX1
Number of interior zones in the X1 directions (boundaries excluded) for the local processor...
void FillMagneticField(const Data *d, int side, Grid *grid)
Assign the normal component of the staggered magnetic field in the ghost zone-faces.
void print1(const char *fmt,...)
int vpos
Location of the variable inside the cell.
void SB_Boundary(const Data *d, int side, Grid *grid)
#define BOX_LOOP(B, k, j, i)
int rbound
Same as lbound, but for the right edge of the grid.
double **** Vc
The main four-index data array used for cell-centered primitive variables.
void FlipSign(int side, int type, int *vsign)
void PeriodicBound(double ***q, int side, int vpos)
#define X3_END_LOOP(k, j, i)
#define X1_END
Boundary region at X1 end.
void FARGO_AddVelocity(const Data *, Grid *)
#define X2_BEG_LOOP(k, j, i)
int FARGO_HasTotalVelocity()
void ComputeEntropy(const Data *, Grid *)
void FARGO_SubtractVelocity(const Data *, Grid *)
#define X2_END_LOOP(k, j, i)
long int NX2
Number of interior zones in the X2 directions (boundaries excluded) for the local processor...
#define X2_END
Boundary region at X2 end.
long int IEND
Upper grid index of the computational domain in the the X1 direction for the local processor...
void CT_AverageNormalMagField(const Data *d, int side, Grid *grid)
Compute the normal component of the volume-average magnetic field from the staggered components in th...
#define X1_END_LOOP(k, j, i)
void CT_AverageTransverseMagField(const Data *d, int side, Grid *grid)
Compute the transverse component of the volume-average magnetic field from the staggered components i...
#define X3_END
Boundary region at X3 end.
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;)
#define X1_BEG_LOOP(k, j, i)
void ReflectiveBound(double ***q, int s, int side, int vpos)
long int KBEG
Lower grid index of the computational domain in the the X3 direction for the local processor...
#define X2_BEG
Boundary region at X2 beg.
long int KEND
Upper grid index of the computational domain in the the X3 direction for the local processor...
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
#define QUIT_PLUTO(e_code)
void UserDefBoundary(const Data *, RBox *, int, Grid *)
long int JEND
Upper grid index of the computational domain in the the X2 direction for the local processor...
#define X3_BEG_LOOP(k, j, i)
int nproc
number of processors for this grid.
long int NX3
Number of interior zones in the X3 directions (boundaries excluded) for the local processor...
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
double * A
Right interface area, A[i] = .