PLUTO  4.4-patch2
Functions
boundary.c File Reference

Set boundary conditions. More...

#include "pluto.h"

Functions

static void FlipSign (int, int, int *)
 
void Boundary (const Data *d, int idim, Grid *grid)
 
void OutflowBoundary (double ***q, RBox *box, int side)
 
void PeriodicBoundary (double ***q, RBox *box, int side)
 
void ReflectiveBoundary (double ***q, int s, int stag, RBox *box, int side)
 
void PolarAxisBoundary (const Data *d, RBox *box, int side)
 

Detailed Description

The Boundary() function sets both internal and physical boundary conditions on one or more sides of the computational domain. It is used to fill ghost zones of both cell-centered and face-centered data arrays.
The type of boundary conditions at the leftmost or rightmost side of a given grid is specified by the integers grid.lbound[dir] or grid.rbound[dir] , respectively. When this value is different from zero, the local processor borders the physical boundary and the admissible values for lbound or rbound are OUTFLOW, REFLECTIVE, AXISYMMETRIC, EQTSYMMETRIC, PERIODIC, SHEARING or USERDEF. Conversely, when this value is zero (internal boundary), two neighboring processors that share the same side need to fill ghost zones by exchanging data values. This step is done here only for parallel computations on static grids.

Predefined physical boundary conditions are handled by the following functions:

Note
For staggered mesh+periodic b.c, the leftmost value of each processor is overwritten with a value NX1 zones to the right:
-->Before:

   proc #0     proc #1     proc #2     proc #3
  |.......|   |.......|   |.......|   |.......|
  A       B   C       D   E       F   G       H

--> PeriodicBoundary()
--> After:

   proc #0     proc #1     proc #2     proc #3
  |.......|   |.......|   |.......|   |.......|
  H       B   B       D   D       F   F       H
Author
A. Mignone (migno.nosp@m.ne@t.nosp@m.o.inf.nosp@m.n.it)
Date
Sep 17, 2020

Function Documentation

◆ Boundary()

void Boundary ( const Data d,
int  idim,
Grid grid 
)

Set boundary conditions on one or more sides of the computational domain.

Parameters
[in,out]dpointer to PLUTO Data structure containing the solution array (including centered and staggered fields)
[in]idimspecifies on which side(s) of the computational domain boundary conditions must be set. Possible values are
  • idim = IDIR first dimension (x1)
  • idim = JDIR second dimenson (x2)
  • idim = KDIR third dimension (x3)
  • idim = ALL_DIR all dimensions
[in]gridpointer to grid structure.

◆ FlipSign()

void FlipSign ( int  side,
int  type,
int *  vsign 
)
static

Reverse the sign of vector components with respect to axis side. Depending on type, one needs to symmetrize or anti-symmetrize:

  • REFLECTIVE:
    o Vn -> -Vn, Bn -> -Bn, En -> En
    o Vp -> Vp, Bp -> Bp, Ep -> -Ep
    o Vt -> Vt, Bt -> Bt, Et -> -Et
  • AXISYMMETRIC:
    o Vn -> -Vn, Bn -> -Bn, En -> -En
    o Vp -> Vp, Bp -> Bp, Ep -> Ep
    o Vt -> -Vt, Bt -> -Bt, Et -> -Et
  • EQTSYMMETRIC:
    o Vn -> -Vn, Bn -> Bn, En -> -En
    o Vp -> Vp, Bp -> -Bp, Ep -> Ep
    o Vt -> Vt, Bt -> -Bt, Et -> Et

where (n) is the normal components, (p) and (t) are the transverse (or poloidal and toroidal for cylindrical and spherical coordinates) components.

If the radiation module is used, the transformation law for the radiation flux is the same as for the velocities.

Parameters
[in]sideboundary side
[in]typeboundary condition type
[out]vsignan array of values (+1 or -1) giving the sign

◆ OutflowBoundary()

void OutflowBoundary ( double ***  q,
RBox box,
int  side 
)

Impose zero-gradient boundary conditions on 'q' on the boundary side specified by 'side'. The input array 'q' must not represent the normal component of a staggered magnetic fied.

Parameters
[in,out]qa 3D array requiring ghost zone filling
[in]boxpointer to a RBox structure defining the extent of the boundary region
[in]sidethe side of the computational domain.

◆ PeriodicBoundary()

void PeriodicBoundary ( double ***  q,
RBox box,
int  side 
)

Implements periodic boundary conditions in serial mode or when one processor only handle the periodic direction.

Parameters
[in,out]qa 3D array requiring ghost zone filling
[in]boxpointer to a RBox structure defining the extent of the boundary region
[in]sidethe side of the computational domain.

◆ PolarAxisBoundary()

void PolarAxisBoundary ( const Data d,
RBox box,
int  side 
)

Boundary conditions on singular axis.

◆ ReflectiveBoundary()

void ReflectiveBoundary ( double ***  q,
int  s,
int  stag,
RBox box,
int  side 
)

Make symmetric (s = 1) or anti-symmetric (s = -1) profiles with respect to the boundary plane specified by box->side. The sign is set by the FlipSign() function.

Parameters
[in,out]qa 3D array requiring ghost zone filling
[in]san integer taking only the values +1 (symmetric profile) or -1 (antisymmetric profile)
[in]stagan integer taking the values 0 (centered with respect to the boundary) or 1 (staggered with respect to the boundary).
[in]boxpointer to a RBox structure defining the extent of the boundary region
[in]sidethe side of the computational domain.