FELiCS.Equation.UflDecorator#
Module Contents#
Classes#
Decorator for handling UFL (Unified Form Language) expressions. |
Attributes#
- FELiCS.Equation.UflDecorator.logger#
- class FELiCS.Equation.UflDecorator.UflDecorator(inputUfl=None)#
Decorator for handling UFL (Unified Form Language) expressions.
This class wraps and extends functionality for UFL expressions. It provides methods for symbolic manipulation, analysis, and assembling into finite element matrices, vectors, or scalars.
Initialize the UflDecorator object
- Parameters:
inputUfl (
ufl.FormorNone, optional) – Initial UFL expression to wrap. If None, the decorator starts without an expression.- Variables:
lhs (
ufl.Form) – The left-hand side form of the expression.rhs (
ufl.Form) – The right-hand side form of the expression.form (
ufl.Form) – The complete form from the expression.expression (
ufl.Form) – The underlying UFL expression.
Notes
Operator overloading is supported (+, +=, -, -=).
- property expression#
Return the current UFL expression.
- Returns:
The stored UFL expression.
- Return type:
ufl.Form
- property lhs#
Return the left-hand side of the UFL expression.
- Returns:
The left-hand side form of the expression.
- Return type:
ufl.Form
- property rhs#
Return the right-hand side of the UFL expression.
- Returns:
The right-hand side form of the expression.
- Return type:
ufl.Form
- property form#
Return the general form representation of the UFL expression.
- Returns:
The UFL form of the expression.
- Return type:
ufl.Form
- add(input_ufl)#
Add a UFL expression to the current expression.
- Parameters:
input_ufl (
ufl.Form) – The UFL expression to be added.
Notes
If no expression has been set yet, this initializes the expression.
- subtract(input_ufl)#
Subtract a UFL expression from the current expression.
- Parameters:
input_ufl (
ufl.Form) – The UFL expression to be subtracted.
Notes
If no expression has been set yet, this initializes the expression to the negative of the input.
- getAssembledMatrix(mesh, bcs=[])#
Assemble the left-hand side form into a matrix.
- Parameters:
mesh (
FELiCS.SpaceDisc.FELiCSMesh) – The mesh on which to assemble.bcs (
listofdolfinx.fem.dirichletbc.DirichletBC, optional) – List of boundary conditions to apply.
- Returns:
The assembled PETSc matrix.
- Return type:
petsc4py.PETSc.Mat
- getAssembledVector(mesh, bcs=[])#
Assemble the right-hand side form into a vector.
- Parameters:
mesh (
FELiCS.SpaceDisc.FELiCSMesh) – The mesh on which to assemble.bcs (
listofdolfinx.fem.dirichletbc.DirichletBC, optional) – List of boundary conditions to apply.
- Returns:
The assembled PETSc vector.
- Return type:
petsc4py.PETSc.Vec
- getAssembledScalar(mesh)#
Assemble the expression into a scalar.
- Parameters:
mesh (
FELiCS.SpaceDisc.FELiCSMesh) – The mesh on which to assemble.- Returns:
The scalar result of the assembly.
- Return type:
float
- lhsIsZero()#
Check whether the left-hand side of the expression is effectively zero.
- Returns:
True if lhs is zero or has insufficient arguments; otherwise, False.
- Return type:
bool
- rhsIsZero()#
Check whether the right-hand side of the expression is effectively zero.
- Returns:
True if rhs is zero or has insufficient arguments; otherwise, False.
- Return type:
bool
- isZero()#
Check whether the expression has been initialized.
- Returns:
True if the expression is not set; False otherwise.
- Return type:
bool
- printExpression()#
Print a summary of the current UFL expression.
Prints the expression, its arguments, and number of arguments.