Gridap.Fields

Gridap.FieldsModule
source
Gridap.Fields.AffineFieldType
struct AffineField{D1,D2,T,L} <: Field

A Field with the form:

y = x⋅G + y0

with G::TensorValue{D1,D2,T,L} and y0::Point{D2,T}.

source
Gridap.Fields.CodifferentialFormType
CodifferentialForm{K,D,F} <: Field
Warning

This type is experimental. It might be removed in the future.

Lazy 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.

source
Gridap.Fields.DifferentialFormType
DifferentialForm{K,D,L,Data} <: Field
Warning

This type is experimental. It might be removed in the future.

Typed 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.

source
Gridap.Fields.ExteriorDerivativeFormType
ExteriorDerivativeForm{K,D,F} <: Field
Warning

This type is experimental. It might be removed in the future.

Lazy exterior derivative of a DifferentialForm{K,D,...}. Stores only form::F; gradient fields are derived in return_cache via map(∇, form.data).

source
Gridap.Fields.FieldType
abstract type Field <: Map

Abstract 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.

source
Gridap.Fields.FieldGradientType
struct FieldGradient{N,F} <: Field

Type 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.

source
Gridap.Fields.FieldGradientArrayType
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.

source
Gridap.Fields.GenericFieldType
struct GenericField{T} <: Field

A wrapper for objects that can act as fields, e.g., functions which implement the Field API.

source
Gridap.Fields.KoszulFormType
KoszulForm{K,D,F} <: Field
Warning

This type is experimental. It might be removed in the future.

Lazy Koszul contraction of a DifferentialForm{K,D,...}. Stores only form::F; evaluates ι_x(form(x)) at each point x.

source
Gridap.Fields.PointType
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.

source
Gridap.Fields.TransposeFieldIndicesType

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.

source
Base.:∘Method
f∘g

It returns the composition of two fields, which is just Operation(f)(g)

source
Gridap.Arrays.evaluate!Method
evaluate!(c, f::AbstractArray{T}, x::Point) where T<:Field

Evaluation 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.

source
Gridap.Fields.codifferentialFunction
codifferential(ω)

Codifferential of a differential K-form ω, is a (K-1)-form. In flat Euclidean space, δω = (-1)^{D(K-1)+1} ⋆ d ⋆ ω.

source
Gridap.Fields.curlMethod
curl(f)

Abstract curl operator, formally equivalent to

  • f -> ∂₁f₂ - ∂₂f₁ for 2D vector functions, or
  • f -> ∇×f for 3D vector functions.
source
Gridap.Fields.d_0formMethod
d_0form(f) = to_1form(∇(f))

Discrete exterior derivative of a scalar (0-form) cell field. Returns a ExteriorFormValue{1,D}-valued OperationCellField.

source
Gridap.Fields.d_1formMethod
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.

source
Gridap.Fields.grad2curlMethod
grad2curl(∇f)

Return

  • ∇f[1,2] - ∇f[2,1] for 2×2 input tensor, or
  • VectorValue(∇f[2,3] - ∇f[3,2], ∇f[3,1] - ∇f[1,3], ∇f[1,2] - ∇f[2,1]) for 3×3 input tensor.
source
Gridap.Fields.hodge_star_formMethod
hodge_star_form(ω::DifferentialForm{K,D})
Warning

This type is experimental. It might be removed in the future.

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).

source
Gridap.Fields.integrateMethod
integrate(a::AbstractArray{<:Field},q::AbstractVector{<:Point},w::AbstractVector{<:Real},j::Field)

Integration of a given array of fields in the "reference" space

source
Gridap.Fields.integrateMethod
integrate(a::AbstractArray{<:Field},x::AbstractVector{<:Point},w::AbstractVector{<:Real})

Integration of a given array of fields in the "physical" space

source
Gridap.Fields.integrateMethod
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 .

source
Gridap.Fields.integrateMethod
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.

source
Gridap.Fields.lie_derivativeFunction
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.

source
Gridap.Fields.linear_combinationMethod
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ᵢ.

source
Gridap.Fields.pinvJtMethod
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.

source
Gridap.Fields.push_∇Method
push_∇(∇a::Field, ϕ::Field) = pinvJt(∇(ϕ))⋅∇a

Pushforward of ∇a by the mapping ϕ, or covariant Piola transform.

source
Gridap.Fields.test_fieldFunction
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.

source
Gridap.TensorValues.koszulMethod
koszul(ω::DifferentialForm)
Warning

This type is experimental. It might be removed in the future.

Koszul differential of ω, giving a (K-1)-form valued KoszulForm.

source