Problem Description
The ProblemDescription
is the central object for defining finite element problems in a high-level, flexible, and modular way. It encodes the weak form of your PDE, including unknowns, operators, and boundary or interface conditions, usually without requiring discretization details at this stage, but region numbers (for boundary conditions, etc.) may be referenced.
ExtendableFEM.ProblemDescription
— Typemutable struct ProblemDescription
A structure representing a finite element problem description, including unknowns and operators.
Fields
name::String
: name of the problem (used in printouts and logs). Default:"My Problem"
.unknowns::Vector{Unknown}
: List of unknowns involved in the problem.operators::Vector{AbstractOperator}
: List of operators (e.g., bilinear forms, linear forms, boundary conditions) that define the problem.
Usage
Create a ProblemDescription
using the default constructor, then assign unknowns and operators using assign_unknown!
and assign_operator!
.
Constructors and Assignment Functions
Use the following functions to construct and modify a ProblemDescription
:
ExtendableFEM.assign_operator!
— Methodassign_operator!(
PD::ProblemDescription,
o::ExtendableFEM.AbstractOperator
) -> Int64
Adds an operator to a ProblemDescription
.
Arguments
PD::ProblemDescription
: The problem description to which the operator should be added.o::AbstractOperator
: The operator to add.
Returns
- The index (position) of the operator in the
operators
array ofPD
.
ExtendableFEM.assign_unknown!
— Methodassign_unknown!(PD::ProblemDescription, u::Unknown) -> Any
Add an Unknown
to a ProblemDescription
, if not already present.
Arguments
PD::ProblemDescription
: The problem description to which the unknown should be added.u::Unknown
: The unknown to add.
Returns
- The index (position) of the unknown in the
unknowns
array ofPD
.
Notes
- If the unknown is already present, a warning is issued and its existing position is returned.
ExtendableFEM.replace_operator!
— Methodreplace_operator!(
PD::ProblemDescription,
j,
o::ExtendableFEM.AbstractOperator
)
Replace an operator in a ProblemDescription
at a specified position.
Arguments
PD::ProblemDescription
: The problem description in which to replace the operator.j::Int
: The index (position) of the operator to replace.o::AbstractOperator
: The new operator to insert.
Unknowns
An Unknown
represents a physical quantity (e.g., velocity, pressure, temperature) in the ProblemDescription
. Unknowns are used to tag solution components and to specify which variables operators act on.
ExtendableFEM.Unknown
— Typemutable struct Unknown{IT}
A structure representing a problem "unknown" (e.g., a field variable) with associated metadata.
Fields
name::String
: name of the unknown (used in printouts and messages).identifier::IT
: identifier for operator assignment and indexing.parameters::Dict{Symbol, Any}
: Dictionary of additional properties (e.g., dimension, symbols for ansatz/test functions, ...).
Type Parameters
IT
: Type of the identifier (commonlySymbol
).
Usage
Create an Unknown
using the provided constructor, optionally specifying the name, identifier, and additional keyword arguments for parameters.
Example
u = Unknown("velocity"; dimension=2, symbol_ansatz="u", symbol_test="v")
ExtendableFEM.Unknown
— MethodUnknown(
u::String;
identifier,
name,
kwargs...
) -> Unknown{Symbol}
Construct an Unknown
representing a finite element field variable or problem unknown.
Arguments
u::String
: Name of the unknown.identifier
: (optional) Symbolic or integer identifier for operator assignment and indexing (default:Symbol(u)
).name
: (optional) name in printouts (default:u
).kwargs...
: Additional keyword arguments to set or override entries in theparameters
dictionary (see below).
Keyword Arguments
algebraic_constraint
: is this unknown an algebraic constraint?. Default: nothingdimension
: dimension of the unknown. Default: nothingsymbol_ansatz
: symbol for ansatz functions of this unknown in printouts. Default: nothingsymbol_test
: symbol for test functions of this unknown in printouts. Default: nothing
Example
```julia u = Unknown("velocity"; dimension=2, symbolansatz="u", symboltest="v")
Base.div
— Methoddiv(u)
alias for (u, Divergence)
ExtendableFEM.apply
— Methodapply(u, FO::Type{<:AbstractFunctionOperator})
alias for (u, FO)
ExtendableFEM.average
— Methodaverage(o:Tuple{Union{Unknown, Int}, StandardFunctionOperator})
alias for (o[1], Average{o[2]})
ExtendableFEM.curl1
— Methodcurl1(u)
alias for (u, CurlScalar)
ExtendableFEM.curl2
— Methodcurl2(u)
alias for (u, Curl2D)
ExtendableFEM.curl3
— Methodcurl3(u)
alias for (u, Curl3D)
ExtendableFEM.dofgrid
— Methoddofgrid(u)
alias for (u, "dofgrid") (triggers gridplot for the dofgrid in plot)
ExtendableFEM.grad
— Methodgrad(u)
alias for (u, Gradient)
ExtendableFEM.grid
— Methodgrid(u)
alias for (u, "grid") (triggers gridplot in plot)
ExtendableFEM.hessian
— Methodhessian(u)
alias for (u, Hessian)
ExtendableFEM.id
— Methodid(u, c::Int)
alias for (u, IdentityComponent{c})
ExtendableFEM.id
— Methodid(u)
alias for (u, Identity)
ExtendableFEM.jump
— Methodjump(o:Tuple{Union{Unknown, Int}, StandardFunctionOperator})
alias for (o[1], Jump{o[2]})
ExtendableFEM.laplace
— Methodlaplace(u)
alias for (u, Laplacian)
ExtendableFEM.normalflux
— Methodnormalflux(u)
alias for (u, NormalFlux)
ExtendableFEM.other
— Methodother(o:Tuple{Union{Unknown, Int}, StandardFunctionOperator})
alias for (o[1], Right{o[2]})
ExtendableFEM.symgrad_voigt
— Methodsymgrad_voigt(u, factor)
alias for (u, SymmetricGradient{factor}) in Voigt notation.
The factor
is a real number applied to the (summed) off-diagonal entries. In the current implementation in ExtendableFEMBase, factor = 0.5 represents the Voigt strain mapping [σ₁₁ σ₂₂ σ₃₃ σ₁₃ σ₂₃ σ₁₂], while factor = 1.0 represents the Voigt strain mapping [ε₁₁ ε₂₂ ε₃₃ 2ε₁₃ 2ε₂₃ 2ε₁₂].
ExtendableFEM.tangentialflux
— Methodtangentialflux(u)
alias for (u, TangentFlux)
ExtendableFEM.tangentialgrad
— Methodtangentialgrad(u)
alias for (u, TangentialGradient)
ExtendableFEM.this
— Methodthis(o:Tuple{Union{Unknown, Int}, StandardFunctionOperator})
alias for (o[1], Left{o[2]})
ExtendableFEM.Δ
— MethodΔ(u)
alias for (u, Laplacian)
ExtendableFEM.εV
— MethodεV(u, factor)
unicode alias for symgrad_voigt(u, factor)
.
Operators
Operators define how terms contribute to the system matrix or right-hand side. They can represent weak forms of differential operators, stabilization terms, constraints, or boundary conditions.
Types of Operators
The main operator classes are:
- NonlinearOperator (e.g., nonlinear convection in Navier–Stokes)
- BilinearOperator (e.g., Laplacian in Poisson)
- LinearOperator (e.g., right-hand side in Poisson or Navier–Stokes)
For boundary conditions or global constraints, use:
Entities and Regions
Each operator assembles on certain mesh entities. The default is cell-wise assembly, but this can be changed via the entities
keyword. Restrict assembly to subsets of entities using the regions
keyword.
Entities | Description |
---|---|
AT_NODES | Interpolate at mesh vertices (only for H1-conforming FEM) |
ON_CELLS | Assemble/interpolate on mesh cells |
ON_FACES | Assemble/interpolate on all mesh faces |
ON_IFACES | Assemble/interpolate on interior mesh faces |
ON_BFACES | Assemble/interpolate on boundary mesh faces |
ON_EDGES (*) | Assemble/interpolate on all mesh edges |
ON_BEDGES (*) | Assemble/interpolate on boundary mesh edges |
Function Operators
Function operators specify the mathematical operation to be applied to an unknown within an operator term. Each operator is defined as a pair of an Unknown
(or integer index) and a FunctionOperator
(such as Identity
, Gradient
, etc.), e.g., (u, Identity)
or (u, Gradient)
.
See the full list of function operators.
For convenience and readability, common operator pairs have short aliases:
id(u)
for(u, Identity)
grad(u)
for(u, Gradient)
div(u)
for(u, Divergence)
curl1(u)
for(u, CurlScalar)
curl2(u)
for(u, Curl2D)
curl3(u)
for(u, Curl3D)
laplace(u)
orΔ(u)
for(u, Laplacian)
hessian(u)
for(u, Hessian)
normalflux(u)
for(u, NormalFlux)
tangentialflux(u)
for(u, TangentFlux)
tangentialgrad(u)
for(u, TangentialGradient)
symgrad_voigt(u, factor)
for(u, SymmetricGradient{factor})
in Voigt notationεV(u, factor)
as a unicode alias forsymgrad_voigt(u, factor)
grid(u)
for(u, "grid")
(triggers gridplot in plot)dofgrid(u)
for(u, "dofgrid")
(triggers gridplot for the dofgrid in plot)apply(u, FO)
for(u, FO)
for any function operator type
Additional function operators for evaluating discontinuous quantities on faces (such as jump
, average
, this
, other
) are available.
For convenience, these discontinuous operator pairs also have short aliases:
jump((u, FO))
for(u, Jump{FO})
(jump across a face)average((u, FO))
for(u, Average{FO})
(average across a face)this((u, FO))
for(u, Left{FO})
(value on the left side of a face)other((u, FO))
for(u, Right{FO})
(value on the right side of a face)
Here, FO
can be any standard function operator (e.g., Identity
, Gradient
, etc.). Of course, also something like jump(id(u))
or jump(grad(u))
works.