Finite Element Interpolations
Standard Interpolations
Each finite element has its standard interpolator that can be applied to some user-defined DataFunction. Instead of interpolating on the full cells, the interpolation can be restricted to faces or edges, by specifying an Assembly Type in the call.
It is also possible to interpolate finite element functions on one grid onto a finite element function on another grid (experimental feature, does not work for all finite elements yet and shall be extended to interpolations of operator evaluations as well in future).
ExtendableGrids.interpolate!
— Functionfunction ExtendableGrids.interpolate!(target::FEVectorBlock,
AT::Type{<:AssemblyType},
source::UserData{AbstractDataFunction};
items = [],
time = 0)
Interpolates the given source into the finite elements space assigned to the target FEVectorBlock with the specified AssemblyType (usualy ON_CELLS). The optional time argument is only used if the source depends on time.
function ExtendableGrids.interpolate!(target::FEVectorBlock,
source::UserData{AbstractDataFunction};
items = [],
time = 0)
Interpolates the given source into the finite element space assigned to the target FEVectorBlock. The optional time argument is only used if the source depends on time.
function ExtendableGrids.interpolate!(
target::FEVectorBlock{T1,Tv,Ti},
source::FEVectorBlock{T2,Tv,Ti};
operator = Identity,
postprocess = NoAction(),
xtrafo = nothing,
items = [],
not_in_domain_value = 1e30,
use_cellparents::Bool = false) where {T1,T2,Tv,Ti}
Interpolates (operator-evaluations of) the given finite element function into the finite element space assigned to the target FEVectorBlock. (Currently not the most efficient way as it is based on the PointEvaluation pattern and cell search. If CellParents are available in the grid components of the target grid, these parent cell information can be used to improve the search. To activate this put 'use_cellparents' = true). By some action with kernel (result,input) the operator evaluation (=input) can be further postprocessed (done by the called point evaluator).
Note: discontinuous quantities at vertices of the target grid will be evaluted in the first found cell of the source grid. No averaging is performed.
Nodal Evaluations
Usually, Plotters need nodal values, so there is a gengeric function that evaluates any finite element function at the nodes of the grids (possibly by averaging if discontinuous). In case of Identity evaluations of an H1-conforming finite element, the function nodevalues_view can generate a view into the coefficient field that avoids further allocations.
GradientRobustMultiPhysics.nodevalues!
— Functionfunction nodevalues!(
target::AbstractArray{<:Real,2},
source::AbstractArray{T,1},
FE::FESpace{Tv,Ti,FEType,AT},
operator::Type{<:AbstractFunctionOperator} = Identity;
regions::Array{Int,1} = [0],
abs::Bool = false,
factor = 1,
target_offset::Int = 0, # start to write into target after offset
zero_target::Bool = true, # target vector is zeroed
continuous::Bool = false)
Evaluates the finite element function with the coefficient vector source (interpreted as a coefficient vector for the FESpace FE) and the specified FunctionOperator at all the nodes of the (specified regions of the) grid and writes the values into target. Discontinuous (continuous = false) quantities are averaged.
function nodevalues!(
target::AbstractArray{<:Real,2},
source::FEVectorBlock,
operator::Type{<:AbstractFunctionOperator} = Identity;
regions::Array{Int,1} = [0],
abs::Bool = false,
factor = 1,
target_offset::Int = 0, # start to write into target after offset
zero_target::Bool = true, # target vector is zeroed
continuous::Bool = false)
Evaluates the finite element function with the coefficient vector source and the specified FunctionOperator at all the nodes of the (specified regions of the) grid and writes the values into target. Discontinuous (continuous = false) quantities are averaged.
GradientRobustMultiPhysics.nodevalues
— Functionfunction nodevalues(nodevals, xgrid::ExtendableGrid{Tv,Ti}, UD::UserData; time = 0) where {Tv,Ti}
Returns a 2D array with the node values of the data function for the given grid.
function nodevalues(
source::FEVectorBlock,
operator::Type{<:AbstractFunctionOperator} = Identity;
regions::Array{Int,1} = [0],
abs::Bool = false,
factor = 1,
target_offset::Int = 0, # start to write into target after offset
zero_target::Bool = true, # target vector is zeroed
continuous::Bool = false)
Evaluates the finite element function with the coefficient vector source and the specified FunctionOperator at all the nodes of the (specified regions of the) grid and returns an array with the values. Discontinuous (continuous = false) quantities are averaged.
GradientRobustMultiPhysics.nodevalues_view
— Functionfunction nodevalues_view(
source::FEVectorBlock,
operator::Type{<:AbstractFunctionOperator} = Identity)
Returns a vector of views of the nodal values of the source block (currently works for unbroken H1-conforming elements) that directly accesses the coefficients.