PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
Functions
sb_tools.c File Reference

Miscellaneous functions for implementing the shearing-box boundary condition. More...

#include "pluto.h"

Functions

void SB_SetBoundaryVar (double ***U, RBox *box, int side, double t, Grid *grid)
 
void SB_FillBoundaryGhost (double ***U, RBox *box, int nghL, int nghR, Grid *grid)
 
void SB_ShearingInterp (double *qL, double *qR, double t, int side, Grid *grid)
 
int SB_JSHIFT (int jc)
 

Detailed Description

The shearing-box tool file contains various functions for the implementation of the shearingbox boundary conditions in serial or parallel mode. The SB_SetBoundaryVar() function applies shearing-box boundary conditions to a 3D array U at an X1_BEG or X1_END boundary. The array U is defined on the RBox *box with grid indices box->ib <= i <= box->ie, box->kb <= k <= box->ke, and assumes that periodic boundary conditions have already been set. Indices in the y-directions are not necessary, since the entire y-range is assumed.

In parallel mode, we use the SB_ShiftBoundaryVar() function to perform the integer shift of cells across the processors, while interpolation function SB_ShearingInterp() handles the fractional part only. In serial or when there's only 1 processor along y, the interpolation function does all the job (integer+fractional).

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
G. Muscianisi (g.mus.nosp@m.ican.nosp@m.isi@c.nosp@m.inec.nosp@m.a.it)
Date
Aug 16, 2012

Function Documentation

void SB_FillBoundaryGhost ( double ***  U,
RBox box,
int  nghL,
int  nghR,
Grid grid 
)

Fill ghost zones in the Y direction in the X1_BEG and X1_END boundary regions.

Parameters
[in,out]Ua 3D data array
[in,out]boxthe RBox structure containing the grid indices in the x and z directions. Indices in the y-directions are reset here for convenience.
[in]nghLnumber of ghost zones on the left
[in]nghRnumber of ghost zones on the right
[in]gridpointer to an
Note
nghL and nghR can be different for staggered fields like BY.
Returns
This function has no return value.
int SB_JSHIFT ( int  jc)

Make sure jc always fall between JBEG and JEND

void SB_SetBoundaryVar ( double ***  U,
RBox box,
int  side,
double  t,
Grid grid 
)

Fill ghost zones using shearing-box conditions.

Parameters
[out]Upointer to a 3D array (centered or staggered)
[in]boxpointer to RBox structure defining the domain sub-portion over which shearing-box conditions have to be applied
[in]sidethe side of the X1 boundary (X1_BEG or X1_END)
[in]tthe simulation time
[in]gridpointer to an array of Grid structures
Returns
This function has no return value.
void SB_ShearingInterp ( double *  qL,
double *  qR,
double  t,
int  side,
Grid grid 
)

Shift the 1D arrays qL or qR by an amount $ wt = \Delta y\Delta J + \epsilon $ (if there's only one processor in y) or just by $ \epsilon $ (otherwise) by advecting the initial profile of qR (when side == X1_BEG) or qL (when side == X1_END).

Parameters
[in,out]qL1D array containing the un-shifted values on the left boundary
[in,out]qR1D array containing the un-shifted values on the right boundary
[in]tsimulation time
[in]sideboundary side
[in]gridpointer to an array of Grid structures
Returns
This function has no return value.