File difops.cxx#

Functions

Coordinates::FieldMetric Grad_par(const Field2D &var, CELL_LOC outloc, const std::string &method)#

Parallel derivative (central differencing) in Y along unperturbed field

Parameters:
  • var[in] The field to be differentiated

  • outloc[in] The cell location where the output is needed (if staggered grids is enabled)

  • method[in] The method to use. The default is set in the options.

Coordinates::FieldMetric Grad_par(const Field2D &var, const std::string &method, CELL_LOC outloc)#
Field3D Grad_par(const Field3D &var, CELL_LOC outloc, const std::string &method)#
Field3D Grad_par(const Field3D &var, const std::string &method, CELL_LOC outloc)#
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.

Coordinates::FieldMetric Vpar_Grad_par(const Field2D &v, const Field2D &f, CELL_LOC outloc, const std::string &method)#

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

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

Parameters:
  • v[in] The velocity in y direction

  • f[in] The scalar field to be differentiated

  • outloc[in] The cell location of the output. By default this is the same as f

  • method[in] The numerical method to use. The default is set in the options

Coordinates::FieldMetric Vpar_Grad_par(const Field2D &v, const Field2D &f, const std::string &method, CELL_LOC outloc)#
Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, CELL_LOC outloc, const std::string &method)#
Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, const std::string &method, CELL_LOC outloc)#
Coordinates::FieldMetric Div_par(const Field2D &f, CELL_LOC outloc, const std::string &method)#

parallel divergence operator

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

Parameters:
  • f[in] The component of a vector along the magnetic field

  • outloc[in] The cell location for the result. By default the same as f

  • method[in] The numerical method to use

Coordinates::FieldMetric Div_par(const Field2D &f, const std::string &method, CELL_LOC outloc)#
Field3D Div_par(const Field3D &f, CELL_LOC outloc, const std::string &method)#
Field3D Div_par(const Field3D &f, const std::string &method, CELL_LOC outloc)#
Field3D Div_par(const Field3D &f, const Field3D &v)#
Field3D Div_par_flux(const Field3D &v, const Field3D &f, CELL_LOC outloc, const std::string &method)#
Field3D Div_par_flux(const Field3D &v, const Field3D &f, const std::string &method, CELL_LOC outloc)#
Coordinates::FieldMetric Grad2_par2(const Field2D &f, CELL_LOC outloc, const std::string &method)#

second parallel derivative

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

Note: For parallel Laplacian use LaplacePar

Parameters:
  • f[in] The field to be differentiated

  • outloc[in] The cell location of the result

Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc, const std::string &method)#
Coordinates::FieldMetric Div_par_K_Grad_par(BoutReal kY, const Field2D &f, CELL_LOC outloc)#

Parallel divergence of diffusive flux, K*Grad_par

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

Parameters:
  • kY[in] The diffusion coefficient

  • f[in] The field whose gradient drives a flux

Field3D Div_par_K_Grad_par(BoutReal kY, const Field3D &f, CELL_LOC outloc)#
Coordinates::FieldMetric Div_par_K_Grad_par(const Field2D &kY, const Field2D &f, CELL_LOC outloc)#
Field3D Div_par_K_Grad_par(const Field2D &kY, const Field3D &f, CELL_LOC outloc)#
Field3D Div_par_K_Grad_par(const Field3D &kY, const Field2D &f, CELL_LOC outloc)#
Field3D Div_par_K_Grad_par(const Field3D &kY, const Field3D &f, CELL_LOC outloc)#
Coordinates::FieldMetric Delp2(const Field2D &f, CELL_LOC outloc, bool useFFT)#

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

Field3D Delp2(const Field3D &f, CELL_LOC outloc, bool useFFT)#
FieldPerp Delp2(const FieldPerp &f, CELL_LOC outloc, bool useFFT)#
Coordinates::FieldMetric Laplace_perp(const Field2D &f, CELL_LOC outloc, const std::string &dfdy_boundary_condition, const std::string &dfdy_region)#

Perpendicular Laplacian, keeping y derivatives

Field3D Laplace_perp(const Field3D &f, CELL_LOC outloc, const std::string &dfdy_boundary_condition, const std::string &dfdy_region)#
Coordinates::FieldMetric Laplace_par(const Field2D &f, CELL_LOC outloc)#

Parallel Laplacian operator

Field3D Laplace_par(const Field3D &f, CELL_LOC outloc)#
Coordinates::FieldMetric Laplace(const Field2D &f, CELL_LOC outloc, const std::string &dfdy_boundary_condition, const std::string &dfdy_region)#

Full Laplacian operator (par + perp)

Field3D Laplace(const Field3D &f, CELL_LOC outloc, const std::string &dfdy_boundary_condition, const std::string &dfdy_region)#
Field2D Laplace_perpXY(const Field2D &A, const Field2D &f)#

Inverse of Laplacian operator in LaplaceXY solver

Coordinates::FieldMetric b0xGrad_dot_Grad(const Field2D &phi, const Field2D &A, CELL_LOC outloc)#

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

Field3D b0xGrad_dot_Grad(const Field2D &phi, const Field3D &A, CELL_LOC outloc)#
Field3D b0xGrad_dot_Grad(const Field3D &p, const Field2D &A, CELL_LOC outloc)#

Terms of form

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

Parameters:
  • phi[in] The scalar potential

  • A[in] The field being advected

  • outloc[in] The cell location where the result is defined. By default the same as A.

Field3D b0xGrad_dot_Grad(const Field3D &phi, const Field3D &A, CELL_LOC outloc)#
Coordinates::FieldMetric bracket(const Field2D &f, const Field2D &g, BRACKET_METHOD method, CELL_LOC outloc, Solver *solver)#

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[in] The potential

  • g[in] The field being advected

  • method[in] The method to use

  • outloc[in] The cell location where the result is defined. Default is the same as g

  • solver[in] Pointer to the time integration solver

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