ORB5X 1.0.0
Performance-portable global electromagnetic gyrokinetic PIC code
orb5x::BSpline Class Reference

Evaluates the one-dimensional basis functions used by the solver. More...

#include "bspline.hpp"

Static Public Member Functions

static void beval3 (Real ai, int i, int n, Real *Bik, int *pos)
 Evaluate the bounded quadratic basis in cell i.
 
static void beval3D (Real ai, int i, int n, Real *Bik, int *pos)
 Evaluate bounded quadratic derivatives with respect to \(\xi\).
 
static void beval4 (Real ai, int i, int n, Real *Bik, int *pos)
 Evaluate the bounded cubic basis in cell i.
 
static void beval4D (Real ai, int i, int n, Real *Bik, int *pos)
 Evaluate bounded cubic derivatives with respect to \(\xi\).
 
static void eval (Real ai, int degree, Real *Bik, int *pos)
 Dispatch to the cardinal evaluator selected by ORB5 degree.
 
static void eval1 (Real ai, Real *Bik, int *pos)
 Evaluate the constant cardinal basis.
 
static void eval1D (Real ai, Real *Bik, int *pos)
 Evaluate the \(\xi\) derivative of the constant cardinal basis.
 
static void eval2 (Real ai, Real *Bik, int *pos)
 Evaluate the two linear cardinal basis functions.
 
static void eval2D (Real ai, Real *Bik, int *pos)
 Evaluate the \(\xi\) derivatives of the linear cardinal basis.
 
static void eval3 (Real ai, Real *Bik, int *pos)
 Evaluate the three quadratic cardinal basis functions.
 
static void eval3D (Real ai, Real *Bik, int *pos)
 Evaluate the \(\xi\) derivatives of the quadratic cardinal basis.
 
static void eval4 (Real ai, Real *Bik, int *pos)
 Evaluate the four cubic cardinal basis functions.
 
static void eval4D (Real ai, Real *Bik, int *pos)
 Evaluate the \(\xi\) derivatives of the cubic cardinal basis.
 
static void evald (Real ai, int degree, Real *Bik, int *pos)
 Dispatch to the cardinal derivative evaluator selected by degree.
 
static int find_cell (Real x, Real x0, Real dx_inv)
 Convert a coordinate to its zero-based uniform-mesh cell index.
 
static Real normalize_ksi (Real x, Real x_cell, Real dx)
 Normalize a coordinate to its local cell coordinate.
 

Detailed Description

Evaluates the one-dimensional basis functions used by the solver.

The cardinal routines operate on a uniform mesh. The bounded variants replace the cardinal coefficients in the first and last cells so that the physical end points are represented correctly. In this API degree follows the historical ORB5 convention: it is the number of nonzero basis functions (1–4), so values 1, 2, 3, and 4 denote constant, linear, quadratic, and cubic polynomials, respectively.

All derivative routines return derivatives with respect to the dimensionless cell coordinate \(\xi\). A derivative with respect to the physical coordinate is obtained by multiplying by the inverse cell width.

Fortran reference
solver/BSplines.F90, modules BSplinesCardinalDegree1 through BSplinesCardinalDegree4, BSplinesBoundedDegree3, and BSplinesBoundedDegree4.

Member Function Documentation

◆ beval3()

static void orb5x::BSpline::beval3 ( Real  ai,
int  i,
int  n,
Real *  Bik,
int *  pos 
)
static

Evaluate the bounded quadratic basis in cell i.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[in]iZero-based cell index; i == n denotes the final grid point.
[in]nNumber of mesh intervals.
[out]BikArray of at least three elements receiving basis values.
[out]posArray of at least three elements receiving offsets {-2,-1,0}.

◆ beval3D()

static void orb5x::BSpline::beval3D ( Real  ai,
int  i,
int  n,
Real *  Bik,
int *  pos 
)
static

Evaluate bounded quadratic derivatives with respect to \(\xi\).

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[in]iZero-based cell index; i == n denotes the final grid point.
[in]nNumber of mesh intervals.
[out]BikArray of at least three elements receiving derivative values.
[out]posArray of at least three elements receiving offsets {-2,-1,0}.

◆ beval4()

static void orb5x::BSpline::beval4 ( Real  ai,
int  i,
int  n,
Real *  Bik,
int *  pos 
)
static

Evaluate the bounded cubic basis in cell i.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[in]iZero-based cell index; i == n denotes the final grid point.
[in]nNumber of mesh intervals.
[out]BikArray of at least four elements receiving basis values.
[out]posArray of at least four elements receiving offsets {-3,-2,-1,0}.

◆ beval4D()

static void orb5x::BSpline::beval4D ( Real  ai,
int  i,
int  n,
Real *  Bik,
int *  pos 
)
static

Evaluate bounded cubic derivatives with respect to \(\xi\).

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[in]iZero-based cell index; i == n denotes the final grid point.
[in]nNumber of mesh intervals.
[out]BikArray of at least four elements receiving derivative values.
[out]posArray of at least four elements receiving offsets {-3,-2,-1,0}.

◆ eval()

static void orb5x::BSpline::eval ( Real  ai,
int  degree,
Real *  Bik,
int *  pos 
)
static

Dispatch to the cardinal evaluator selected by ORB5 degree.

Parameters
[in]aiDimensionless coordinate \(\xi\) within the cell.
[in]degreeNumber of active basis functions, in the range 1–4.
[out]BikArray of at least degree elements receiving basis values.
[out]posArray of at least degree elements receiving index offsets.
Note
An unsupported degree writes zero to the first output elements.

◆ eval1()

static void orb5x::BSpline::eval1 ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the constant cardinal basis.

Parameters
[in]aiDimensionless coordinate within the cell; unused for this degree.
[out]BikArray of at least one element receiving the basis value.
[out]posArray of at least one element receiving the basis-index offset.

◆ eval1D()

static void orb5x::BSpline::eval1D ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the \(\xi\) derivative of the constant cardinal basis.

Parameters
[in]aiDimensionless coordinate within the cell; unused for this degree.
[out]BikArray of at least one element receiving the derivative value.
[out]posArray of at least one element receiving the basis-index offset.

◆ eval2()

static void orb5x::BSpline::eval2 ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the two linear cardinal basis functions.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[out]BikArray of at least two elements receiving the basis values.
[out]posArray of at least two elements receiving offsets {-1,0}.

◆ eval2D()

static void orb5x::BSpline::eval2D ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the \(\xi\) derivatives of the linear cardinal basis.

Parameters
[in]aiDimensionless coordinate within the cell; derivatives are constant.
[out]BikArray of at least two elements receiving derivative values.
[out]posArray of at least two elements receiving offsets {-1,0}.

◆ eval3()

static void orb5x::BSpline::eval3 ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the three quadratic cardinal basis functions.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[out]BikArray of at least three elements receiving the basis values.
[out]posArray of at least three elements receiving offsets {-2,-1,0}.

◆ eval3D()

static void orb5x::BSpline::eval3D ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the \(\xi\) derivatives of the quadratic cardinal basis.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[out]BikArray of at least three elements receiving derivative values.
[out]posArray of at least three elements receiving offsets {-2,-1,0}.

◆ eval4()

static void orb5x::BSpline::eval4 ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the four cubic cardinal basis functions.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[out]BikArray of at least four elements receiving the basis values.
[out]posArray of at least four elements receiving offsets {-3,-2,-1,0}.

◆ eval4D()

static void orb5x::BSpline::eval4D ( Real  ai,
Real *  Bik,
int *  pos 
)
static

Evaluate the \(\xi\) derivatives of the cubic cardinal basis.

Parameters
[in]aiDimensionless coordinate \(\xi\in[0,1]\) within the cell.
[out]BikArray of at least four elements receiving derivative values.
[out]posArray of at least four elements receiving offsets {-3,-2,-1,0}.

◆ evald()

static void orb5x::BSpline::evald ( Real  ai,
int  degree,
Real *  Bik,
int *  pos 
)
static

Dispatch to the cardinal derivative evaluator selected by degree.

Parameters
[in]aiDimensionless coordinate \(\xi\) within the cell.
[in]degreeNumber of active basis functions, in the range 1–4.
[out]BikArray of at least degree elements receiving \(dB/d\xi\).
[out]posArray of at least degree elements receiving index offsets.
Note
An unsupported degree writes zero to the first output elements.

◆ find_cell()

static int orb5x::BSpline::find_cell ( Real  x,
Real  x0,
Real  dx_inv 
)
static

Convert a coordinate to its zero-based uniform-mesh cell index.

Parameters
[in]xCoordinate to locate, in the same units as x0.
[in]x0Coordinate of grid point zero.
[in]dx_invInverse mesh spacing, in inverse units of x.
Returns
Truncation of \((x-x_0)/\Delta x\) toward zero.
Note
This helper does not clamp the result to a mesh extent.

◆ normalize_ksi()

static Real orb5x::BSpline::normalize_ksi ( Real  x,
Real  x_cell,
Real  dx 
)
static

Normalize a coordinate to its local cell coordinate.

Parameters
[in]xCoordinate to normalize.
[in]x_cellCoordinate of the left cell boundary, in units of x.
[in]dxCell width, in units of x.
Returns
Dimensionless value \((x-x_{cell})/\Delta x\).

The documentation for this class was generated from the following file: