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.FieldType
abstract type Field <: Map

Abstract type representing a physical (scalar, vector, or tensor) field. The domain is a Point and the range a scalar (i.e., a sub-type of Julia Number), a VectorValue, or a TensorValue.

These different cases are distinguished by the return value obtained when evaluating them. E.g., a physical field returns a vector of values when evaluated at a vector of points, and a basis of nf fields returns a 2d matrix (np x nf) when evaluated at a vector of np points.

The following functions (i.e., the Map API) need to be overloaded:

and optionally

A Field can also provide its gradient if the following function is implemented

Higher derivatives can be obtained if the resulting object also implements this method.

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 F. The wrapped field must implement evaluate_gradient! and return_gradient_cache for this gradient to work.

N is how many times the gradient is applied.

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

Implementation of return_cache for a 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.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.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.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.linear_combinationMethod
linear_combination(a::AbstractVector{<:Number}, b::AbstractVector{<:Field})
linear_combination(a::AbstractMatrix{<:Number}, b::AbstractVector{<:Field})
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)
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