PLUTO  4.0
 All Data Structures Files Functions Variables Enumerations Macros Pages
Macros | Functions | Variables
shearingbox.h File Reference

Shearing-Box module header file. More...

Go to the source code of this file.

Macros

#define SB_ORDER   2
 
#define SB_SYMMETRIZE_HYDRO   YES
 
#define SB_SYMMETRIZE_EY   (YES && (DIMENSIONS == 3))
 
#define SB_SYMMETRIZE_EZ   YES
 
#define SB_FORCE_EMF_PERIODS   NO
 
#define sb_A   (-0.5*sb_Omega*sb_q)
 

Functions

void SB_Boundary (const Data *, int, Grid *)
 
void SB_ShearingInterp (double *, double *, double, int, Grid *)
 
void SB_CorrectFluxes (Data_Arr, double, double, Grid *)
 
int SB_JSHIFT (int)
 
void SB_SaveFluxes (State_1D *, Grid *)
 
void SB_SetBoundaryVar (double ***, RBox *, int, double, Grid *)
 
void SB_FillBoundaryGhost (double ***, RBox *, int, int, Grid *)
 

Variables

double sb_q
 
double sb_Omega
 
double sb_vy
 

Detailed Description

The Shearing-Box module header file contains basic macro definitions, function prototypes and declaration of global variables used by the sheraring-box module. The variable sb_q and sb_Omega are the most important ones and must be defined and initialized in your init.c in order to configure your shearing-box problem.

Optionally, the order of interpolation (default is 2) at physical boundaries may be changed using the SB_ORDER macro.

The additional macros SB_SYMMETRIZE_HYDRO, SB_SYMMETRIZE_EY and SB_SYMMETRIZE_EZ may be set to YES/NO to enable/disable enforcement of conservation at the radial (x) boundaries.

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.cian.nosp@m.isi@c.nosp@m.inec.nosp@m.a.it)
Date
Aug 16, 2012
Todo:
Check if sb_vy and sb_Ly are really needed as global variables.

Macro Definition Documentation

#define sb_A   (-0.5*sb_Omega*sb_q)

Short-hand definition for the Oort constant $ A = -q\Omega_0/2 $.

#define SB_FORCE_EMF_PERIODS   NO

Force periodicity at y- and z- boundaries.

#define SB_ORDER   2

Sets the order of interpolation at physical boundaries (1, 2 or 3).

#define SB_SYMMETRIZE_EY   (YES && (DIMENSIONS == 3))

Symmetrize the y-component of the electric field at the left and right x-boundaries to enforce conservation of magnetic field (only in 3D).

#define SB_SYMMETRIZE_EZ   YES

Symmetrize the z-component of electric field at the left and right x-boundaries to enforce conservation of magnetic field.

#define SB_SYMMETRIZE_HYDRO   YES

Symmetrize the hydrodynamical fluxes at the left and right x-boundaries in order to enforce conservation of hydrodynamic variables like density, momentum and energy (no magnetic field). Default is YES.

Function Documentation

void SB_Boundary ( const Data d,
int  side,
Grid grid 
)

Main wrapper function used to assign shearing-box boundary conditions on flow variables.

Parameters
dpointer to the PLUTO Data structure
sidethe side of the computational domain (X1_BEG or X1_END)
gridpointer to an array of Grid structures
Returns
This function has no return value.
Todo:
Check if sb_Ly and sb_vy need to be global.
void SB_CorrectFluxes ( Data_Arr  U,
double  t,
double  dt,
Grid grid 
)

Interpolate x-fluxes FLuxL and FluxR and properly correct leftmost and rightmost cells to ensure conservation.

Parameters
[in,out]Udata array containing cell-centered quantities
[in]tthe time step at which fluxes have to be computed
[in]dtthe time step being used in the integrator stage
[in]gridpointer to array of Grid structures
Note
In parallel and if there's more than one processor in the x direction, we modify the values of FluxL and FluxR independently since the two boundary sides are handled by different processors. Conversely, when a processor owns both sides, we need to copy at least one of the two arrays before doing interpolation since their original values are lost when setting boundary conditions.
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_SaveFluxes ( State_1D state,
Grid grid 
)

Store leftmost and rightmost conservative fluxes in the x direction into FluxL and FluxR.

Parameters
[in]statepointer to a State_1D structure
[in]gridpointer to an array of Grid structures
Returns
This function has no return value.
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.

Variable Documentation

double sb_Omega

Disk local orbital frequency $ \Omega_0 = \Omega(R_0)$. The explicit numerical value and the variable definition should be set inside your Init() function.

double sb_q

The shear parameter, $\DS q = -\HALF\frac{d\log \Omega^2}{d\log R} $. The explicit numerical value and the variable definition should be set inside your Init() function.

double sb_vy

velocity offset (>0), in USERDEF_BOUNDARY