File div_ops.hxx

Functions

const Field3D Div_par_diffusion_index(const Field3D &f, bool bndry_flux = true)

Diffusion in index space

Similar to using Div_par_diffusion(SQ(mesh->dy)*mesh->g_22, f)

Parameters:
  • The[in] field to be differentiated

  • bndry_flux[in] Are fluxes through the boundary calculated?

const Field3D Div_n_bxGrad_f_B_XPPM(const Field3D &n, const Field3D &f, bool bndry_flux = true, bool poloidal = false, bool positive = false)
const Field3D Div_Perp_Lap_FV_Index(const Field3D &a, const Field3D &f, bool xflux)

*** USED ***

const Field3D Div_Z_FV_Index(const Field3D &a, const Field3D &f)

Z diffusion in index space.

const Field3D D4DX4_FV_Index(const Field3D &f, bool bndry_flux = false)
const Field3D D4DZ4_Index(const Field3D &f)
const Field2D Laplace_FV(const Field2D &k, const Field2D &f)

*** USED *** X-Y diffusion

NOTE: Assumes g^12 = 0, so X and Y are orthogonal. Otherwise we would need the corner cell values to take Y derivatives along X edges

const Field3D Div_a_Grad_perp_upwind(const Field3D &a, const Field3D &f)

Perpendicular diffusion including X and Y directions.

const Field3D Div_a_Grad_perp_upwind_flows(const Field3D &a, const Field3D &f, Field3D &flux_xlow, Field3D &flux_ylow)

Version of function that returns flows.

Div ( a Grad_perp(f) ) — diffusion

Returns the flows in the final arguments

Flows are always in the positive {x,y} direction i.e xlow(i,j) is the flow into cell (i,j) from the left, and the flow out of cell (i-1,j) to the right

ylow(i,j+1) ^ +—|—+ | | xlow(i,j) -> (i,j) -> xlow(i+1,j) | ^ | +—|—+ ylow(i,j)

namespace FV

Functions

template<typename CellEdges = MC>
const Field3D Div_par_fvv(const Field3D &f_in, const Field3D &v_in, const Field3D &wave_speed_in, bool fixflux = true)
template<typename CellEdges = MC>
const Field3D Div_par_mod(const Field3D &f_in, const Field3D &v_in, const Field3D &wave_speed_in, bool fixflux = true)

Finite volume parallel divergence

NOTE: Modified version, applies limiter to velocity and field Performs better (smaller overshoots) than Div_par

Preserves the sum of f*J*dx*dy*dz over the domain

NB: Uses to/from FieldAligned coordinates

Parameters:
  • f_in[in] The field being advected. This will be reconstructed at cell faces using the given CellEdges method

  • v_in[in] The advection velocity. This will be interpolated to cell boundaries using linear interpolation

  • wave_speed_in[in] Local maximum speed of all waves in the system at each

  • fixflux[in] Fix the flux at the boundary to be the value at the midpoint (for boundary conditions)

struct Superbee
#include <div_ops.hxx>

Superbee limiter

This corresponds to the limiter function φ(r) = max(0, min(2r, 1), min(r,2)

The value at cell right (i.e. i + 1/2) is:

n.R = n.c - φ(r) (n.c - (n.p + n.c)/2) = n.c + φ(r) (n.p - n.c)/2

Four regimes: a) r < 1/2 -> φ(r) = 2r n.R = n.c + gL b) 1/2 < r < 1 -> φ(r) = 1 n.R = n.c + gR/2 c) 1 < r < 2 -> φ(r) = r n.R = n.c + gL/2 d) 2 < r -> φ(r) = 2 n.R = n.c + gR

where the left and right gradients are: gL = n.c - n.m gR = n.p - n.c

Public Functions

inline void operator()(Stencil1D &n)