File vecops.cxx#

Functions

Vector2D Grad(const Field2D &f, CELL_LOC outloc, const std::string &method)#

Gradient of scalar field f, returning a covariant vector

All locations supported

Parameters:
  • f[in] The field to differentiate

  • outloc[in] The location where the result is desired By default this is the same location as the input f

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

Vector3D Grad(const Field3D &f, CELL_LOC outloc, const std::string &method)#
Vector3D Grad_perp(const Field3D &f, CELL_LOC outloc, const std::string &method)#

Perpendicular gradient of scalar field f

outloc must be either CELL_DEFAULT or f.getLocation() —> argument can be removed

result.x = df/dx - g_12/(JB)^2 df/dy result.y = 0 result.z = df/dz - g_23/(JB)^2 df/dy

Parameters:
  • f[in] The field to differentiate

  • outloc[in] The cell location where the result is desired

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

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

Divergence of a vector v, returning a scalar

All locations except CELL_VSHIFT supported. Note that if v is at CELL_VSHIFT, then outloc must be CELL_CENTRE

Parameters:
  • v[in] The vector to differentiate

  • outloc[in] The cell location where the result is desired

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

Field3D Div(const Vector3D &v, CELL_LOC outloc, const std::string &method)#
Coordinates::FieldMetric Div(const Vector2D &v, const Field2D &f, CELL_LOC outloc, const std::string &method)#
Field3D Div(const Vector3D &v, const Field3D &f, CELL_LOC outloc, const std::string &method)#
Vector2D Curl(const Vector2D &v)#

Curl of a vector

Does not currently support any output locations. v must not be at CELL_VSHIFT

We can’t support VSHIFT here as, e.g. DDY can’t produce an output at CELL_XLOW unless the input field is at CELL_XLOW, but then that field will also be needed at CELL_YLOW, for example for another component.

Parameters:

v[in] The vector to differentiate

Vector3D Curl(const Vector3D &v)#
Coordinates::FieldMetric V_dot_Grad(const Vector2D &v, const Field2D &f)#

Advection of a scalar field f by a velocity vector v

The vector and the field must be at the same location, which cannot be CELL_VSHIFT

Field3D V_dot_Grad(const Vector2D &v, const Field3D &f)#
Field3D V_dot_Grad(const Vector3D &v, const Field2D &f)#
Field3D V_dot_Grad(const Vector3D &v, const Field3D &f)#
template<typename T, typename F, typename R = decltype(T{} + F{})>
R V_dot_Grad(const T &v, const F &a)#
Vector2D V_dot_Grad(const Vector2D &v, const Vector2D &a)#

Advection of a vector field a by a velocity vector v

Both vectors must be at the same location, which cannot be CELL_VSHIFT

Vector3D V_dot_Grad(const Vector2D &v, const Vector3D &a)#
Vector3D V_dot_Grad(const Vector3D &v, const Vector2D &a)#
Vector3D V_dot_Grad(const Vector3D &v, const Vector3D &a)#