File difops.hxx#
Differential operators
Changelog:
2009-01 Ben Dudson bd512@york.ac.uk
Added two optional parameters which can be put in any order These determine the method to use (DIFF_METHOD) and CELL_LOC location of the result. Both of these options are defined in bout_types.hxx
Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
Contact: Ben Dudson, bd512@york.ac.uk
This file is part of BOUT++.
BOUT++ is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
BOUT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with BOUT++. If not, see http://www.gnu.org/licenses/.
Enums
-
enum class BRACKET_METHOD#
Poisson bracket methods
Values:
-
enumerator standard#
Use b0xGrad_dot_Grad.
-
enumerator simple#
Keep only terms in X-Z.
-
enumerator arakawa#
Arakawa method in X-Z (optimised)
-
enumerator ctu#
Corner Transport Upwind (CTU) method. Explicit method only, needs the timestep from the solver
-
enumerator arakawa_old#
Older version, for regression testing of optimised version.
-
enumerator standard#
Functions
-
Coordinates::FieldMetric 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 – [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.
-
inline Coordinates::FieldMetric Grad_par(const Field2D &var, CELL_LOC outloc, DIFF_METHOD method)#
-
Field3D Grad_par(const Field3D &var, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")
-
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 = 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 – [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
-
inline Coordinates::FieldMetric Vpar_Grad_par(const Field2D &v, const Field2D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")
-
inline Field3D Vpar_Grad_par(const Field3D &v, const Field3D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Coordinates::FieldMetric 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 – [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
-
inline Coordinates::FieldMetric Div_par(const Field2D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Field3D Div_par(const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")
-
inline Field3D Div_par(const Field3D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Field3D Div_par_flux(const Field3D &v, const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")
-
inline Field3D Div_par_flux(const Field3D &v, const Field3D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Coordinates::FieldMetric 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 – [in] The field to be differentiated
outloc – [in] The cell location of the result
-
inline Coordinates::FieldMetric Grad2_par2(const Field2D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &method = "DEFAULT")
-
inline Field3D Grad2_par2(const Field3D &f, CELL_LOC outloc, DIFF_METHOD method)#
-
Coordinates::FieldMetric 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 – [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 = CELL_DEFAULT)
-
Coordinates::FieldMetric Div_par_K_Grad_par(const Field2D &kY, const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)
-
Field3D Div_par_K_Grad_par(const Field2D &kY, const Field3D &f, CELL_LOC outloc = CELL_DEFAULT)
-
Field3D Div_par_K_Grad_par(const Field3D &kY, const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)
-
Field3D Div_par_K_Grad_par(const Field3D &kY, const Field3D &f, CELL_LOC outloc = CELL_DEFAULT)
-
Coordinates::FieldMetric 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
-
Field3D Delp2(const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, bool useFFT = true)
-
FieldPerp Delp2(const FieldPerp &f, CELL_LOC outloc = CELL_DEFAULT, bool useFFT = true)
-
Coordinates::FieldMetric Laplace_perp(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &dfdy_boundary_condition = "free_o3", const std::string &dfdy_region = "")
Perpendicular Laplacian, keeping y derivatives
-
Field3D Laplace_perp(const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &dfdy_boundary_condition = "free_o3", const std::string &dfdy_region = "")
-
Coordinates::FieldMetric Laplace_par(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT)
Parallel Laplacian operator
-
Field3D Laplace_par(const Field3D &f, CELL_LOC outloc = CELL_DEFAULT)
-
Coordinates::FieldMetric Laplace(const Field2D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &dfdy_boundary_condition = "free_o3", const std::string &dfdy_region = "")
Full Laplacian operator (par + perp)
-
Field3D Laplace(const Field3D &f, CELL_LOC outloc = CELL_DEFAULT, const std::string &dfdy_boundary_condition = "free_o3", const std::string &dfdy_region = "")
-
Coordinates::FieldMetric b0xGrad_dot_Grad(const Field2D &phi, const Field2D &A, CELL_LOC outloc = CELL_DEFAULT)
Terms of form b0 x Grad(phi) dot Grad(A)
-
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 – [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 Field2D &phi, const Field3D &A, CELL_LOC outloc = CELL_DEFAULT)
-
Field3D b0xGrad_dot_Grad(const Field3D &phi, const Field3D &A, CELL_LOC outloc = CELL_DEFAULT)
-
Coordinates::FieldMetric 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 – [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 Field2D &f, const Field3D &g, BRACKET_METHOD method = BRACKET_STD, CELL_LOC outloc = CELL_DEFAULT, Solver *solver = nullptr)
-
Field3D bracket(const Field3D &f, const Field2D &g, BRACKET_METHOD method = BRACKET_STD, CELL_LOC outloc = CELL_DEFAULT, Solver *solver = nullptr)
-
Field3D bracket(const Field3D &f, const Field3D &g, BRACKET_METHOD method = BRACKET_STD, CELL_LOC outloc = CELL_DEFAULT, Solver *solver = nullptr)#
Variables
-
constexpr BRACKET_METHOD BRACKET_STD = BRACKET_METHOD::standard#
-
constexpr BRACKET_METHOD BRACKET_SIMPLE = BRACKET_METHOD::simple#
-
constexpr BRACKET_METHOD BRACKET_ARAKAWA = BRACKET_METHOD::arakawa#
-
constexpr BRACKET_METHOD BRACKET_CTU = BRACKET_METHOD::ctu#
-
constexpr BRACKET_METHOD BRACKET_ARAKAWA_OLD = BRACKET_METHOD::arakawa_old#