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, Symbol}

  • nset_name::Union{Nothing, Symbol}

  • sset_name::Union{Nothing, Symbol}

  • var_name::Symbol

User facing API to define a DirichletBC`.

source
FiniteElementContainers.DirichletBCMethod
struct DirichletBC{F} <: FiniteElementContainers.AbstractDirichletBC{F}
DirichletBC(
    var_name::String,
    func::Function;
    block_name,
    nodeset_name,
    sideset_name
) -> DirichletBC{F} where F<:Function
  • func::Any

  • block_name::Union{Nothing, Symbol}

  • nset_name::Union{Nothing, Symbol}

  • sset_name::Union{Nothing, Symbol}

  • var_name::Symbol

source
FiniteElementContainers.DirichletBCMethod
struct DirichletBC{F} <: FiniteElementContainers.AbstractDirichletBC{F}
DirichletBC(
    var_name::Symbol,
    func::Function;
    block_name,
    nodeset_name,
    sideset_name
) -> DirichletBC{F} where F<:Function
  • func::Any

  • block_name::Union{Nothing, Symbol}

  • nset_name::Union{Nothing, Symbol}

  • sset_name::Union{Nothing, Symbol}

  • var_name::Symbol

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

  • nodes::AbstractVector{<:Integer}

  • vals::AbstractVector{<:Number}

  • vals_dot::AbstractVector{<:Number}

  • vals_dot_dot::AbstractVector{<:Number}

Internal implementation of dirichlet BCs

source
FiniteElementContainers.DirichletBCContainerMethod
struct DirichletBCContainer{IV<:(AbstractVector{<:Integer}), RV<:(AbstractVector{<:Number})} <: FiniteElementContainers.AbstractBCContainer
DirichletBCContainer(
    mesh,
    dof::DofManager,
    dbc::DirichletBC
) -> FiniteElementContainers.DirichletBCContainer{Vector{Int64}, Vector{Float64}}
  • dofs::AbstractVector{<:Integer}

  • nodes::AbstractVector{<:Integer}

  • vals::AbstractVector{<:Number}

  • vals_dot::AbstractVector{<:Number}

  • vals_dot_dot::AbstractVector{<:Number}

source
FiniteElementContainers._update_bc_values!Method
_update_bc_values!(
    bc::FiniteElementContainers.DirichletBCContainer,
    func,
    X,
    t,
    backend::KernelAbstractions.Backend
)

GPU kernel wrapper for updating bc values based on the stored function

source
FiniteElementContainers._update_bc_values!Method
_update_bc_values!(
    bc::FiniteElementContainers.DirichletBCContainer,
    func,
    X,
    t,
    _::KernelAbstractions.CPU
)

CPU implementation for updating stored bc values based on the stored function

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, :sset_1, bc_func)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, :sset_1, bc_func)NeumannBC{typeof(Main.bc_func)}(Main.bc_func, :sset_1, :u)

where ND is the number of dimensions.

FiniteElementContainers.NeumannBCMethod
struct NeumannBC{F} <: FiniteElementContainers.AbstractBC{F}
NeumannBC(
    var_name::String,
    sset_name::String,
    func::Function
) -> NeumannBC{<:Function}
  • func::Any

  • sset_name::Symbol

  • var_name::Symbol

source
FiniteElementContainers.NeumannBCMethod
struct NeumannBC{F} <: FiniteElementContainers.AbstractBC{F}
NeumannBC(
    var_name::Symbol,
    sset_name::Symbol,
    func::Function
) -> NeumannBC{<:Function}
  • func::Any

  • sset_name::Symbol

  • var_name::Symbol

source
FiniteElementContainers.NeumannBCContainerType
struct NeumannBCContainer{IT<:Integer, IV<:AbstractArray{IT<:Integer, 1}, IM<:AbstractArray{IT<:Integer, 2}, RV<:(AbstractMatrix{<:Union{var"#s55", var"#s50"} where {var"#s55"<:Number, var"#s50"<:(StaticArraysCore.SVector)}}), C1, C2, RE<:ReferenceFiniteElements.ReferenceFE} <: FiniteElementContainers.AbstractBCContainer
  • element_conns::Any

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

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

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

  • surface_conns::Any

  • ref_fe::ReferenceFiniteElements.ReferenceFE

  • vals::AbstractMatrix{<:Union{var"#s55", var"#s50"} where {var"#s55"<:Number, var"#s50"<:(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.

Boundary Condition Implementation Details

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