External loading
In many simulations, there is a need to add contributions to the weak form in the form of external loads, either as source terms/body loads, or as non-zero Neumann boundary conditions. FerriteAssembly provides a LoadHandler for this purpose, such that it is not necessary to implement those terms into the specific elements directly. This avoid having to pass information to the elements about changes to the load levels etc.
FerriteAssembly.LoadHandler — TypeLoadHandler(dh::AbstractDofHandler)Create a load handler for external loads to be applied on the finite element simulation defined by a dofhandler dh. It can be used to apply the Neumann and body load contributions to the external "force"-vector, fext:
fext = zeros(ndofs(dh))
lh=LoadHandler(dh)
add!(lh, Neumann(...)) # Add Neumann boundary conditions
add!(lh, BodyLoad(...)) # Add body load
for t in timesteps
fill!(fext, 0)
apply!(fext, lh, t) # Add contributions to `fext`
...
endFerriteAssembly.Neumann — TypeNeumann(field_name::Symbol, fv_info::Union{FaceValues,QuadratureRule,Int}, faceset::Set{FaceIndex}, f)Define a Neumann contribution with the weak forms according to
\[\int_{\Gamma} f \ \delta u \ \mathrm{d}\Gamma, \quad \text{Scalar fields} \\ \int_{\Gamma} \boldsymbol{f} \cdot \boldsymbol{\delta u} \ \mathrm{d}\Gamma, \quad \text{Vector fields} \]
where $\Gamma$ is the boundary where the contribution is active. $f$, or $\boldsymbol{f}$, is the prescribed Neumann value, defined by a function with signatures
f(x::Vec, t::Real, n::Vec) -> Number (Scalar field)
f(x::Vec, t::Real, n::Vec) -> Vec{dim} (Vector field)
where x is the spatial position of the current quadrature point, t is the current time, and n is the face normal vector. The remaining input arguments are
fieldnamedescribes the field on which the boundary condition should abstractfv_infogives required input to determine the facevalues. The following input types are accepted:Intgiving the integration order to use.FaceValuesare deduced from the interpolation offieldnameand the output off.QuadratureRulematching the interpolation forfieldnamefor faces infacesetFaceValuesare deduced from the output offFaceValuesmatching the interpolation forfieldnamefor the faces infacesetand output off
facesetdescribes which faces the BC is applied to
FerriteAssembly.BodyLoad — TypeBodyLoad(field_name::Symbol, cv_info::Union{CellValues,QuadratureRule,Int}, cellset::Set{Int}, f)
BodyLoad(field_name::Symbol, cv_info::Union{CellValues,QuadratureRule,Int}, f)Define a body load contribution with the weak forms according to
\[\int_{\Omega} f \ \delta u \ \mathrm{d}\Omega, \quad \text{Scalar fields} \\ \int_{\Omega} \boldsymbol{f} \cdot \boldsymbol{\delta u} \ \mathrm{d}\Omega, \quad \text{Vector fields} \]
where $\Omega$ is the region where the contribution is active. $f$, or $\boldsymbol{f}$, is the prescribed volumetric contribution (e.g. force/volume), defined by a function with signatures
f(x::Vec, t::Real) -> Number (Scalar field)
f(x::Vec, t::Real) -> Vec{dim} (Vector field)
where x is the spatial position of the current quadrature point and t is the current time. The remaining input arguments are
fieldnamedescribes the field on which the load should actcv_infogives required input to determine the cellvalues. The following input types are accepted:Intgiving the integration order to use.CellValuesare deduced from the interpolation offieldnameand the output off.QuadratureRulematching the interpolation forfieldnamefor cells incellset.CellValuesare deduced from the output offCellValuesmatching the interpolation forfieldnamefor the cells incellsetand output off
cellsetdescribes which cells the load is applied to. If not given, the load is applied to all cells