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 FiniteElementContainersjulia> 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.DirichletBC — Type
struct DirichletBC{F} <: FiniteElementContainers.AbstractDirichletBC{F}func::Anyblock_name::Union{Nothing, String}nset_name::Union{Nothing, String}sset_name::Union{Nothing, String}var_name::String
User facing API to define a DirichletBC`.
FiniteElementContainers.DirichletBCContainer — Type
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
FiniteElementContainers._update_bc_values! — Method
_update_bc_values!(
bc::FiniteElementContainers.DirichletBCContainer,
func::FiniteElementContainers.DirichletBCFunction,
X,
t,
bc_length::Int64,
offset::Int64
)
NeumannBC
We can setup Neumann bcs on a variable u and sideset sset_1 with a simple constant function as follows
julia> using FiniteElementContainersjulia> using StaticArraysjulia> 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 FiniteElementContainersjulia> using StaticArraysjulia> ND = 22julia> 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.NeumannBC — Type
struct NeumannBC{F} <: FiniteElementContainers.AbstractBC{F}func::Anysset_name::Stringvar_name::String
User facing API to define a NeumannBC`.
FiniteElementContainers.NeumannBCContainer — Type
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<:Integersides::AbstractVector{IT} where IT<:Integervals::AbstractMatrix{<:StaticArraysCore.SVector}
Internal implementation of dirichlet BCs
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.RobinBC — Type
struct RobinBC{F} <: FiniteElementContainers.AbstractBC{F}func::Anysset_name::Stringvar_name::String
User facing API to define a RobinBC`.
FiniteElementContainers.RobinBCContainer — Type
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<:Integersides::AbstractVector{IT} where IT<:Integervals::AbstractMatrix{<:StaticArraysCore.SVector}dvalsdu::AbstractMatrix{<:StaticArraysCore.SMatrix}
Internal implementation of dirichlet BCs
Source
FiniteElementContainers.Source — Type
struct Source{F} <: FiniteElementContainers.AbstractBC{F}func::Anyblock_name::Stringvar_name::String
User-facing API to define a body force on an element block.
FiniteElementContainers.SourceContainer — Type
struct SourceContainer{RM<:(AbstractMatrix{<:StaticArraysCore.SVector})}vals::AbstractMatrix{<:StaticArraysCore.SVector}is_constant::Boolinitialized::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
FiniteElementContainers.Sources — Type
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.
Boundary Condition Implementation Details
FiniteElementContainers.AbstractBC — Type
abstract type AbstractBC{F<:Function}FiniteElementContainers.AbstractBCContainer — Type
abstract type AbstractBCContainer{IV<:(AbstractVector{<:Integer}), RV<:AbstractArray}FiniteElementContainers.AbstractBCFunction — Type
abstract type AbstractBCFunction{F}FiniteElementContainers.AbstractBCs — Type
abstract type AbstractBCs{Funcs}FiniteElementContainers.AbstractWeaklyEnforcedBCContainer — Type
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)}})}FiniteElementContainers.BCBookKeeping — Type
struct BCBookKeeping{I<:Integer, V<:AbstractArray{I<:Integer, 1}, M<:AbstractArray{I<:Integer, 2}}blocks::AbstractVector{I} where I<:Integerdofs::AbstractVector{I} where I<:Integerelements::AbstractVector{I} where I<:Integernodes::AbstractVector{I} where I<:Integersides::AbstractVector{I} where I<:Integerside_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
FiniteElementContainers.BCBookKeeping — Method
BCBookKeeping(
mesh,
dof::DofManager,
var_name::String;
block_name,
nset_name,
sideset_name
)
FiniteElementContainers.update_bc_values! — Function
Required interface to implement. Will typically take the form of
$function update_bc_values!(bcs::SomeBCs, X, t, args...) ... end$