interpolation
moment_kinetics.interpolation
— ModuleInterpolation routines intended for post-processing.
Note these are not guaranteed to be highly optimized!
moment_kinetics.interpolation.fill_single_element_interpolation_matrix!
— Functionfill_single_element_interpolation_matrix!(
matrix_slice, newgrid, jelement, coord, spectral)
Set matrix_slice
equal to the interpolation matrix that interpolates values from the element jelement
of the vector being multiplied onto the grid points given by newgrid
(which must be contained within the physical space covered by element jelement
).
coord
is the coordinate
object for the dimension in which the interpolation is done, and spectral
the discretization object corresponding to jelement
.
moment_kinetics.interpolation.interpolate_symmetric!
— Functioninterpolate_symmetric!(result, newgrid, f, oldgrid, derivative=Val(0))
Interpolate f from oldgrid to newgrid, imposing that f(x)
is symmetric around x=0
, so the interpolation is done by fitting a polynomial in x^2
to the values of f
given on oldgrid
, and evaluating on newgrid
. Since interpolation is done in a polynomial of x^2
, the signs of the points on newgrid
and oldgrid
do not matter, and are ignored.
Val(n)
can be passed as derivative
to calculate the derivative of order n
of the interpolating function (only a few values of n
are supported).
moment_kinetics.interpolation.interpolate_to_grid_1d!
— FunctionInterpolation from a regular grid to a 1d grid with arbitrary spacing
Arguments
result : Array{mkfloat, 1} Array to be overwritten with the result of the interpolation newgrid : Array{mkfloat, 1} Grid of points to interpolate coord
to f : Array{mkfloat} Field to be interpolated coord : coordinate coordinate
struct giving the coordinate along which f varies spectral : discretization_info struct containing information for discretization, whose type determines which method is used. derivative : Val(n) The value of n
the integer in the Val{n}
indicates the order of the derivative to be calculated of the interpolating function (only a few values of n
are supported). Defaults to Val(0), which means just calculating the interpolating function itself.
moment_kinetics.interpolation.interpolate_to_grid_1d
— MethodInterpolation from a regular grid to a 1d grid with arbitrary spacing
This version allocates a new array for the result, which is returned.
Arguments
newgrid : Array{mkfloat, 1} Grid of points to interpolate coord
to f : Array{mkfloat} Field to be interpolated coord : coordinate coordinate
struct giving the coordinate along which f varies spectral : Bool or chebyshevinfo struct containing information for discretization, whose type determines which method is used. derivative : Val(n) The value of n
the integer in the Val{n}
indicates the order of the derivative to be calculated of the interpolating function (only a few values of n
are supported). Defaults to Val(0), which means just calculating the interpolating function itself.
Returns
result : Array Array with the values of f
interpolated to the points in new_grid
.
moment_kinetics.interpolation.interpolate_to_grid_vpa!
— Methodmoment_kinetics.interpolation.interpolate_to_grid_vpa!
— Methodmoment_kinetics.interpolation.interpolate_to_grid_vpa
— Methodmoment_kinetics.interpolation.interpolate_to_grid_vpa
— Methodmoment_kinetics.interpolation.interpolate_to_grid_z!
— Methodmoment_kinetics.interpolation.interpolate_to_grid_z!
— Methodmoment_kinetics.interpolation.interpolate_to_grid_z!
— Methodmoment_kinetics.interpolation.interpolate_to_grid_z
— Methodmoment_kinetics.interpolation.interpolate_to_grid_z
— Methodmoment_kinetics.interpolation.interpolate_to_grid_z
— Methodmoment_kinetics.interpolation.single_element_interpolate!
— Functionsingle_element_interpolate!(result, newgrid, f, imin, imax, coord, spectral)
Interpolation within a single element.
f
is an array with the values of the input variable in the element to be interpolated. imin
and imax
give the start and end points of the element in the grid (used to calculate shift and scale factors to a normalised grid).
newgrid
gives the points within the element where output is required. result
is filled with the interpolated values at those points.
coord
is the coordinate
struct for the dimension along which interpolation is being done. spectral
is the corresponding discretization_info
.