Boundary Conditions

This section describes the user facing API for boundary conditions along with the implementation details.

DirichletBC

We can set up dirichlet boundary conditions on a variable u and sideset sset_1 with a zero function as follows.

julia> using FiniteElementContainers
julia> bc_func(x, t) = 0.bc_func (generic function with 1 method)
julia> bc = DirichletBC("u", bc_func; sideset_name = "sset_1")DirichletBC{typeof(Main.bc_func)}(Main.bc_func, nothing, nothing, "sset_1", "u")

Internally this is eventually converted in a DirichletBCContainer

Dirichlet bcs can be setup on element blocks, nodesets, or sidesets. The appropriate keyword argument needs to be supplied with the DirichletBC constructor.

FiniteElementContainers.DirichletBCType
struct DirichletBC{F} <: FiniteElementContainers.AbstractDirichletBC{F}
  • func::Any

  • block_name::Union{Nothing, String}

  • nset_name::Union{Nothing, String}

  • sset_name::Union{Nothing, String}

  • var_name::String

User facing API to define a DirichletBC`.

source
FiniteElementContainers.DirichletBCContainerType
struct DirichletBCContainer{IV<:(AbstractVector{<:Integer}), RV<:(AbstractVector{<:Number})} <: FiniteElementContainers.AbstractBCContainer{IV<:(AbstractVector{<:Integer}), RV<:(AbstractVector{<:Number})}
  • dofs::AbstractVector{<:Integer}

  • nodes::AbstractVector{<:Integer}

  • vals::AbstractVector{<:Number}

  • vals_dot::AbstractVector{<:Number}

  • vals_dot_dot::AbstractVector{<:Number}

Internal implementation of dirichlet BCs

source

NeumannBC

We can setup Neumann bcs on a variable u and sideset sset_1 with a simple constant function as follows

julia> using FiniteElementContainers
julia> using StaticArrays
julia> bc_func(x, t) = SVector{1, Float64}(1.)bc_func (generic function with 1 method)
julia> bc = NeumannBC("u", bc_func, "sset_1")NeumannBC{typeof(Main.bc_func)}(Main.bc_func, "sset_1", "u")

Note that in comparison to the dirichlet bc example above, the function in this case returns a SVector of size 1. This will hold for any variable u that has a single dof. For vector variables, e.g. a traction vector in continuum mechanics, would need something like

julia> using FiniteElementContainers
julia> using StaticArrays
julia> ND = 22
julia> bc_func(x, t) = SVector{ND, Float64}(1.)bc_func (generic function with 1 method)
julia> bc = NeumannBC("u", bc_func, "sset_1")NeumannBC{typeof(Main.bc_func)}(Main.bc_func, "sset_1", "u")

where ND is the number of dimensions.

FiniteElementContainers.NeumannBCContainerType
struct NeumannBCContainer{IT<:Integer, IV<:AbstractArray{IT<:Integer, 1}, RM<:(AbstractMatrix{<:StaticArraysCore.SVector})} <: FiniteElementContainers.AbstractWeaklyEnforcedBCContainer{IT<:Integer, IV<:AbstractArray{IT<:Integer, 1}, RM<:(AbstractMatrix{<:StaticArraysCore.SVector})}
  • element_conns::Connectivity{IT, IV} where {IT<:Integer, IV<:AbstractVector{IT}}

  • elements::AbstractVector{IT} where IT<:Integer

  • sides::AbstractVector{IT} where IT<:Integer

  • vals::AbstractMatrix{<:StaticArraysCore.SVector}

Internal implementation of dirichlet BCs

source

PeriodicBC

Periodic boundary conditions are very much a work in progress. There is currently some machinary to implement a Lagrange multiplier approach.

Stay tuned.

RobinBC

FiniteElementContainers.RobinBCContainerType
struct RobinBCContainer{IT<:Integer, IV<:AbstractArray{IT<:Integer, 1}, RM<:(AbstractMatrix{<:StaticArraysCore.SVector}), dRM<:(AbstractMatrix{<:StaticArraysCore.SMatrix})} <: FiniteElementContainers.AbstractWeaklyEnforcedBCContainer{IT<:Integer, IV<:AbstractArray{IT<:Integer, 1}, RM<:(AbstractMatrix{<:StaticArraysCore.SVector})}
  • element_conns::Connectivity{IT, IV} where {IT<:Integer, IV<:AbstractVector{IT}}

  • elements::AbstractVector{IT} where IT<:Integer

  • sides::AbstractVector{IT} where IT<:Integer

  • vals::AbstractMatrix{<:StaticArraysCore.SVector}

  • dvalsdu::AbstractMatrix{<:StaticArraysCore.SMatrix}

Internal implementation of dirichlet BCs

source

Source

FiniteElementContainers.SourceType
struct Source{F} <: FiniteElementContainers.AbstractBC{F}
  • func::Any

  • block_name::String

  • var_name::String

User-facing API to define a body force on an element block.

source
FiniteElementContainers.SourceContainerType
struct SourceContainer{RM<:(AbstractMatrix{<:StaticArraysCore.SVector})}
  • vals::AbstractMatrix{<:StaticArraysCore.SVector}

  • is_constant::Bool

  • initialized::Base.RefValue{Bool}

Internal container for body forces — stores pre-evaluated values at volume quadrature points for one block. TODO remove elementconns and reffes and have assemblers just ping the correct block

source
FiniteElementContainers.SourcesType
struct Sources{SourceFuncs, RM<:(AbstractMatrix{<:StaticArraysCore.SVector})} <: FiniteElementContainers.AbstractBCs{SourceFuncs}
  • block_id_to_source::NTuple{16, Int64}

  • source_block_ids::Vector{Int64}

  • source_block_names::Vector{String}

  • source_caches::Array{FiniteElementContainers.SourceContainer{RM}, 1} where RM<:(AbstractMatrix{<:StaticArraysCore.SVector})

  • source_funcs::Any

Collection of body force containers, one per specified body force entry.

source

Boundary Condition Implementation Details

FiniteElementContainers.AbstractWeaklyEnforcedBCContainerType
abstract type AbstractWeaklyEnforcedBCContainer{IT<:Integer, IV<:AbstractArray{IT<:Integer, 1}, RV<:(AbstractMatrix{<:Union{var"#s56", var"#s55"} where {var"#s56"<:Number, var"#s55"<:(StaticArraysCore.SVector)}})} <: FiniteElementContainers.AbstractBCContainer{IV<:AbstractArray{IT<:Integer, 1}, RV<:(AbstractMatrix{<:Union{var"#s56", var"#s55"} where {var"#s56"<:Number, var"#s55"<:(StaticArraysCore.SVector)}})}
source
FiniteElementContainers.BCBookKeepingType
struct BCBookKeeping{I<:Integer, V<:AbstractArray{I<:Integer, 1}, M<:AbstractArray{I<:Integer, 2}}
  • blocks::AbstractVector{I} where I<:Integer

  • dofs::AbstractVector{I} where I<:Integer

  • elements::AbstractVector{I} where I<:Integer

  • nodes::AbstractVector{I} where I<:Integer

  • sides::AbstractVector{I} where I<:Integer

  • side_nodes::AbstractMatrix{I} where I<:Integer

This struct is used to help with book keeping nodes, sides, etc. for all types of boundary conditions.

TODO need to add a domain ID for extending to Schwarz

source