File shiftedmetricinterp.hxx#
-
class ShiftedMetricInterp : public ParallelTransform#
- #include <shiftedmetricinterp.hxx>
Shifted metric method Each Y location is shifted in Z with respect to its neighbours so that the grid is orthogonal in X-Z, but requires interpolation to calculate the values of points along field-lines.
In this implementation the interpolation is done using ZInterpolation objects
Public Functions
-
ShiftedMetricInterp() = delete#
-
ShiftedMetricInterp(Mesh &mesh, CELL_LOC location_in, Field2D zShift_in, BoutReal zlength_in, Options *opt = nullptr)#
-
virtual void calcParallelSlices(Field3D &f) override#
Calculates the yup() and ydown() fields of f by interpolating f through a toroidal shift angle
Calculate the Y up and down fields
-
virtual Field3D toFieldAligned(const Field3D &f, const std::string ®ion = "RGN_ALL") override#
Uses interpolation of f through a toroidal shift angle to align the grid points with the y coordinate (along magnetic field usually).
Note that the returned field will no longer be orthogonal in X-Z, and the metric tensor will need to be changed if X derivatives are used.
Shift the field so that X-Z is not orthogonal, and Y is then field aligned.
-
inline virtual FieldPerp toFieldAligned(const FieldPerp &f, const std::string ®ion = "RGN_ALL") override#
-
virtual Field3D fromFieldAligned(const Field3D &f, const std::string ®ion = "RGN_ALL") override#
Converts a field back to X-Z orthogonal coordinates from field aligned coordinates.
Shift back, so that X-Z is orthogonal, but Y is not field aligned.
-
inline virtual FieldPerp fromFieldAligned(const FieldPerp &f, const std::string ®ion = "RGN_ALL") override#
-
inline virtual bool canToFromFieldAligned() const override#
-
inline virtual std::vector<ParallelTransform::PositionsAndWeights> getWeightsForYApproximation(int i, int j, int k, int y_offset) override#
-
inline virtual bool requiresTwistShift(bool twist_shift_enabled, YDirectionType ytype) override#
If
twist_shift_enabled
is true, does aField3D
with Y directionytype
require a twist-shift at branch cuts on closed field lines?
Protected Functions
-
virtual void checkInputGrid() override#
This method should be called in the constructor to check that if the grid has a ‘parallel_transform’ variable, it has the correct value
Private Members
-
CELL_LOC location = {CELL_CENTRE}#
-
Field2D zShift#
This is the shift in toroidal angle (z) which takes a point from X-Z orthogonal to field-aligned along Y.
-
std::vector<std::unique_ptr<ZInterpolation>> parallel_slice_interpolators#
Cache of interpolators for the parallel slices. Slices are stored in the following order: {+1, …, +n, -1, …, -n} parallel_slice_interpolator[i] stores interpolator for slice i+1 parallel_slice_interpolator[n + i] stores offset -(i+1) where i goes from 0 to (n-1), with n the number of y guard cells
-
std::unique_ptr<ZInterpolation> interp_to_aligned#
ZInterpolation objects for shifting to and from field-aligned coordinates.
-
std::unique_ptr<ZInterpolation> interp_from_aligned#
-
ShiftedMetricInterp() = delete#