UFL-manipulation utilities#

Custom UFL operations for handling average operations on arguments.

TODO: Average operations on coefficients.

class fenicsx_ii.ufl_operations.Average(u: Argument, restriction_operator, restriction_space)[source]#

Averaging operator.

Parameters:
  • u – Argument to be averaged.

  • restriction_operator – Operator that restricts from the parent space to the averaged space.

  • restriction_space – Function space on the new mesh.

class fenicsx_ii.ufl_operations.DomainReplacer(new_domain: Mesh, compress: bool | None = True, visited_cache: dict[tuple, Expr] | None = None, result_cache: dict[Expr, Expr] | None = None)[source]#

Replace domain in ufl.SpatialCoordinate and dolfinx.fem.Constant with a user provided dolfinx.mesh.Mesh.

Note

The geometrical dimension of the new mesh must be the same as the original mesh.

process(o: Expr) Expr[source]#
process(o: Constant) Expr
process(o: SpatialCoordinate) Expr
process(o: Argument) Expr

Replace constants defined on a different mesh.

Parameters:

oufl.core.expr.Expr to be processed.

fenicsx_ii.ufl_operations.apply_replacer(form: Form) list[Form][source]#

Replace averaged arguments with intermediate space.

Parameters:

expr – UFL expression.

fenicsx_ii.ufl_operations.get_replaced_argument_indices(form: Form) list[int][source]#

Check if a form has a replaced argument.