API Reference
FiniteElementHermite
FiniteElementHermite.D — Function
D(Y::FE_rep, x::Real)Return derivative of FE_rep Y at location x
FiniteElementHermite.DD — Function
DD(Y::FE_rep, x::Real)Return second derivative of FE_rep Y at location x
FiniteElementHermite.DD_νe — Function
DD_νe(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the second derivative of the even basis element centered at ρ[k] at x Note: Unlike νe and Dνe, DDνe includes the boundary points since second derivative is not constrained to be continuous (C¹ continuity only).
FiniteElementHermite.DD_νo — Function
DD_νo(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the second derivative of the odd basis element centered at ρ[k] at x Note: Unlike νo and Dνo, DDνo includes the boundary points since second derivative is not constrained to be continuous (C¹ continuity only).
FiniteElementHermite.D_νe — Function
D_νe(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the derivative of the even basis element centered at ρ[k] at x
FiniteElementHermite.D_νo — Function
D_νo(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the derivative of the odd basis element centered at ρ[k] at x
FiniteElementHermite.FE — Function
FE(x::AbstractVector{<:Real}, y::AbstractVector{<:Real})Returns finite element representation of data (x, y), fitting local quadratics to determine derivative
FE(grid::AbstractVector{<:Real}, xy::Tuple{<:AbstractVector{<:Real},<:AbstractVector{<:Real}})Returns finite element representation of data (x, y), mapped to grid
FiniteElementHermite.FE_rep — Type
FE_rep(x::S, coeffs::T) where {S<:AbstractVector{<:Real},T<:AbstractVector{<:Real}}Create Hermite-cubic finite-element representation on grid x with cofficients coeffs coeffs[2k] is the value of the function at x[k] coeffs[2k-1] is the derivative of the function at x[k]
An FE_rep is callable, giving the value of the finite-element representation, for example:
Y = FE_rep(x, coeffs)
Y(a) # gives value of the finite-element representation at x=a(Y::FE_rep)(x::Real)Functor for FE_rep, giving the value of the finite-element representation at x
FiniteElementHermite.I — Function
I(Y::FE_rep, x::Real)Return integral of FE_rep Y from 0 to x
FiniteElementHermite.I_νe — Function
I_νe(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the integral of the even basis element centered at ρ[k] from 0 to x
FiniteElementHermite.I_νo — Function
I_νo(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the integral of the odd basis element centered at ρ[k] from 0 to x
FiniteElementHermite.compute_DD_bases — Function
compute_DD_bases(X::AbstractVector{<:Real}, x::Real)For grid X, find the second derivative of the four basis functions at x This can be used with evaluate or evaluate_inbounds to compute the second derivative of multiple FE_reps efficiently if they share the same grid
Returns (k, DD_nu_ou, DD_nu_eu, DD_nu_ol, DD_nu_el) where DD_nu_ou is second derivative of odd basis element centered at X[k] DD_nu_eu is second derivative of even basis element centered at X[k] DD_nu_ol is second derivative of odd basis element centered at X[k+1] DD_nu_el is second derivative of even basis element centered at X[k+1]
FiniteElementHermite.compute_D_bases — Function
compute_D_bases(X::AbstractVector{<:Real}, x::Real)For grid X, find the derivative of the four basis functions at x This can be used with evaluate or evaluate_inbounds to compute the derivative of multiple FE_reps efficiently if they share the same grid
Returns (k, D_nu_ou, D_nu_eu, D_nu_ol, D_nu_el) where D_nu_ou is derivative of odd basis element centered at X[k] D_nu_eu is derivative of even basis element centered at X[k] D_nu_ol is derivative of odd basis element centered at X[k+1] D_nu_el is derivative of even basis element centered at X[k+1]
FiniteElementHermite.compute_bases — Function
compute_bases(X::AbstractVector{<:Real}, x::Real)For grid X, find the value of the four basis functions at x This can be used with evaluate or evaluate_inbounds to compute the value of multiple FE_reps efficiently if they share the same grid
Returns (k, nu_ou, nu_eu, nu_ol, nu_el) where nu_ou is odd basis element centered at X[k] nu_eu is even basis element centered at X[k] nu_ol is odd basis element centered at X[k+1] nu_el is even basis element centered at X[k+1]
FiniteElementHermite.compute_both_bases — Function
compute_both_bases(X::AbstractVector{<:Real}, x::Real)For grid X, find the value and derivative of the four basis functions at x This can be used with evaluate or evaluate_inbounds to compute the value and derivative of multiple FE_rep efficiently if they share the same grid
Returns (k, nu_ou, nu_eu, nu_ol, nu_el, D_nu_ou, D_nu_eu, D_nu_ol, D_nu_el) where nu_ou is odd basis element centered at X[k] nu_eu is even basis element centered at X[k] nu_ol is odd basis element centered at X[k+1] nu_el is even basis element centered at X[k+1] D_nu_ou is derivative of odd basis element centered at X[k] D_nu_eu is derivative of even basis element centered at X[k] D_nu_ol is derivative of odd basis element centered at X[k+1] D_nu_el is derivative of even basis element centered at X[k+1]
FiniteElementHermite.compute_extrapolation_bases — Function
compute_extrapolation_bases(X::AbstractVector{<:Real}, x::Real)For grid X and point x outside the grid bounds, compute the bases needed for quadratic extrapolation. This can be used with extrapolate to extrapolate multiple FE_reps efficiently if they share the same grid.
Throws an ArgumentError if x is within the grid bounds [X[1], X[end]].
Returns (side, k, Δx, DD_nu_ou, DD_nu_eu, DD_nu_ol, DD_nu_el) where side is :low if x < X[1] or :high if x > X[end] k is the element index for the boundary element Δx is the offset from the boundary point DD_nu_* are the second derivative basis values at the boundary
FiniteElementHermite.dual_inner_product — Function
dual_inner_product(integrands::Function, k1, k2, ρ::AbstractVector{<:Real}, order::Union{Nothing,Integer}=nothing)Compute inner product for two functions simultaneously (integrands returns two values) in region where the k1-th and k2-th finite elements of grid ρ overlap Uses Gauss-Legendre quadature of requested order if given
FiniteElementHermite.evaluate — Function
evaluate(Y::FE_rep, k::Integer, nu_ou::Real, nu_eu::Real, nu_ol::Real, nu_el::Real)Evaluate FE_rep Y assuming basis function values/derivatives have been computed by compute_bases, compute_D_bases, or compute_both_bases
`nu_ou` is value or derivative of odd basis element centered at `X[k]`
`nu_eu` is value or derivative of even basis element centered at `X[k]`
`nu_ol` is value or derivative of odd basis element centered at `X[k+1]`
`nu_el` is value or derivative of even basis element centered at `X[k+1]`FiniteElementHermite.evaluate_inbounds — Function
evaluate_inbounds(Y::FE_rep, k::Integer, nu_ou::T, nu_eu::T, nu_ol::T, nu_el::T) where {T<:Real}Evaluate FE_rep Y without bounds checking, assuming basis function values/derivatives have been computed by compute_bases, compute_D_bases, or compute_both_bases
`nu_ou` is value or derivative of odd basis element centered at `X[k]`
`nu_eu` is value or derivative of even basis element centered at `X[k]`
`nu_ol` is value or derivative of odd basis element centered at `X[k+1]`
`nu_el` is value or derivative of even basis element centered at `X[k+1]`FiniteElementHermite.extrapolate — Function
extrapolate(Y::FE_rep, side::Symbol, k::Integer, Δx::Real,
DD_nu_ou::Real, DD_nu_eu::Real, DD_nu_ol::Real, DD_nu_el::Real;
order::Int=2)Extrapolate FE_rep Y using pre-computed extrapolation bases from compute_extrapolation_bases.
With order=1 (linear): matches value and first derivative at the boundary. With order=2 (quadratic, default): also matches second derivative at the boundary.
This method is efficient when extrapolating multiple FE_reps on the same grid.
extrapolate(Y::FE_rep, x::Real; order::Int=2)Extrapolate FE_rep Y to point x outside the grid bounds.
With order=1 (linear): matches value and first derivative at the boundary. With order=2 (quadratic, default): also matches second derivative at the boundary.
For x < Y.x[1], extrapolates from the low boundary. For x > Y.x[end], extrapolates from the high boundary.
FiniteElementHermite.get_quadrature — Function
get_quadrature(x::AbstractVector, order::Integer)For finite-element grid x, give Gauss-Legendre quadrature integration of requested order Returns (xq, wq), quadrature points and quadrature weights
FiniteElementHermite.inner_product — Function
inner_product(nu1, k1::Integer, nu2, k2::Integer, ρ::AbstractVector{<:Real}, order::Union{Nothing,Integer}=nothing)Compute inner product ∫dx nu1(x, k1, ρ) * nu2(x, k2, ρ) where nu1 and nu2 are basis functions Uses Gauss-Legendre quadature of requested order if given
inner_product(f, nu1, k1::Integer, nu2, k2::Integer, ρ::AbstractVector{<:Real}, order::Union{Nothing,Integer}=nothing)Compute inner product ∫dx f(x) * nu1(x, k1, ρ) * nu2(x, k2, ρ) where nu1 and nu2 are basis functions Uses Gauss-Legendre quadature of requested order if given
inner_product(f, nu1, k1::Integer, nu2, k2::Integer, ρ::AbstractVector{<:Real}, order::Union{Nothing,Integer}=nothing)Compute inner product ∫dx nu1(x, k1, ρ) * (f(x) * fnu2(x, k2, ρ) + g(x) * gnu2(x, k2, ρ)) where nu1, fnu2, and gnu2 are basis functions Uses Gauss-Legendre quadature of requested order if given
inner_product(f::Function, nu::Function, k::Integer, ρ::AbstractVector{<:Real}, order::Union{Nothing,Integer}=nothing)Compute inner product ∫dx f(x) * nu(x, k, ρ) where nu is a basis function Uses Gauss-Legendre quadature of requested order if given
inner_product(integrand::Function, k1, k2, ρ::AbstractVector{<:Real}, order::Union{Nothing,Integer}=nothing)Compute inner product for generic integrand for in region where the k1-th and k2-th finite elements of grid ρ overlap Uses Gauss-Legendre quadature of requested order if given
FiniteElementHermite.mass_matrix — Function
mass_matrix(N::Integer, ρ::AbstractVector{<:Real})NxN matrix of inner products of all Hermite cubic finite elements on grid ρ Returns a BandedMatrix as only neighboring finite elements overlap N.B. - N should be determined from ρ and will be removed later
FiniteElementHermite.νe — Function
νe(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the value of the even basis element centered at ρ[k] at x
FiniteElementHermite.νo — Function
νo(x::Real, k::Integer, ρ::AbstractVector{<:Real})Returns the value of the odd basis element centered at ρ[k] at x