Fields

Fields serve as loose wrappers around AbstractArray subtypes such that the size of array slices are known at compile time. Although this introduces a type-instability, the idea is to do this at the top most level (mainly at setup time of a FEM simulation). By introducing this type instability, we can gain information about the field type that is used in methods downstream to construct StaticArrays of views of field types.

All fields are subtypes of the abstract type AbstractField

julia> using FiniteElementContainers
julia> FiniteElementContainers.AbstractFieldFiniteElementContainers.AbstractField

Example - H1Field a.k.a. NodalField

We can set up a H1Field in one of two ways. The simplest constructor form can be used as follows

julia> using FiniteElementContainers
julia> field = H1Field(rand(2, 10))2×10 H1Field{Float64, Vector{Float64}, 2}: 0.789222 0.111092 0.86737 0.032524 … 0.874654 0.563272 0.367348 0.345447 0.514574 0.5717 0.745391 0.7002 0.837897 0.88648

This is stored in a vectorized way as can be seen above

julia> field.data20-element Vector{Float64}:
 0.7892222888404637
 0.3454467261182895
 0.11109169277113562
 0.5145736652052763
 0.8673695744972477
 0.5716998877539061
 0.03252399942416129
 0.7453905848764862
 0.018307059153824135
 0.4384428659255363
 0.7231743422050269
 0.6319646845416022
 0.9598294052158112
 0.7474769290043471
 0.8746543865907138
 0.7001999876242507
 0.5632718217727674
 0.8378966413703612
 0.3673479877490372
 0.8864795707347821

Fields can be indexed like regular arrays, e.g.

julia> field[1, 1]0.7892222888404637
julia> field[1, :]10-element Vector{Float64}:
 0.7892222888404637
 0.11109169277113562
 0.8673695744972477
 0.03252399942416129
 0.018307059153824135
 0.7231743422050269
 0.9598294052158112
 0.8746543865907138
 0.5632718217727674
 0.3673479877490372

etc.

Abstract type

The base type for fields is the AbstractField abstract type.

Any new field added to FiniteElementContainers should be a subtype of this type.

Methods for AbstractField

Base.fill!Method
fill!(
    field::FiniteElementContainers.AbstractField{T, N, D, NF},
    v
) -> Any
source

Implementations

The existing direct subtypes of AbstractField are the following

Connectivity

The connectivity type is a simple alias for L2ElementField defined below

H1 field

L2Element field

L2Quadrature field

There are plans to add HcurlField and HdivField types as well