PLUTO  4.2
 All Data Structures Files Functions Variables Enumerations Macros Pages
Functions
boundary.c File Reference

Set boundary conditions. More...

#include "pluto.h"

Functions

void Boundary (const Data *d, int idim, Grid *grid)
 
void OutflowBound (double ***q, int side, int vpos, Grid *grid)
 
void FlipSign (int side, int type, int *vsign)
 
void ReflectiveBound (double ***q, int s, int side, int vpos)
 
void PeriodicBound (double ***q, int side, int vpos)
 

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[dir].lbound or grid[dir].rbound , 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:

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
Dec 18, 2014

Function Documentation

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 an array of grid structures.
void FlipSign ( int  side,
int  type,
int *  vsign 
)

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
    o Vp -> Vp, Bp -> Bp
    o Vt -> Vt, Bt -> Bt
  • AXISYMMETRIC:
    o Vn -> -Vn, Bn -> -Bn
    o Vp -> Vp, Bp -> Bp
    o Vt -> -Vt, Bt -> -Bt
  • EQTSYMMETRIC:
    o Vn -> -Vn, Bn -> Bn
    o Vp -> Vp, Bp -> -Bp
    o Vt -> Vt, Bt -> -Bt

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

Parameters
[in]sideboundary side
[in]typeboundary condition type
[out]vsignan array of values (+1 or -1) giving the sign
void OutflowBound ( double ***  q,
int  side,
int  vpos,
Grid grid 
)

Impose zero-gradient boundary conditions on 'q' on the boundary side specified by box->side. The staggered component of magnetic field is assigned using the div.B = 0 condition in a different loop.

Parameters
[in,out]qa 3D array representing a flow variable
[in]boxpointer to a RBox structure defining the extent of the boundary region and the variable position inside the cell
[in]gridpointer to an array of Grid structures
void PeriodicBound ( double ***  q,
int  side,
int  vpos 
)

Implements periodic boundary conditions in serial mode.

void ReflectiveBound ( double ***  q,
int  s,
int  side,
int  vpos 
)

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 flow quantity
[in]boxpointer to box structure
[in]san integer taking only the values +1 (symmetric profile) or -1 (antisymmetric profile)