Gridap.Fields
Gridap.Fields — Module
Exported names
AffineField, ArrayBlock, ArrayBlockView, BlockMap, ConstantField, DIV, DensifyInnerMostBlockLevelMap, Field, FieldGradient, FieldGradientArray, GenericField, IntegrationMap, MatrixBlock, MatrixBlockView, MockField, MockFieldArray, Point, VectorBlock, VectorBlockView, VoidBasis, VoidBasisMap, VoidField, VoidFieldMap, ZeroField, affine_map, codifferential, constant_field, curl, d_0form, d_1form, divergence, evaluate, evaluate!, exterior_derivative, grad2curl, gradient, gradient_type, integrate, inverse_map, laplacian, lie_derivative, linear_combination, pinvJt, push_∇, push_∇∇, return_cache, return_type, symmetric_gradient, test_field, test_field_array, Δ, ε, ∇, ∇∇, 𝑑, 𝓛,
Gridap.Fields.AffineField — Type
struct AffineField{D1,D2,T,L} <: FieldA Field with the form:
y = x⋅G + y0with G::TensorValue{D1,D2,T,L} and y0::Point{D2,T}.
Gridap.Fields.AffineMap — Type
struct AffineMap <: MapGridap.Fields.BroadcastOpFieldArray — Type
Type that represents a broadcast operation over a set of AbstractArray{<:Field}. The result is a sub-type of AbstractArray{<:Field}
Gridap.Fields.CodifferentialForm — Type
CodifferentialForm{K,D,F} <: FieldLazy codifferential of DifferentialForm{K,D,...}. Stores only form::F; all helper data (Hodge star matrix, gradient caches) are derived in return_cache and reused across point evaluations.
Gridap.Fields.ConstantField — Type
struct ConstantField{T<:Number} <: FieldConstant field with value of type T.
Gridap.Fields.DensifyInnerMostBlockLevelMap — Type
struct DensifyInnerMostBlockLevelMap <: MapGridap.Fields.DifferentialForm — Type
DifferentialForm{K,D,L,Data} <: FieldTyped K-form in D dimensions. Data = typeof(data) captures the full tuple type of the L = binomial(D,K) component Fields so that downstream wrappers (ExteriorDerivativeForm, CodifferentialForm) can use map(∇, form.data) with full type inference — giving zero-allocation, type-stable evaluation.
Gridap.Fields.ExteriorDerivativeForm — Type
ExteriorDerivativeForm{K,D,F} <: FieldLazy exterior derivative of a DifferentialForm{K,D,...}. Stores only form::F; gradient fields are derived in return_cache via map(∇, form.data).
Gridap.Fields.Field — Type
abstract type Field <: MapAbstract type representing a physical (scalar, vector, or tensor valued) field. The domain is a Point and the range a scalar (sub-typing a Number), a VectorValue, or a TensorValue.
The Fields module implements evaluate Array of fields at Points and AbstractVector of points. These different cases are distinguished by the return value obtained when evaluating them. For example, a field returns a Vector of values when evaluated at a Vector of points, and a basis of nf fields returns a (np x nf) Matrix when evaluated at a Vector of np points.
The following functions (i.e., the Map API) need to be overloaded:
and optionally
A Field or Function f can also provide its gradient if the following method is implemented
This also provide higher order derivatives of user defined f, and the other differential operators will use the derivatives provided by gradient rather than automatic differentiation.
The interface can be tested with
For performance, the user can also consider a vectorised version of the Field API that evaluates the field in a vector of points (instead of only one point). E.g., the evaluate! function for a vector of points returns a vector of scalar, vector or tensor values.
Gridap.Fields.FieldGradient — Type
struct FieldGradient{N,F} <: FieldType that represents the gradient of a field of type F. N is how many times the gradient is applied. Requires implementing
evaluate!(cache,f::FieldGradient,x::Point) = @abstractmethod.For F<:Function, FieldGradient is implemented for N=1, 2 by gradient and hessian.
Gridap.Fields.FieldGradientArray — Type
struct FieldGradientArray{Ng,A,T,N} <: AbstractArray{T,N}A wrapper that represents the broadcast of gradient over an array of fields. Ng is the number of times the gradient is applied, A the type of the field array to take derivatives of.
Gridap.Fields.GenericField — Type
struct GenericField{T} <: FieldA wrapper for objects that can act as fields, e.g., functions which implement the Field API.
Gridap.Fields.IntegrationMap — Type
struct IntegrationMap <: MapMap for low level integrate, that is computation of vectorized discrete quadratures.
Gridap.Fields.KoszulForm — Type
KoszulForm{K,D,F} <: FieldLazy Koszul contraction of a DifferentialForm{K,D,...}. Stores only form::F; evaluates ι_x(form(x)) at each point x.
Gridap.Fields.MockField — Type
struct MockField{T<:Number} <: FieldFor tests.
Gridap.Fields.MockFieldArray — Type
struct MockFieldArray{N,A} <: AbstractArray{GenericField{Nothing},N}For tests.
Gridap.Fields.OperationField — Type
struct OperationField{O,F} <: FieldA Field that is obtained as a given operation op::O over a tuple of fields fields::F.
Gridap.Fields.Point — Type
const Point{D,T} = VectorValue{D,T}Type representing a point of D dimensions with coordinates of type T. Fields are evaluated at vectors of Point objects.
Gridap.Fields.PullbackForm — Type
PullbackForm{K,Dm,Dn} <: FieldLazy pullback φ*ω of a DifferentialForm{K,Dn} under a map field φ : ℝᴰᵐ → ℝᴰⁿ, see pullback(φ::Field, ω::DifferentialForm, ::Val).
Gridap.Fields.TransposeFieldIndices — Type
Given a matrix np x nf1 x nf2 result of the evaluation of a field vector on a vector of points, it returns an array in which the field axes (second and third axes) are permuted. It is equivalent as Base.permutedims(A,(1,3,2)) but more performant, since it does not involve allocations.
Gridap.Fields.VoidBasis — Type
struct VoidBasis{T,N,A} <: AbstractArray{T,N}Gridap.Fields.VoidBasisMap — Type
struct VoidBasisMap <: MapGridap.Fields.VoidField — Type
struct VoidField{F} <: FieldGridap.Fields.VoidFieldMap — Type
struct VoidFieldMap <: MapGridap.Fields.ZeroField — Type
struct ZeroField{F} <: FieldIt represents 0.0*f for a field f::F.
Gridap.Arrays.evaluate! — Method
evaluate!(c, f::AbstractArray{T}, x::Point) where T<:FieldEvaluation of an array of Field.
If the field vector has length nf and it is evaluated in one point, it returns an nf vector with the result. If the same array is applied to a vector of np points, it returns a matrix np x nf.
Gridap.Fields.DIV — Method
DIV(f)Reference space divergence.
Gridap.Fields.affine_map — Method
affine_map(gradient, origin) = AffineField(gradient, origin)See AffineField.
Gridap.Fields.codifferential — Function
codifferential(ω)Codifferential of a differential K-form ω, is a (K-1)-form. In flat Euclidean space, δω = (-1)^{D(K-1)+1} ⋆ d ⋆ ω.
Gridap.Fields.constant_field — Method
constant_field(value) = ConstantField(value)See ConstantField.
Gridap.Fields.curl — Method
curl(f)Abstract curl operator, formally equivalent to
f -> ∂₁f₂ - ∂₂f₁for 2D vector functions, orf -> ∇×ffor 3D vector functions.
Gridap.Fields.d_0form — Method
d_0form(f) = to_1form(∇(f))Discrete exterior derivative of a scalar (0-form) cell field. Returns a ExteriorFormValue{1,D}-valued OperationCellField.
Gridap.Fields.d_1form — Method
d_1form(f) = Operation(grad_to_2form)(∇(f))Discrete exterior derivative of a VectorValue'd (1-form) CellField (e.g., from a Nédélec FESpace). Returns a ExteriorFormValue{2,D}-valued OperationCellField.
Gridap.Fields.divergence — Method
divergence(f)Abstract divergence operator, formally equivalent to f -> ∇⋅f.
Gridap.Fields.exterior_derivative — Function
exterior_derivative(ω)
𝑑(ω)Exterior derivative of a differential K-form dω, is a (K+1)-form.
Gridap.Fields.grad2curl — Method
grad2curl(∇f)Return
∇f[1,2] - ∇f[2,1]for 2×2 input tensor, orVectorValue(∇f[2,3] - ∇f[3,2], ∇f[3,1] - ∇f[1,3], ∇f[1,2] - ∇f[2,1])for 3×3 input tensor.
Gridap.Fields.gradient — Function
function gradient endAbstract gradient operator, see Field.
Gridap.Fields.gradient_type — Method
gradient_type(::Type{T}, x::Point) where TTensor type of the gradient of a T valued function.
Gridap.Fields.hodge_star_form — Method
hodge_star_form(ω::DifferentialForm{K,D})Flat (Euclidean) Hodge star: a DifferentialForm{D-K,D} whose component fields are ±1 linear combinations of the components of ω.
It is differentiable, unlike the pointwise Operation(hodge_star).
Gridap.Fields.integrate — Method
integrate(a::AbstractArray{<:Field},q::AbstractVector{<:Point},w::AbstractVector{<:Real},j::Field)Integration of a given array of fields in the "reference" space
Gridap.Fields.integrate — Method
integrate(a::AbstractArray{<:Field},x::AbstractVector{<:Point},w::AbstractVector{<:Real})Integration of a given array of fields in the "physical" space
Gridap.Fields.integrate — Method
integrate(a::Field,q::AbstractVector{<:Point},w::AbstractVector{<:Real},j::Field)Numerical integration of a given field in the "reference" space. j is the Jacobian field of the geometrical mapping .
Gridap.Fields.integrate — Method
integrate(a::Field,x::AbstractVector{<:Point},w::AbstractVector{<:Real})Numerical integration of a given field in the "physical" space. a is the field, x the quadrature points and w the quadrature weights.
Gridap.Fields.laplacian — Method
laplacian(f)
Δ(f)Abstract laplacian operator, equivalent to tr(∇∇(f)).
Gridap.Fields.lie_derivative — Function
lie_derivative(v, ω)
𝓛(v,ω)Lie derivative 𝓛v ω = d(ιv ω) + ι_v(dω) (Cartan's magic formula).
Requires symbolic (Symbolics.Num) coefficients: methods are provided by the GridapSymbolicsExt package extension when Symbolics is loaded.
Gridap.Fields.linear_combination — Method
linear_combination(v::AbstractVector{<:Number}, f::AbstractVector{<:Field})
linear_combination(m::AbstractMatrix{<:Number}, f::AbstractVector{<:Field})Lazy linear combination lc = vf = Σ vᵢfᵢ , or lcⱼ = (transpose(m)f)ⱼ = Σᵢ mᵢⱼfᵢ.
Gridap.Fields.pinvJt — Method
function pinvJt(Jt::MultiValue{Tuple{D,D}}) = inv(Jt)
function pinvJt(Jt::MultiValue{Tuple{D1,D2}}) = transpose(inv(Jt⋅transpose(J))⋅Jt)(Psedo-)inverse of Jt.
Gridap.Fields.push_∇ — Method
push_∇(∇a::Field, ϕ::Field) = pinvJt(∇(ϕ))⋅∇aPushforward of ∇a by the mapping ϕ, or covariant Piola transform.
Gridap.Fields.push_∇∇ — Method
push_∇∇(∇∇a::Field, ϕ::Field) = @notimplementedGridap.Fields.skew_symmetric_gradient — Method
skew_symmetric_gradient(f)Abstract skew symmetric gradient operator, formally equivalent to f -> ½(∇f - (∇f)ᵀ).
Gridap.Fields.symmetric_gradient — Method
symmetric_gradient(f)
ε(f)Abstract symmetric gradient operator, formally equivalent to f -> ½(∇f + (∇f)ᵀ).
Gridap.Fields.test_field — Function
test_field(
f::Union{Field,AbstractArray{<:Field}},
x,
v,
cmp=(==);
grad=nothing,
gradgrad=nothing)Function used to test the field interface. v is an array containing the expected result of evaluating the field f at the point or vector of points x. The comparison is performed using the cmp function. For fields objects that support the gradient function, the keyword argument grad can be used. It should contain the result of evaluating gradient(f) at x. Idem for gradgrad. The checks are performed with the @test macro.
Gridap.Fields.test_field_array — Function
test_field_array(f::AbstractArray{<:Field}, x, v, cmp=(==); grad=nothing, gradgrad=nothing)For tests.
Gridap.Fields.∇∇ — Method
∇∇(f) = gradient(gradient(f))Abstract hessian operator.
Gridap.TensorValues.koszul — Method
koszul(ω::DifferentialForm)Koszul differential of ω, giving a (K-1)-form valued KoszulForm.
Gridap.TensorValues.outer — Method
outer(f,∇)
f⊗∇Equivalent to transpose(gradient(f)).
Gridap.TensorValues.outer — Method
outer(∇,f)
∇⊗fEquivalent to gradient(f).
LinearAlgebra.cross — Method
cross(∇,f)
∇×fEquivalent to curl(f).
LinearAlgebra.dot — Method
dot(∇,f)
∇⋅fEquivalent to divergence(f).