Boundary Conditions
Abstract Types
There is currently only a loose set of abstract types to define BCs. TODO
Cthonios.AbstractBCInput — Typeabstract type AbstractBCInputCthonios.AbstractBCInternal — Typeabstract type AbstractBCInternalDirichlet 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 = #1In 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.DirichletBC — Typestruct DirichletBC{N, D, F} <: Cthonios.AbstractBCInputnset_name::Anydofs::Anyfunc::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.
Cthonios.DirichletBC — MethodDirichletBC(
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
...Cthonios.DirichletBCInternal — Typestruct DirichletBCInternal{N, D, F} <: Cthonios.AbstractBCInternalnodes::Anydofs::Anyfunc::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.
Cthonios.DirichletBCInternal — MethodDirichletBCInternal(
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.
Cthonios.setup_bcs — Methodsetup_bcs(
_::Type{Cthonios.DirichletBCInternal},
mesh,
dbcs_in,
n_dofs
) -> NamedTuple
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 = #1Collections of NeumannBCs follows identically to collections of DirichletBCs.
Cthonios.NeumannBC — Typestruct NeumannBC{S, F} <: Cthonios.AbstractBCInputsset_name::Anyfunc::Any
Cthonios.NeumannBC — MethodNeumannBC(
inputs::Dict{Symbol, Any}
) -> NeumannBC{_A, F} where {_A, F<:RuntimeGeneratedFunctions.RuntimeGeneratedFunction}
Cthonios.NeumannBCInternal — Typestruct NeumannBCInternal{E, S, F} <: Cthonios.AbstractBCInternalelements::Anysides::Anynum_nodes_per_side::Anyside_nodes::Anyfunc::Any
Cthonios.NeumannBCInternal — MethodNeumannBCInternal(
mesh,
bc::NeumannBC
) -> Cthonios.NeumannBCInternal
Cthonios.setup_bcs — Methodsetup_bcs(
_::Type{Cthonios.NeumannBCInternal},
mesh,
nbcs_in,
sections_in
) -> NamedTuple