File integrate.hxx

Defines

INTEGRATE_H

Functions

template<typename Head, typename ...Tail>
auto firstArg(const Head &head, Tail...)

Get the first argument from a parameter pack.

template<typename CellEdges>
BoutReal cellLeft(BoutReal c, BoutReal m, BoutReal p)

Return the value at the left of a cell, given cell centre values at this cell and two neighbours

template<typename CellEdges>
BoutReal cellRight(BoutReal c, BoutReal m, BoutReal p)

Return the value at the right of a cell, given cell centre values at this cell and two neighbours

template<typename CellEdges = hermes::Limiter, typename Function, typename RegionType>
auto cellAverage(Function func, const RegionType &region)

Take a function of BoutReals, and a region. Return a function which takes fields (e.g. Field2D, Field3D), and for every cell in the region evaluates the function at quadrature points with weights. These weights sum to 1, resulting in volume averaged values.

Uses a limiter to calculate values at cell edges. This is needed so that as Ne goes to zero in a cell then atomic rates also go to zero.

Example Field3D Ne = …, Te = …;

Field3D result = cellAverage( [](BoutReal Ne, BoutReal Te) {return Ne*Te;} // The function to evaluate Ne.getRegion(“RGN_NOBNDRY”) // The region to iterate over )(Ne, Te); // The input fields

Note that the order of the arguments to the lambda function is the same as the input fields.