File difops.cxx

Functions

const Field2D Grad_par(const Field2D &var, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")

Parallel derivative (central differencing) in Y along unperturbed field

Parameters
  • var: The field to be differentiated
  • outloc: The cell location where the output is needed (if staggered grids is enabled)
  • method: The method to use. The default is set in the options.

const Field2D Grad_par(const Field2D &var, const std::string &method, CELL_LOC outloc)
const Field3D Grad_par(const Field3D &var, CELL_LOC outloc, const std::string &method)
const Field3D Grad_par(const Field3D &var, const std::string &method, CELL_LOC outloc)
const Field3D Grad_parP(const Field3D &apar, const Field3D &f)

Derivative along perturbed magnetic field in Clebsch coordinate system

b0 dot Grad - (1/B)b0 x Grad(apar) dot Grad

Combines the parallel and perpendicular calculation to include grid-points at the corners.

const Field2D Vpar_Grad_par(const Field2D &v, const Field2D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")

vpar times parallel derivative along unperturbed B-field (upwinding)

\[ v\mathbf{b}_0 \cdot \nabla f \]

Parameters
  • v: The velocity in y direction
  • f: The scalar field to be differentiated
  • outloc: The cell location of the output. By default this is the same as f
  • method: The numerical method to use. The default is set in the options

const Field2D Vpar_Grad_par(const Field2D &v, const Field2D &f, const std::string &method, CELL_LOC outloc)
const Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, CELL_LOC outloc, const std::string &method)
const Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, const std::string &method, CELL_LOC outloc)
const Field2D Div_par(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")

parallel divergence operator

\[ B \partial_{||}(f/B) = B \nabla\cdot (\mathbf{b}f/B ) \]

Parameters
  • f: The component of a vector along the magnetic field
  • outloc: The cell location for the result. By default the same as f
  • method: The numerical method to use

const Field2D Div_par(const Field2D &f, const std::string &method, CELL_LOC outloc)
const Field3D Div_par(const Field3D &f, CELL_LOC outloc, const std::string &method)
const Field3D Div_par(const Field3D &f, const std::string &method, CELL_LOC outloc)
const Field3D Div_par(const Field3D &f, const Field3D &v)
const Field3D Div_par_flux(const Field3D &v, const Field3D &f, CELL_LOC outloc, const std::string &method)
const Field3D Div_par_flux(const Field3D &v, const Field3D &f, const std::string &method, CELL_LOC outloc)
const Field2D Grad2_par2(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")

second parallel derivative

\[ (\mathbf{b} dot \nabla)(\mathbf{b} dot \nabla) \]

Note: For parallel Laplacian use LaplacePar

Parameters
  • f: The field to be differentiated
  • outloc: The cell location of the result

const Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc, const std::string &method)
const Field2D Div_par_K_Grad_par(BoutReal kY, const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)

Parallel divergence of diffusive flux, K*Grad_par

\[ \nabla \cdot ( \mathbf{b}_0 kY (\mathbf{b}_0 \cdot \nabla) f ) \]

Parameters
  • kY: The diffusion coefficient
  • f: The field whose gradient drives a flux

const Field3D Div_par_K_Grad_par(BoutReal kY, const Field3D &f, CELL_LOC outloc)
const Field2D Div_par_K_Grad_par(const Field2D &kY, const Field2D &f, CELL_LOC outloc)
const Field3D Div_par_K_Grad_par(const Field2D &kY, const Field3D &f, CELL_LOC outloc)
const Field3D Div_par_K_Grad_par(const Field3D &kY, const Field2D &f, CELL_LOC outloc)
const Field3D Div_par_K_Grad_par(const Field3D &kY, const Field3D &f, CELL_LOC outloc)
const Field2D Delp2(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT, bool useFFT = true)

Perpendicular Laplacian operator

This version only includes terms in X and Z, dropping derivatives in Y. This is the inverse operation to the Laplacian inversion class.

For the full perpendicular Laplacian, use Laplace_perp

const Field3D Delp2(const Field3D &f, CELL_LOC outloc, bool useFFT)
const FieldPerp Delp2(const FieldPerp &f, CELL_LOC outloc, bool useFFT)
const Field2D Laplace_perp(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)

Perpendicular Laplacian, keeping y derivatives

const Field3D Laplace_perp(const Field3D &f, CELL_LOC outloc)
const Field2D Laplace_par(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)

Parallel Laplacian operator

const Field3D Laplace_par(const Field3D &f, CELL_LOC outloc)
const Field2D Laplace(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)

Full Laplacian operator (par + perp)

const Field3D Laplace(const Field3D &f, CELL_LOC outloc)
const Field2D b0xGrad_dot_Grad(const Field2D &phi, const Field2D &A, CELL_LOC outloc = CELL_DEFAULT)

Terms of form b0 x Grad(phi) dot Grad(A)

const Field3D b0xGrad_dot_Grad(const Field2D &phi, const Field3D &A, CELL_LOC outloc)
const Field3D b0xGrad_dot_Grad(const Field3D &phi, const Field2D &A, CELL_LOC outloc = CELL_DEFAULT)

Terms of form

\[ \mathbf{b}_0 \times \nabla \phi \cdot \nabla A \]

Parameters
  • phi: The scalar potential
  • A: The field being advected
  • outloc: The cell location where the result is defined. By default the same as A.

const Field3D b0xGrad_dot_Grad(const Field3D &phi, const Field3D &A, CELL_LOC outloc)
const Field2D bracket(const Field2D &f, const Field2D &g, BRACKET_METHOD method = BRACKET_STD, CELL_LOC outloc = CELL_DEFAULT, Solver *solver = nullptr)

Compute advection operator terms, which can be cast as antisymmetric Poisson brackets

\[ [f, g] = (1/B) \mathbf{b}_0 \times \nabla f \cdot \nabla g \]

Parameters
  • f: The potential
  • g: The field being advected
  • method: The method to use
  • outloc: The cell location where the result is defined. Default is the same as g
  • solver: Pointer to the time integration solver

const Field3D bracket(const Field3D &f, const Field2D &g, BRACKET_METHOD method, CELL_LOC outloc, Solver *solver)
const Field3D bracket(const Field2D &f, const Field3D &g, BRACKET_METHOD method, CELL_LOC outloc, Solver *solver)
const Field3D bracket(const Field3D &f, const Field3D &g, BRACKET_METHOD method, CELL_LOC outloc, Solver *solver)