Boundary Conditions

Abstract Types

There is currently only a loose set of abstract types to define BCs. TODO

Dirichlet BCs

Dirichlet BCs are defined in a general way where each DirichletBC acts on a collection of nodes and a collection of dof indices.

We can set up a Dirichlet BC in a script with syntax similar to the following

using Cthonios
bc = DirichletBC("nset", [1], (x, t) -> 0.0)

# output
DirichletBC:
  Node set = nset
  Dofs     = [1]
  Function = #1

In general, problems will have a collection of Dirichlet BCs which can be set up as follows

using Cthonios
dbcs = [
  DirichletBC("nset_1", [1, 2], (x, t) -> 0.0)
  DirichletBC("nset_2", [1], (x, t) -> 0.0)
  DirichletBC("nset_2", [2], (x, t) -> 1.0)
]

# output
3-element Vector{DirichletBC{String, Vector{Int64}}}:
 DirichletBC:
  Node set = nset_1
  Dofs     = [1, 2]
  Function = #1

 DirichletBC:
  Node set = nset_2
  Dofs     = [1]
  Function = #2

 DirichletBC:
  Node set = nset_2
  Dofs     = [2]
  Function = #3

Internally these types defined in a script will be converted to a new type DirichletBCInternal which will read quantities off of the input mesh. This allows for BC definition prior to mesh reading so error checking can be done more efficiently.

Cthonios.DirichletBCType
struct DirichletBC{N, D, F} <: Cthonios.AbstractBCInput
  • nset_name::Any

  • dofs::Any

  • func::Any

Base Dirichlet boundary condition type used for inputs either from a script or input file. nset_name corresponds to the name of the node set in the exodus file, dofs correspond to the indexed fields this bc is to be applied to, and func is the function to apply to the fields.

source
Cthonios.DirichletBCMethod
DirichletBC(
    inputs::Dict{Symbol, Any}
) -> DirichletBC{_A, _B, F} where {_A, _B, F<:RuntimeGeneratedFunctions.RuntimeGeneratedFunction}

Input file syntax

domain:
  dirichlet boundary conditions:
  - type: DirichletBC
    nodeset: nset_1
    function: (x, t) -> 0.0
  - type: DirichletBC
    nodeset: nset_2
    function: (x, t) -> 1.0
  ...
source
Cthonios.DirichletBCInternalType
struct DirichletBCInternal{N, D, F} <: Cthonios.AbstractBCInternal
  • nodes::Any

  • dofs::Any

  • func::Any

Base internal Dirichlet boundary condition used for internal purposes. nodes corresponds to the node ids this BC is to be applied to, dofs is the set of degrees of freedoms this bc is to be applied to, and func is the function to apply to a field on the dofs.

source
Cthonios.DirichletBCInternalMethod
DirichletBCInternal(
    mesh,
    bc::DirichletBC,
    n_dofs::Int64
) -> Cthonios.DirichletBCInternal{_A, Vector{Int64}} where _A

Constructor for internal Dirichlet boundary condition. mesh is the exodus mesh to read node sets from, bc is the DirichletBC input, and n_dofs is the total number of fields in the problem.

source
Cthonios.setup_bcsMethod
setup_bcs(
    _::Type{Cthonios.DirichletBCInternal},
    mesh,
    dbcs_in,
    n_dofs
) -> NamedTuple
source

Neumann BCs

Neumann BCs are nearly identical to Dirichlet BCs in terms of script inputs except these BCs do not require a set of dofs. One can define a NeumannBC as follows

using Cthonios
bc = NeumannBC("sset", (x, t) -> @SVector [0., 1.])

# output
NeumannBC:
  Side set = sset
  Function = #1

Collections of NeumannBCs follows identically to collections of DirichletBCs.

Cthonios.NeumannBCMethod
NeumannBC(
    inputs::Dict{Symbol, Any}
) -> NeumannBC{_A, F} where {_A, F<:RuntimeGeneratedFunctions.RuntimeGeneratedFunction}
source
Cthonios.NeumannBCInternalType
struct NeumannBCInternal{E, S, F} <: Cthonios.AbstractBCInternal
  • elements::Any

  • sides::Any

  • num_nodes_per_side::Any

  • side_nodes::Any

  • func::Any

source
Cthonios.setup_bcsMethod
setup_bcs(
    _::Type{Cthonios.NeumannBCInternal},
    mesh,
    nbcs_in,
    sections_in
) -> NamedTuple
source