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

Enforce conservation at the X1 boundaries in the shearing-box module. More...

#include "pluto.h"

Functions

void SB_SaveFluxes (State_1D *state, Grid *grid)
 
void SB_CorrectFluxes (Data_Arr U, double t, double dt, Grid *grid)
 

Variables

static double **** FluxL
 
static double **** FluxR
 

Detailed Description

This file provides a set of functions for storing and then modifying the upwind fluxes computed during the Riemann solver at the leftmost and righmost physical boundaries. These tasks are performed only when either SB_SYMMETRIZE_HYDRO, SB_SYMMETRIZE_EY, SB_SYMMETRIZE_EZ flags are set to YES in Src/MHD/shearingbox.h and are useful to avoid loss of conservation in the hydrodynamical variables (density, momentum, energy) and/or magnetic fields.

This is first achieved by calling the SB_SAVE_FLUXES() function during the time stepping scheme, with the purpose of storing the leftmost and rightmost conservative fluxes in the x-direction into the static arrays FluxL[] and FluxR[].

These fluxes are then subsequently used by SB_CORRECT_FLUXES() which interpolates the fluxes and properly correct leftmost and rightmost cell-centered flow quantities to ensure conservation.

The treatment of staggered magnetic field is done similarly by SB_CORRECT_EMF().

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)
G. Bodo (bodo@.nosp@m.oato.nosp@m..inaf.nosp@m..it)
Date
Aug 16, 2012

Function Documentation

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_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.

Variable Documentation

double**** FluxL
static

Array of fluxes at the left x-boundary.

double**** FluxR
static

Array of fluxes at the right x-boundary.