DofManager

The DofManager is a struct that keeps track of which dofs are unknown or constrained. This can work with simple or mixed finite element spaces of various types. It is a glorified book keeper.

A DofManager can be created as follows. First we must create functions for our variables of interest from their associated function spaces.

julia> using Exodus, FiniteElementContainersERROR: ArgumentError: Package Exodus not found in current path.
- Run `import Pkg; Pkg.add("Exodus")` to install the Exodus package.
julia> mesh = UnstructuredMesh("../../test/poisson/poisson.g")ERROR: UndefVarError: `UnstructuredMesh` not defined
julia> V = FunctionSpace(mesh, H1Field, Lagrange)ERROR: UndefVarError: `FunctionSpace` not defined
julia> u = VectorFunction(V, :u)ERROR: UndefVarError: `VectorFunction` not defined
julia> t = ScalarFunction(V, :t)ERROR: UndefVarError: `ScalarFunction` not defined
julia> f = FiniteElementContainers.GeneralFunction(u, t)ERROR: UndefVarError: `FiniteElementContainers` not defined

Now we can supply these variables to the DofManager which takes varargs as inputs

julia> dof = DofManager(f)ERROR: UndefVarError: `DofManager` not defined

The print methods for this struct show simple metadata about the current dofs for each possible function space.

A set of unknowns can be set up as follows

julia> field = create_unknowns(dof)ERROR: UndefVarError: `create_unknowns` not defined

We can create fields of the right size from the DofManager with the following methods

julia> field = create_field(dof)ERROR: UndefVarError: `create_field` not defined

These methods take the backend of dof into account to ensure that the fields or unknowns produced are on the same device, e.g. CPU/GPU if dof is on the CPU/GPU.

This struct is created with all dofs initially set as unknown. To modify the unknowns we can do the following

API

FiniteElementContainers.DofManagerType
struct DofManager{Condensed, IT, IDs<:AbstractArray{IT, 1}, Var<:FiniteElementContainers.AbstractFunction} <: FiniteElementContainers.AbstractDofManager{IT, IDs<:AbstractArray{IT, 1}}
  • dirichlet_dofs::AbstractVector

  • unknown_dofs::AbstractVector

  • var::FiniteElementContainers.AbstractFunction

source
FiniteElementContainers.DofManagerMethod
DofManager(
    var::FiniteElementContainers.AbstractFunction;
    use_condensed
) -> DofManager{_A, Int64, Vector{Int64}, <:FiniteElementContainers.AbstractFunction{S, F}} where {_A, S, F<:FunctionSpace}
source
Base.lengthMethod
length(dof::DofManager) -> Any

Return the total lenth of dofs in the problem.

E.g. for an H1 space this will the number of nodes times the number of degrees of freedom per node.

source
Base.sizeMethod
size(dof::DofManager, i::Int64) -> Any

size(dof, 1) returns the number of dofs per entity, and size(dof, 2) returns the number of entities.

source
Base.sizeMethod
size(dof::DofManager) -> Tuple{Any, Any}

This returns (n_dofs, n_entities) where n_dofs is the number of dofs per entity (e.g. node) and n_entities is the number of entitities (e.g. node).

source
FiniteElementContainers.create_unknownsMethod
create_unknowns(dof::DofManager{false, IT, IDs, Var}) -> Any

Creates a vector of unknown dofs.

This specific method returns a vector equal in length to the length of the internally stored list of unknown dofs in dof.

This is used for solution techniques when vector/matrix rows are removed where dofs are fixed.

source
FiniteElementContainers.create_unknownsMethod
create_unknowns(dof::DofManager{true, IT, IDs, Var}) -> Any

Creates a vector of unknown dofs.

This specific method returns a vector equal in length to the length of a field created by dof. E.g. all dofs are unknown.

This is used for solution techniques when vector/matrix rows are not removed where dofs are fixed.

source
FiniteElementContainers.update_dofs!Method
update_dofs!(
    dof::DofManager,
    dirichlet_dofs::AbstractVector{<:Integer}
)

Takes in a list of dof ids associated with dirichlet bcs and updates the internals of dof to reflect these.

NOTE: This clears all existing bcs in dof and starts fresh.

source
FiniteElementContainers.update_field_unknowns!Method
update_field_unknowns!(
    U::FiniteElementContainers.AbstractField,
    dof::DofManager,
    Uu::FiniteElementContainers.AbstractField
)

Takes in a field and updates the field

I think this one can be removed/deprecated

source