# ufl package

## Subpackages

- ufl.algorithms package
  - Submodules
  - ufl.algorithms.ad module
    - `expand_derivatives()`
  - ufl.algorithms.analysis module
    - `extract_arguments()`
    - `extract_base_form_operators()`
    - `extract_coefficients()`
    - `extract_constants()`
    - `extract_elements()`
    - `extract_sub_elements()`
    - `extract_terminals_with_domain()`
    - `extract_type()`
    - `extract_unique_elements()`
    - `has_exact_type()`
    - `has_type()`
    - `sort_elements()`
    - `unique_tuple()`
  - ufl.algorithms.apply_algebra_lowering module
    - `LowerCompoundAlgebra`
      - `LowerCompoundAlgebra.cofactor()`
      - `LowerCompoundAlgebra.cross()`
      - `LowerCompoundAlgebra.curl()`
      - `LowerCompoundAlgebra.determinant()`
      - `LowerCompoundAlgebra.deviatoric()`
      - `LowerCompoundAlgebra.div()`
      - `LowerCompoundAlgebra.dot()`
      - `LowerCompoundAlgebra.inner()`
      - `LowerCompoundAlgebra.inverse()`
      - `LowerCompoundAlgebra.nabla_div()`
      - `LowerCompoundAlgebra.nabla_grad()`
      - `LowerCompoundAlgebra.outer()`
      - `LowerCompoundAlgebra.perp()`
      - `LowerCompoundAlgebra.skew()`
      - `LowerCompoundAlgebra.sym()`
      - `LowerCompoundAlgebra.trace()`
      - `LowerCompoundAlgebra.transposed()`
      - `LowerCompoundAlgebra.ufl_type()`
    - `apply_algebra_lowering()`
  - ufl.algorithms.apply_coefficient_split module
    - `CoefficientSplitter`
      - `CoefficientSplitter.process()`
    - `apply_coefficient_split()`
  - ufl.algorithms.apply_derivatives module
    - `BaseFormOperatorDerivativeRecorder`
    - `BaseFormOperatorDerivativeRuleset`
      - `BaseFormOperatorDerivativeRuleset.external_operator()`
      - `BaseFormOperatorDerivativeRuleset.pending_operations_recording()`
      - `BaseFormOperatorDerivativeRuleset.process()`
    - `CoordinateDerivativeRuleDispatcher`
      - `CoordinateDerivativeRuleDispatcher.process()`
    - `CoordinateDerivativeRuleset`
      - `CoordinateDerivativeRuleset.process()`
    - `DerivativeRuleDispatcher`
      - `DerivativeRuleDispatcher.process()`
    - `GateauxDerivativeRuleset`
      - `GateauxDerivativeRuleset.process()`
    - `GenericDerivativeRuleset`
      - `GenericDerivativeRuleset.independent_operator()`
      - `GenericDerivativeRuleset.independent_terminal()`
      - `GenericDerivativeRuleset.non_differentiable_terminal()`
      - `GenericDerivativeRuleset.override()`
      - `GenericDerivativeRuleset.process()`
      - `GenericDerivativeRuleset.unexpected()`
    - `GradRuleset`
      - `GradRuleset.process()`
    - `ReferenceGradRuleset`
      - `ReferenceGradRuleset.process()`
    - `VariableRuleset`
      - `VariableRuleset.process()`
    - `apply_coordinate_derivatives()`
    - `apply_derivatives()`
    - `flatten_domain_element()`
    - `grad_to_reference_grad()`
  - ufl.algorithms.apply_function_pullbacks module
    - `FunctionPullbackApplier`
      - `FunctionPullbackApplier.expr()`
      - `FunctionPullbackApplier.form_argument()`
      - `FunctionPullbackApplier.terminal()`
    - `apply_function_pullbacks()`
  - ufl.algorithms.apply_geometry_lowering module
    - `GeometryLoweringApplier`
      - `GeometryLoweringApplier.cell_coordinate()`
      - `GeometryLoweringApplier.cell_diameter()`
      - `GeometryLoweringApplier.cell_normal()`
      - `GeometryLoweringApplier.cell_volume()`
      - `GeometryLoweringApplier.circumradius()`
      - `GeometryLoweringApplier.expr()`
      - `GeometryLoweringApplier.facet_area()`
      - `GeometryLoweringApplier.facet_cell_coordinate()`
      - `GeometryLoweringApplier.facet_jacobian()`
      - `GeometryLoweringApplier.facet_jacobian_determinant()`
      - `GeometryLoweringApplier.facet_jacobian_inverse()`
      - `GeometryLoweringApplier.facet_normal()`
      - `GeometryLoweringApplier.jacobian()`
      - `GeometryLoweringApplier.jacobian_determinant()`
      - `GeometryLoweringApplier.jacobian_inverse()`
      - `GeometryLoweringApplier.max_cell_edge_length()`
      - `GeometryLoweringApplier.max_facet_edge_length()`
      - `GeometryLoweringApplier.min_cell_edge_length()`
      - `GeometryLoweringApplier.min_facet_edge_length()`
      - `GeometryLoweringApplier.ridge_jacobian()`
      - `GeometryLoweringApplier.ridge_jacobian_determinant()`
      - `GeometryLoweringApplier.ridge_jacobian_inverse()`
      - `GeometryLoweringApplier.spatial_coordinate()`
      - `GeometryLoweringApplier.terminal()`
    - `apply_geometry_lowering()`
  - ufl.algorithms.apply_integral_scaling module
    - `apply_integral_scaling()`
    - `compute_integrand_scaling_factor()`
  - ufl.algorithms.apply_restrictions module
    - `RestrictionPropagator`
      - `RestrictionPropagator.argument()`
      - `RestrictionPropagator.coefficient()`
      - `RestrictionPropagator.constant()`
      - `RestrictionPropagator.constant_value()`
      - `RestrictionPropagator.facet_area()`
      - `RestrictionPropagator.facet_coordinate()`
      - `RestrictionPropagator.facet_jacobian()`
      - `RestrictionPropagator.facet_jacobian_determinant()`
      - `RestrictionPropagator.facet_jacobian_inverse()`
      - `RestrictionPropagator.facet_normal()`
      - `RestrictionPropagator.facet_origin()`
      - `RestrictionPropagator.geometric_cell_quantity()`
      - `RestrictionPropagator.geometric_facet_quantity()`
      - `RestrictionPropagator.grad()`
      - `RestrictionPropagator.label()`
      - `RestrictionPropagator.max_facet_edge_length()`
      - `RestrictionPropagator.min_facet_edge_length()`
      - `RestrictionPropagator.multi_index()`
      - `RestrictionPropagator.operator()`
      - `RestrictionPropagator.quadrature_weight()`
      - `RestrictionPropagator.reference_cell_volume()`
      - `RestrictionPropagator.reference_facet_volume()`
      - `RestrictionPropagator.reference_value()`
      - `RestrictionPropagator.restricted()`
      - `RestrictionPropagator.spatial_coordinate()`
      - `RestrictionPropagator.terminal()`
      - `RestrictionPropagator.variable()`
    - `apply_restrictions()`
  - ufl.algorithms.balancing module
    - `BalanceModifiers`
      - `BalanceModifiers.cell_avg()`
      - `BalanceModifiers.expr()`
      - `BalanceModifiers.facet_avg()`
      - `BalanceModifiers.grad()`
      - `BalanceModifiers.negative_restricted()`
      - `BalanceModifiers.positive_restricted()`
      - `BalanceModifiers.reference_grad()`
      - `BalanceModifiers.reference_value()`
      - `BalanceModifiers.terminal()`
    - `balance_modified_terminal()`
    - `balance_modifiers()`
  - ufl.algorithms.change_to_reference module
    - `ChangeToReferenceGrad`
      - `ChangeToReferenceGrad.coefficient_derivative()`
      - `ChangeToReferenceGrad.expr()`
      - `ChangeToReferenceGrad.grad()`
      - `ChangeToReferenceGrad.reference_grad()`
      - `ChangeToReferenceGrad.terminal()`
    - `change_integrand_geometry_representation()`
    - `change_to_reference_grad()`
  - ufl.algorithms.check_arities module
    - `ArityChecker`
      - `ArityChecker.argument()`
      - `ArityChecker.cell_avg()`
      - `ArityChecker.component_tensor()`
      - `ArityChecker.conditional()`
      - `ArityChecker.conj()`
      - `ArityChecker.division()`
      - `ArityChecker.dot()`
      - `ArityChecker.expr()`
      - `ArityChecker.facet_avg()`
      - `ArityChecker.grad()`
      - `ArityChecker.index_sum()`
      - `ArityChecker.indexed()`
      - `ArityChecker.inner()`
      - `ArityChecker.linear_indexed_type()`
      - `ArityChecker.linear_operator()`
      - `ArityChecker.list_tensor()`
      - `ArityChecker.negative_restricted()`
      - `ArityChecker.nonlinear_operator()`
      - `ArityChecker.outer()`
      - `ArityChecker.positive_restricted()`
      - `ArityChecker.product()`
      - `ArityChecker.reference_grad()`
      - `ArityChecker.reference_value()`
      - `ArityChecker.sum()`
      - `ArityChecker.terminal()`
      - `ArityChecker.variable()`
    - `ArityMismatch`
    - `check_form_arity()`
    - `check_integrand_arity()`
  - ufl.algorithms.check_restrictions module
    - `RestrictionChecker`
      - `RestrictionChecker.expr()`
      - `RestrictionChecker.facet_normal()`
      - `RestrictionChecker.form_argument()`
      - `RestrictionChecker.restricted()`
    - `check_restrictions()`
  - ufl.algorithms.checks module
    - `validate_form()`
  - ufl.algorithms.comparison_checker module
    - `CheckComparisons`
      - `CheckComparisons.abs()`
      - `CheckComparisons.compare()`
      - `CheckComparisons.expr()`
      - `CheckComparisons.ge()`
      - `CheckComparisons.gt()`
      - `CheckComparisons.imag()`
      - `CheckComparisons.indexed()`
      - `CheckComparisons.le()`
      - `CheckComparisons.lt()`
      - `CheckComparisons.max_value()`
      - `CheckComparisons.min_value()`
      - `CheckComparisons.power()`
      - `CheckComparisons.real()`
      - `CheckComparisons.sign()`
      - `CheckComparisons.sqrt()`
      - `CheckComparisons.terminal()`
    - `ComplexComparisonError`
    - `do_comparison_check()`
  - ufl.algorithms.compute_form_data module
    - `attach_estimated_degrees()`
    - `compute_form_data()`
    - `preprocess_form()`
  - ufl.algorithms.coordinate_derivative_helpers module
    - `CoordinateDerivativeIsOutermostChecker`
      - `CoordinateDerivativeIsOutermostChecker.coordinate_derivative()`
      - `CoordinateDerivativeIsOutermostChecker.expr()`
      - `CoordinateDerivativeIsOutermostChecker.multi_index()`
      - `CoordinateDerivativeIsOutermostChecker.terminal()`
    - `attach_coordinate_derivatives()`
    - `strip_coordinate_derivatives()`
  - ufl.algorithms.domain_analysis module
    - `ExprTupleKey`
      - `ExprTupleKey.x`
    - `IntegralData`
      - `IntegralData.domain`
      - `IntegralData.enabled_coefficients`
      - `IntegralData.integral_coefficients`
      - `IntegralData.integral_type`
      - `IntegralData.integrals`
      - `IntegralData.metadata`
      - `IntegralData.subdomain_id`
    - `accumulate_integrands_with_same_metadata()`
    - `build_integral_data()`
    - `group_form_integrals()`
    - `group_integrals_by_domain_and_type()`
    - `integral_subdomain_ids()`
    - `rearrange_integrals_by_single_subdomains()`
    - `reconstruct_form_from_integral_data()`
  - ufl.algorithms.estimate_degrees module
    - `SumDegreeEstimator`
      - `SumDegreeEstimator.abs()`
      - `SumDegreeEstimator.argument()`
      - `SumDegreeEstimator.atan2()`
      - `SumDegreeEstimator.bessel_function()`
      - `SumDegreeEstimator.cell_avg()`
      - `SumDegreeEstimator.cell_coordinate()`
      - `SumDegreeEstimator.coefficient()`
      - `SumDegreeEstimator.cofactor()`
      - `SumDegreeEstimator.component_tensor()`
      - `SumDegreeEstimator.compound_derivative()`
      - `SumDegreeEstimator.compound_tensor_operator()`
      - `SumDegreeEstimator.condition()`
      - `SumDegreeEstimator.conditional()`
      - `SumDegreeEstimator.conj()`
      - `SumDegreeEstimator.constant()`
      - `SumDegreeEstimator.constant_value()`
      - `SumDegreeEstimator.coordinate_derivative()`
      - `SumDegreeEstimator.cross()`
      - `SumDegreeEstimator.curl()`
      - `SumDegreeEstimator.derivative()`
      - `SumDegreeEstimator.determinant()`
      - `SumDegreeEstimator.deviatoric()`
      - `SumDegreeEstimator.div()`
      - `SumDegreeEstimator.division()`
      - `SumDegreeEstimator.dot()`
      - `SumDegreeEstimator.expr()`
      - `SumDegreeEstimator.expr_list()`
      - `SumDegreeEstimator.expr_mapping()`
      - `SumDegreeEstimator.facet_avg()`
      - `SumDegreeEstimator.geometric_quantity()`
      - `SumDegreeEstimator.grad()`
      - `SumDegreeEstimator.imag()`
      - `SumDegreeEstimator.index_sum()`
      - `SumDegreeEstimator.indexed()`
      - `SumDegreeEstimator.inner()`
      - `SumDegreeEstimator.inverse()`
      - `SumDegreeEstimator.label()`
      - `SumDegreeEstimator.list_tensor()`
      - `SumDegreeEstimator.math_function()`
      - `SumDegreeEstimator.max_value()`
      - `SumDegreeEstimator.min_value()`
      - `SumDegreeEstimator.multi_index()`
      - `SumDegreeEstimator.nabla_div()`
      - `SumDegreeEstimator.nabla_grad()`
      - `SumDegreeEstimator.negative_restricted()`
      - `SumDegreeEstimator.outer()`
      - `SumDegreeEstimator.positive_restricted()`
      - `SumDegreeEstimator.power()`
      - `SumDegreeEstimator.product()`
      - `SumDegreeEstimator.real()`
      - `SumDegreeEstimator.reference_curl()`
      - `SumDegreeEstimator.reference_div()`
      - `SumDegreeEstimator.reference_grad()`
      - `SumDegreeEstimator.reference_value()`
      - `SumDegreeEstimator.skew()`
      - `SumDegreeEstimator.spatial_coordinate()`
      - `SumDegreeEstimator.sum()`
      - `SumDegreeEstimator.sym()`
      - `SumDegreeEstimator.trace()`
      - `SumDegreeEstimator.transposed()`
      - `SumDegreeEstimator.variable()`
      - `SumDegreeEstimator.variable_derivative()`
    - `estimate_total_polynomial_degree()`
  - ufl.algorithms.expand_indices module
    - `IndexExpander`
      - `IndexExpander.component()`
      - `IndexExpander.component_tensor()`
      - `IndexExpander.conditional()`
      - `IndexExpander.division()`
      - `IndexExpander.form_argument()`
      - `IndexExpander.grad()`
      - `IndexExpander.index_sum()`
      - `IndexExpander.indexed()`
      - `IndexExpander.list_tensor()`
      - `IndexExpander.multi_index()`
      - `IndexExpander.scalar_value()`
      - `IndexExpander.terminal()`
      - `IndexExpander.zero()`
    - `expand_indices()`
  - ufl.algorithms.formdata module
    - `FormData`
  - ufl.algorithms.formfiles module
    - `FileData`
    - `execute_ufl_code()`
    - `interpret_ufl_namespace()`
    - `load_forms()`
    - `load_ufl_file()`
    - `read_lines_decoded()`
    - `read_ufl_file()`
  - ufl.algorithms.formsplitter module
    - `FormSplitter`
      - `FormSplitter.argument()`
      - `FormSplitter.expr()`
      - `FormSplitter.indexed()`
      - `FormSplitter.multi_index()`
      - `FormSplitter.restricted()`
      - `FormSplitter.split()`
    - `extract_blocks()`
  - ufl.algorithms.formtransformations module
    - `PartExtracter`
      - `PartExtracter.argument()`
      - `PartExtracter.cell_avg()`
      - `PartExtracter.component_tensor()`
      - `PartExtracter.conj()`
      - `PartExtracter.division()`
      - `PartExtracter.dot()`
      - `PartExtracter.expr()`
      - `PartExtracter.facet_avg()`
      - `PartExtracter.grad()`
      - `PartExtracter.imag()`
      - `PartExtracter.index_sum()`
      - `PartExtracter.indexed()`
      - `PartExtracter.inner()`
      - `PartExtracter.linear_indexed_type()`
      - `PartExtracter.linear_operator()`
      - `PartExtracter.list_tensor()`
      - `PartExtracter.negative_restricted()`
      - `PartExtracter.outer()`
      - `PartExtracter.positive_restricted()`
      - `PartExtracter.product()`
      - `PartExtracter.real()`
      - `PartExtracter.sum()`
      - `PartExtracter.terminal()`
      - `PartExtracter.variable()`
    - `compute_energy_norm()`
    - `compute_form_action()`
    - `compute_form_adjoint()`
    - `compute_form_arities()`
    - `compute_form_functional()`
    - `compute_form_lhs()`
    - `compute_form_rhs()`
    - `compute_form_with_arity()`
    - `zero_expr()`
  - ufl.algorithms.map_integrands module
    - `map_integrand_dags()`
    - `map_integrands()`
  - ufl.algorithms.remove_complex_nodes module
    - `ComplexNodeRemoval`
      - `ComplexNodeRemoval.conj()`
      - `ComplexNodeRemoval.expr()`
      - `ComplexNodeRemoval.imag()`
      - `ComplexNodeRemoval.real()`
      - `ComplexNodeRemoval.terminal()`
    - `remove_complex_nodes()`
  - ufl.algorithms.remove_component_tensors module
    - `IndexRemover`
      - `IndexRemover.expr()`
      - `IndexRemover.indexed()`
    - `IndexReplacer`
      - `IndexReplacer.expr()`
      - `IndexReplacer.multi_index()`
      - `IndexReplacer.zero()`
    - `remove_component_tensors()`
  - ufl.algorithms.renumbering module
    - `IndexRelabeller`
      - `IndexRelabeller.expr()`
      - `IndexRelabeller.multi_index()`
      - `IndexRelabeller.zero()`
    - `renumber_indices()`
  - ufl.algorithms.replace module
    - `Replacer`
      - `Replacer.coefficient_derivative()`
      - `Replacer.external_operator()`
      - `Replacer.interpolate()`
      - `Replacer.ufl_type()`
    - `replace()`
  - ufl.algorithms.replace_derivative_nodes module
    - `DerivativeNodeReplacer`
      - `DerivativeNodeReplacer.coefficient_derivative()`
      - `DerivativeNodeReplacer.ufl_type()`
    - `replace_derivative_nodes()`
  - ufl.algorithms.signature module
    - `compute_expression_hashdata()`
    - `compute_expression_signature()`
    - `compute_form_signature()`
    - `compute_multiindex_hashdata()`
    - `compute_terminal_hashdata()`
  - ufl.algorithms.strip_terminal_data module
    - `TerminalStripper`
      - `TerminalStripper.argument()`
      - `TerminalStripper.coefficient()`
      - `TerminalStripper.constant()`
      - `TerminalStripper.expr()`
    - `replace_terminal_data()`
    - `strip_domain()`
    - `strip_function_space()`
    - `strip_terminal_data()`
  - ufl.algorithms.transformer module
    - `CopyTransformer`
      - `CopyTransformer.expr()`
      - `CopyTransformer.terminal()`
      - `CopyTransformer.variable()`
    - `ReuseTransformer`
      - `ReuseTransformer.expr()`
      - `ReuseTransformer.terminal()`
      - `ReuseTransformer.variable()`
    - `Transformer`
      - `Transformer.always_reconstruct()`
      - `Transformer.print_visit_stack()`
      - `Transformer.reconstruct_variable()`
      - `Transformer.reuse()`
      - `Transformer.reuse_if_possible()`
      - `Transformer.reuse_if_untouched()`
      - `Transformer.reuse_variable()`
      - `Transformer.terminal()`
      - `Transformer.ufl_type()`
      - `Transformer.undefined()`
      - `Transformer.visit()`
    - `VariableStripper`
      - `VariableStripper.variable()`
    - `apply_transformer()`
    - `is_post_handler()`
    - `strip_variables()`
  - ufl.algorithms.traversal module
    - `iter_expressions()`
  - Module contents
    - `FormSplitter`
      - `FormSplitter.argument()`
      - `FormSplitter.expr()`
      - `FormSplitter.indexed()`
      - `FormSplitter.multi_index()`
      - `FormSplitter.restricted()`
      - `FormSplitter.split()`
    - `MultiFunction`
      - `MultiFunction.reuse_if_untouched()`
      - `MultiFunction.ufl_type()`
      - `MultiFunction.undefined()`
    - `ReuseTransformer`
      - `ReuseTransformer.expr()`
      - `ReuseTransformer.terminal()`
      - `ReuseTransformer.variable()`
    - `Transformer`
      - `Transformer.always_reconstruct()`
      - `Transformer.print_visit_stack()`
      - `Transformer.reconstruct_variable()`
      - `Transformer.reuse()`
      - `Transformer.reuse_if_possible()`
      - `Transformer.reuse_if_untouched()`
      - `Transformer.reuse_variable()`
      - `Transformer.terminal()`
      - `Transformer.ufl_type()`
      - `Transformer.undefined()`
      - `Transformer.visit()`
    - `apply_transformer()`
    - `change_to_reference_grad()`
    - `compute_energy_norm()`
    - `compute_form_action()`
    - `compute_form_adjoint()`
    - `compute_form_arities()`
    - `compute_form_data()`
    - `compute_form_functional()`
    - `compute_form_lhs()`
    - `compute_form_rhs()`
    - `compute_form_signature()`
    - `estimate_total_polynomial_degree()`
    - `expand_derivatives()`
    - `expand_indices()`
    - `extract_arguments()`
    - `extract_base_form_operators()`
    - `extract_coefficients()`
    - `extract_elements()`
    - `extract_sub_elements()`
    - `extract_type()`
    - `extract_unique_elements()`
    - `load_forms()`
    - `load_ufl_file()`
    - `post_traversal()`
    - `preprocess_form()`
    - `read_ufl_file()`
    - `replace()`
    - `replace_terminal_data()`
    - `sort_elements()`
    - `strip_terminal_data()`
    - `strip_variables()`
    - `tree_format()`
    - `validate_form()`
- ufl.core package
  - Submodules
  - ufl.core.base_form_operator module
    - `BaseFormOperator`
      - `BaseFormOperator.argument_slots()`
      - `BaseFormOperator.coefficients()`
      - `BaseFormOperator.count()`
      - `BaseFormOperator.ufl_free_indices`
      - `BaseFormOperator.ufl_function_space()`
      - `BaseFormOperator.ufl_index_dimensions`
      - `BaseFormOperator.ufl_operands`
      - `BaseFormOperator.ufl_shape`
  - ufl.core.compute_expr_hash module
    - `compute_expr_hash()`
  - ufl.core.expr module
    - `Expr`
      - `Expr.T`
      - `Expr.dx()`
      - `Expr.evaluate()`
      - `Expr.ufl_disable_profiling()`
      - `Expr.ufl_domain()`
      - `Expr.ufl_domains()`
      - `Expr.ufl_enable_profiling()`
    - `ufl_err_str()`
  - ufl.core.external_operator module
    - `ExternalOperator`
      - `ExternalOperator.assemble()`
      - `ExternalOperator.grad()`
      - `ExternalOperator.ufl_element()`
      - `ExternalOperator.ufl_operands`
  - ufl.core.interpolate module
    - `Interpolate`
      - `Interpolate.ufl_operands`
    - `interpolate()`
  - ufl.core.multiindex module
    - `FixedIndex`
    - `Index`
    - `IndexBase`
    - `MultiIndex`
      - `MultiIndex.evaluate()`
      - `MultiIndex.indices()`
      - `MultiIndex.is_cellwise_constant()`
      - `MultiIndex.ufl_domains()`
      - `MultiIndex.ufl_free_indices`
      - `MultiIndex.ufl_index_dimensions`
      - `MultiIndex.ufl_shape`
    - `indices()`
  - ufl.core.operator module
    - `Operator`
      - `Operator.ufl_free_indices`
      - `Operator.ufl_operands`
      - `Operator.ufl_shape`
  - ufl.core.terminal module
    - `FormArgument`
      - `FormArgument.ufl_shape`
    - `Terminal`
      - `Terminal.evaluate()`
      - `Terminal.ufl_domains()`
      - `Terminal.ufl_free_indices`
      - `Terminal.ufl_index_dimensions`
      - `Terminal.ufl_operands`
      - `Terminal.ufl_shape`
  - ufl.core.ufl_id module
    - `attach_ufl_id()`
  - ufl.core.ufl_type module
    - `UFLObject`
    - `UFLType`
    - `attach_implementations_of_indexing_interface()`
    - `check_abstract_trait_consistency()`
    - `check_has_slots()`
    - `check_implements_required_methods()`
    - `check_implements_required_properties()`
    - `check_is_terminal_consistency()`
    - `check_type_traits_consistency()`
    - `determine_num_ops()`
    - `get_base_attr()`
    - `set_trait()`
    - `ufl_type()`
    - `update_global_expr_attributes()`
    - `update_ufl_type_attributes()`
  - Module contents
- ufl.corealg package
  - Submodules
  - ufl.corealg.dag_traverser module
    - `DAGTraverser`
      - `DAGTraverser.postorder()`
      - `DAGTraverser.postorder_only_children()`
      - `DAGTraverser.process()`
      - `DAGTraverser.reuse_if_untouched()`
  - ufl.corealg.map_dag module
    - `map_expr_dag()`
    - `map_expr_dags()`
  - ufl.corealg.multifunction module
    - `MultiFunction`
      - `MultiFunction.reuse_if_untouched()`
      - `MultiFunction.ufl_type()`
      - `MultiFunction.undefined()`
    - `get_num_args()`
    - `memoized_handler()`
  - ufl.corealg.traversal module
    - `cutoff_post_traversal()`
    - `cutoff_unique_post_traversal()`
    - `post_traversal()`
    - `pre_traversal()`
    - `traverse_terminals()`
    - `traverse_unique_terminals()`
    - `unique_post_traversal()`
    - `unique_pre_traversal()`
  - Module contents
- ufl.formatting package
  - Submodules
  - ufl.formatting.ufl2unicode module
    - `Expression2UnicodeHandler`
      - `Expression2UnicodeHandler.abs()`
      - `Expression2UnicodeHandler.action()`
      - `Expression2UnicodeHandler.and_condition()`
      - `Expression2UnicodeHandler.argument()`
      - `Expression2UnicodeHandler.atan2()`
      - `Expression2UnicodeHandler.base_form_operator()`
      - `Expression2UnicodeHandler.bessel_K()`
      - `Expression2UnicodeHandler.bessel_i()`
      - `Expression2UnicodeHandler.bessel_j()`
      - `Expression2UnicodeHandler.bessel_y()`
      - `Expression2UnicodeHandler.cell_avg()`
      - `Expression2UnicodeHandler.coefficient()`
      - `Expression2UnicodeHandler.coefficient_derivative()`
      - `Expression2UnicodeHandler.cofactor()`
      - `Expression2UnicodeHandler.cofunction()`
      - `Expression2UnicodeHandler.component_tensor()`
      - `Expression2UnicodeHandler.conditional()`
      - `Expression2UnicodeHandler.conj()`
      - `Expression2UnicodeHandler.constant()`
      - `Expression2UnicodeHandler.cross()`
      - `Expression2UnicodeHandler.curl()`
      - `Expression2UnicodeHandler.determinant()`
      - `Expression2UnicodeHandler.deviatoric()`
      - `Expression2UnicodeHandler.div()`
      - `Expression2UnicodeHandler.division()`
      - `Expression2UnicodeHandler.dot()`
      - `Expression2UnicodeHandler.eq()`
      - `Expression2UnicodeHandler.exp()`
      - `Expression2UnicodeHandler.expr()`
      - `Expression2UnicodeHandler.expr_list()`
      - `Expression2UnicodeHandler.expr_mapping()`
      - `Expression2UnicodeHandler.facet_avg()`
      - `Expression2UnicodeHandler.facet_normal()`
      - `Expression2UnicodeHandler.ge()`
      - `Expression2UnicodeHandler.grad()`
      - `Expression2UnicodeHandler.gt()`
      - `Expression2UnicodeHandler.identity()`
      - `Expression2UnicodeHandler.imag()`
      - `Expression2UnicodeHandler.index_sum()`
      - `Expression2UnicodeHandler.indexed()`
      - `Expression2UnicodeHandler.inner()`
      - `Expression2UnicodeHandler.inverse()`
      - `Expression2UnicodeHandler.label()`
      - `Expression2UnicodeHandler.le()`
      - `Expression2UnicodeHandler.list_tensor()`
      - `Expression2UnicodeHandler.lt()`
      - `Expression2UnicodeHandler.math_function()`
      - `Expression2UnicodeHandler.max_value()`
      - `Expression2UnicodeHandler.min_value()`
      - `Expression2UnicodeHandler.multi_index()`
      - `Expression2UnicodeHandler.nabla_div()`
      - `Expression2UnicodeHandler.nabla_grad()`
      - `Expression2UnicodeHandler.ne()`
      - `Expression2UnicodeHandler.negative_restricted()`
      - `Expression2UnicodeHandler.not_condition()`
      - `Expression2UnicodeHandler.or_condition()`
      - `Expression2UnicodeHandler.outer()`
      - `Expression2UnicodeHandler.permutation_symbol()`
      - `Expression2UnicodeHandler.positive_restricted()`
      - `Expression2UnicodeHandler.power()`
      - `Expression2UnicodeHandler.product()`
      - `Expression2UnicodeHandler.real()`
      - `Expression2UnicodeHandler.scalar_value()`
      - `Expression2UnicodeHandler.skew()`
      - `Expression2UnicodeHandler.spatial_coordinate()`
      - `Expression2UnicodeHandler.sqrt()`
      - `Expression2UnicodeHandler.sum()`
      - `Expression2UnicodeHandler.sym()`
      - `Expression2UnicodeHandler.trace()`
      - `Expression2UnicodeHandler.transposed()`
      - `Expression2UnicodeHandler.variable()`
      - `Expression2UnicodeHandler.variable_derivative()`
      - `Expression2UnicodeHandler.zero()`
    - `PrecedenceRules`
      - `PrecedenceRules.add()`
      - `PrecedenceRules.and_condition()`
      - `PrecedenceRules.bessel_function()`
      - `PrecedenceRules.call()`
      - `PrecedenceRules.cell_avg()`
      - `PrecedenceRules.cofactor()`
      - `PrecedenceRules.component_tensor()`
      - `PrecedenceRules.conditional()`
      - `PrecedenceRules.cross()`
      - `PrecedenceRules.derivative()`
      - `PrecedenceRules.deviatoric()`
      - `PrecedenceRules.division()`
      - `PrecedenceRules.dot()`
      - `PrecedenceRules.eq()`
      - `PrecedenceRules.facet_avg()`
      - `PrecedenceRules.ge()`
      - `PrecedenceRules.gt()`
      - `PrecedenceRules.highest()`
      - `PrecedenceRules.index_sum()`
      - `PrecedenceRules.indexed()`
      - `PrecedenceRules.inner()`
      - `PrecedenceRules.le()`
      - `PrecedenceRules.list_tensor()`
      - `PrecedenceRules.lowest()`
      - `PrecedenceRules.lt()`
      - `PrecedenceRules.math_function()`
      - `PrecedenceRules.mathop()`
      - `PrecedenceRules.max_value()`
      - `PrecedenceRules.min_value()`
      - `PrecedenceRules.ne()`
      - `PrecedenceRules.not_condition()`
      - `PrecedenceRules.operator()`
      - `PrecedenceRules.or_condition()`
      - `PrecedenceRules.outer()`
      - `PrecedenceRules.power()`
      - `PrecedenceRules.product()`
      - `PrecedenceRules.restricted()`
      - `PrecedenceRules.skew()`
      - `PrecedenceRules.sym()`
      - `PrecedenceRules.terminal()`
      - `PrecedenceRules.trace()`
    - `UC`
      - `UC.Gamma`
      - `UC.Omega`
      - `UC.bold_math_A`
      - `UC.bold_math_a`
      - `UC.circled_times`
      - `UC.combining_overline`
      - `UC.combining_right_arrow_above`
      - `UC.cross_product`
      - `UC.division_slash`
      - `UC.dot`
      - `UC.element_of`
      - `UC.epsilon`
      - `UC.for_all`
      - `UC.gamma`
      - `UC.ge`
      - `UC.gt`
      - `UC.integral`
      - `UC.integral_contour`
      - `UC.integral_double`
      - `UC.integral_surface`
      - `UC.integral_triple`
      - `UC.integral_volume`
      - `UC.le`
      - `UC.left_angled_bracket`
      - `UC.left_double_angled_bracket`
      - `UC.left_white_square_bracket`
      - `UC.logical_and`
      - `UC.logical_not`
      - `UC.logical_or`
      - `UC.lt`
      - `UC.nabla`
      - `UC.nary_product`
      - `UC.ne`
      - `UC.not_element_of`
      - `UC.omega`
      - `UC.partial`
      - `UC.right_angled_bracket`
      - `UC.right_double_angled_bracket`
      - `UC.right_white_squared_bracket`
      - `UC.sqrt`
      - `UC.subscript_digits`
      - `UC.subscript_equals`
      - `UC.subscript_left_paren`
      - `UC.subscript_minus`
      - `UC.subscript_plus`
      - `UC.subscript_right_paren`
      - `UC.sum`
      - `UC.superscript_digits`
      - `UC.superscript_equals`
      - `UC.superscript_left_paren`
      - `UC.superscript_minus`
      - `UC.superscript_plus`
      - `UC.superscript_right_paren`
      - `UC.thin_space`
      - `UC.transpose`
    - `binop()`
    - `bolden_letter()`
    - `bolden_string()`
    - `expression2unicode()`
    - `form2unicode()`
    - `format_index()`
    - `get_integral_symbol()`
    - `is_int()`
    - `mathop()`
    - `measure_font()`
    - `opfont()`
    - `overline_string()`
    - `par()`
    - `precedence()`
    - `subscript_digit()`
    - `subscript_number()`
    - `superscript_digit()`
    - `superscript_number()`
    - `ufl2unicode()`
  - Module contents
- ufl.utils package
  - Submodules
  - ufl.utils.counted module
    - `Counted`
      - `Counted.count()`
  - ufl.utils.formatting module
    - `camel2underscore()`
    - `estr()`
    - `istr()`
    - `lstr()`
    - `tree_format()`
    - `tstr()`
  - ufl.utils.indexflattening module
    - `flatten_multiindex()`
    - `shape_to_strides()`
    - `unflatten_index()`
  - ufl.utils.sequences module
    - `max_degree()`
    - `product()`
  - ufl.utils.sorting module
    - `canonicalize_metadata()`
    - `sorted_by_count()`
    - `sorted_by_key()`
    - `topological_sorting()`
  - ufl.utils.stacks module
    - `Stack`
      - `Stack.peek()`
      - `Stack.push()`
    - `StackDict`
      - `StackDict.pop()`
      - `StackDict.push()`
  - Module contents

## Submodules

## ufl.action module

This module defines the Action class.

class ufl.action.Action(*args, **kw)

  Bases: `BaseForm`

  UFL base form type: respresents the action of an object on another.

  For example:

    res = Ax

  A would be the first argument, left and x would be the second argument, right.

  Action objects will result when the action of an assembled object (e.g. a Matrix) is taken. This delays the evaluation of the action until assembly occurs.

  equals(other)

    Check if two Actions are equal.

  left()

    Get left.

  right()

    Get right.

  ufl_domains()

    Return all domains found in the base form.

  ufl_function_spaces()

    Get the tuple of function spaces of the underlying form.

  ufl_operands: tuple[FormArgument, ...]

## ufl.adjoint module

This module defines the Adjoint class.

class ufl.adjoint.Adjoint(*args, **kw)

  Bases: `BaseForm`

  UFL base form type: represents the adjoint of an object.

  Adjoint objects will result when the adjoint of an assembled object (e.g. a Matrix) is taken. This delays the evaluation of the adjoint until assembly occurs.

  equals(other)

    Check if two Adjoints are equal.

  form()

    Return the form.

  ufl_domains()

    Return all domains found in the base form.

  ufl_function_spaces()

    Get the tuple of function spaces of the underlying form.

  ufl_operands: tuple[FormArgument, ...]

## ufl.algebra module

Basic algebra operations.

class ufl.algebra.Abs(a)

  Bases: `Operator`

  Absolute value.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.algebra.Conj(a)

  Bases: `Operator`

  Complex conjugate.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.algebra.Division(a, b)

  Bases: `Operator`

  Division.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.algebra.Imag(a)

  Bases: `Operator`

  Imaginary part.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.algebra.Power(a, b)

  Bases: `Operator`

  Power.

  evaluate(x, mapping, component, index_values)

    Evalute.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.algebra.Product(a, b)

  Bases: `Operator`

  The product of two or more UFL objects.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.algebra.Real(a)

  Bases: `Operator`

  Real part.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.algebra.Sum(a, b)

  Bases: `Operator`

  Sum.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

## ufl.argument module

Argument.

This module defines the class Argument and a number of related classes (functions), including TestFunction and TrialFunction.

class ufl.argument.Argument(*args, **kw)

  Bases: `FormArgument`, `BaseArgument`

  UFL value: Representation of an argument to a form.

  ufl_domains()

    Return UFL domains.

ufl.argument.Arguments(function_space, number)

  Create an Argument in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

class ufl.argument.BaseArgument(function_space, number, part=None)

  Bases: `object`

  UFL value: Representation of an argument to a form.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  number()

    Return the Argument number.

  part()

    Return the part.

  ufl_domain()

    Return the UFL domain.

  ufl_domains()

    Return UFL domains.

  ufl_element()

    Return The UFL element.

  ufl_function_space()

    Get the function space of this Argument.

  property ufl_shape

    Return the associated UFL shape.

class ufl.argument.Coargument(*args, **kw)

  Bases: `BaseForm`, `BaseArgument`

  UFL value: Representation of an argument to a form in a dual space.

  arguments(outer_form=None)

    Return all Argument objects found in form.

  equals(other)

    Check equality.

  ufl_domain()

    Return the UFL domain.

  ufl_operands: tuple[FormArgument, ...]

ufl.argument.TestFunction(function_space, part=None)

  UFL value: Create a test function argument to a form.

ufl.argument.TestFunctions(function_space)

  Create a TestFunction in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

ufl.argument.TrialFunction(function_space, part=None)

  UFL value: Create a trial function argument to a form.

ufl.argument.TrialFunctions(function_space)

  Create a TrialFunction in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

## ufl.averaging module

Averaging operations.

class ufl.averaging.CellAvg(f)

  Bases: `Operator`

  Cell average.

  evaluate(x, mapping, component, index_values)

    Performs an approximate symbolic evaluation, since we don’t have a cell.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.averaging.FacetAvg(f)

  Bases: `Operator`

  Facet average.

  evaluate(x, mapping, component, index_values)

    Performs an approximate symbolic evaluation, since we dont have a cell.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

## ufl.cell module

Types for representing a cell.

class ufl.cell.AbstractCell

  Bases: `UFLObject`

  A base class for all cells.

  abstractmethod cellname() → str

    Return the cellname of the cell.

  edge_types() → tuple[AbstractCell, ...]

    Get the unique edge types.

  edges() → tuple[AbstractCell, ...]

    Get the edges.

  face_types() → tuple[AbstractCell, ...]

    Get the unique face types.

  faces() → tuple[AbstractCell, ...]

    Get the faces.

  facet_types() → tuple[AbstractCell, ...]

    Get the unique facet types.

    Facets are entities of dimension tdim-1.

  facets() → tuple[AbstractCell, ...]

    Get the facets.

    Facets are entities of dimension tdim-1.

  abstractmethod has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  abstractmethod is_simplex() → bool

    Return True if this is a simplex cell.

  num_edges() → int

    Get the number of edges.

  num_faces() → int

    Get the number of faces.

  num_facets() → int

    Get the number of facets.

    Facets are entities of dimension tdim-1.

  num_peaks() → int

    Get the number of peaks.

    Peaks are entities of dimension tdim-3.

  num_ridges() → int

    Get the number of ridges.

    Ridges are entities of dimension tdim-2.

  abstractmethod num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  num_vertices() → int

    Get the number of vertices.

  peak_types() → tuple[AbstractCell, ...]

    Get the unique peak types.

    Peaks are entities of dimension tdim-3.

  peaks() → tuple[AbstractCell, ...]

    Get the peaks.

    Peaks are entities of dimension tdim-3.

  abstractmethod reconstruct(**kwargs: Any) → AbstractCell

    Reconstruct this cell, overwriting properties by those in kwargs.

  ridge_types() → tuple[AbstractCell, ...]

    Get the unique ridge types.

    Ridges are entities of dimension tdim-2.

  ridges() → tuple[AbstractCell, ...]

    Get the ridges.

    Ridges are entities of dimension tdim-2.

  abstractmethod sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  abstractmethod sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  abstractmethod topological_dimension() → int

    Return the dimension of the topology of this cell.

  vertex_types() → tuple[AbstractCell, ...]

    Get the unique vertices types.

  vertices() → tuple[AbstractCell, ...]

    Get the vertices.

class ufl.cell.Cell(cellname: str)

  Bases: `AbstractCell`

  Representation of a named finite element cell with known structure.

  cellname() → str

    Return the cellname of the cell.

  has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  is_simplex() → bool

    Return True if this is a simplex cell.

  num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  reconstruct(**kwargs: Any) → Cell

    Reconstruct this cell, overwriting properties by those in kwargs.

  sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  topological_dimension() → int

    Return the dimension of the topology of this cell.

class ufl.cell.TensorProductCell(*cells: AbstractCell)

  Bases: `AbstractCell`

  Tensor product cell.

  cellname() → str

    Return the cellname of the cell.

  has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  is_simplex() → bool

    Return True if this is a simplex cell.

  num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  reconstruct(**kwargs: Any) → AbstractCell

    Reconstruct this cell, overwriting properties by those in kwargs.

  sub_cells() → tuple[AbstractCell, ...]

    Return list of cell factors.

  sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  topological_dimension() → int

    Return the dimension of the topology of this cell.

ufl.cell.as_cell(cell: AbstractCell | str | tuple[AbstractCell, ...]) → AbstractCell

  Convert any valid object to a Cell or return cell if it is already a Cell.

  Allows an already valid cell, a known cellname string, or a tuple of cells for a product cell.

ufl.cell.hypercube(topological_dimension: int)

  Return a hypercube cell of the given dimension.

ufl.cell.simplex(topological_dimension: int)

  Return a simplex cell of the given dimension.

## ufl.checks module

Utility functions for checking properties of expressions.

ufl.checks.is_cellwise_constant(expr)

  Return whether expression is constant over a single cell.

ufl.checks.is_python_scalar(expression)

  Return True iff expression is of a Python scalar type.

ufl.checks.is_scalar_constant_expression(expr)

  Check if an expression is a globally constant scalar expression.

ufl.checks.is_true_ufl_scalar(expression)

  Return True iff expression is scalar-valued, with no free indices.

ufl.checks.is_ufl_scalar(expression)

  Return True iff expression is scalar-valued, but possibly containing free indices.

## ufl.classes module

Classes.

It contains functionality used by algorithms for dealing with groups of classes, and for mapping types to different handler functions.

class ufl.classes.Abs(a)

  Bases: `Operator`

  Absolute value.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.AbstractCell

  Bases: `UFLObject`

  A base class for all cells.

  abstractmethod cellname() → str

    Return the cellname of the cell.

  edge_types() → tuple[AbstractCell, ...]

    Get the unique edge types.

  edges() → tuple[AbstractCell, ...]

    Get the edges.

  face_types() → tuple[AbstractCell, ...]

    Get the unique face types.

  faces() → tuple[AbstractCell, ...]

    Get the faces.

  facet_types() → tuple[AbstractCell, ...]

    Get the unique facet types.

    Facets are entities of dimension tdim-1.

  facets() → tuple[AbstractCell, ...]

    Get the facets.

    Facets are entities of dimension tdim-1.

  abstractmethod has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  abstractmethod is_simplex() → bool

    Return True if this is a simplex cell.

  num_edges() → int

    Get the number of edges.

  num_faces() → int

    Get the number of faces.

  num_facets() → int

    Get the number of facets.

    Facets are entities of dimension tdim-1.

  num_peaks() → int

    Get the number of peaks.

    Peaks are entities of dimension tdim-3.

  num_ridges() → int

    Get the number of ridges.

    Ridges are entities of dimension tdim-2.

  abstractmethod num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  num_vertices() → int

    Get the number of vertices.

  peak_types() → tuple[AbstractCell, ...]

    Get the unique peak types.

    Peaks are entities of dimension tdim-3.

  peaks() → tuple[AbstractCell, ...]

    Get the peaks.

    Peaks are entities of dimension tdim-3.

  abstractmethod reconstruct(**kwargs: Any) → AbstractCell

    Reconstruct this cell, overwriting properties by those in kwargs.

  ridge_types() → tuple[AbstractCell, ...]

    Get the unique ridge types.

    Ridges are entities of dimension tdim-2.

  ridges() → tuple[AbstractCell, ...]

    Get the ridges.

    Ridges are entities of dimension tdim-2.

  abstractmethod sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  abstractmethod sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  abstractmethod topological_dimension() → int

    Return the dimension of the topology of this cell.

  vertex_types() → tuple[AbstractCell, ...]

    Get the unique vertices types.

  vertices() → tuple[AbstractCell, ...]

    Get the vertices.

class ufl.classes.AbstractDomain(topological_dimension, geometric_dimension)

  Bases: `object`

  Symbolic representation of a geometric domain.

  Domain has only a geometric and a topological dimension.

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  geometric_dimension()

    Return the dimension of the space this domain is embedded in.

  iterable_like(element: AbstractFiniteElement) → Iterable[Mesh] | MeshSequence

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  topological_dimension()

    Return the dimension of the topology of this domain.

class ufl.classes.AbstractFiniteElement

  Bases: `ABC`

  Base class for all finite elements.

  To make your element library compatible with UFL, you should make a subclass of AbstractFiniteElement and provide implementions of all the abstract methods and properties. All methods and properties that are not marked as abstract are implemented here and should not need to be overwritten in your subclass.

  An example of how the methods in your subclass could be implemented can be found in Basix; see https://github.com/FEniCS/basix/blob/main/python/basix/ufl.py

  abstract property cell: Cell

    Return the cell of the finite element.

  abstract property embedded_subdegree: int

    Degree of the maximum degree Lagrange space that is spanned by this element.

    This returns the degree of the highest degree Lagrange space such that the polynomial space of the Lagrange space is a subspace of this element’s polynomial space. If this element’s polynomial space does not include the constant function, this function should return -1.

    Note that on a simplex cells, the polynomial space of Lagrange space is a complete polynomial space, but on other cells this is not true. For example, on quadrilateral cells, the degree 1 Lagrange space includes the degree 2 polynomial xy.

  abstract property embedded_superdegree: int | None

    Degree of the minimum degree Lagrange space that spans this element.

    This returns the degree of the lowest degree Lagrange space such that the polynomial space of the Lagrange space is a superspace of this element’s polynomial space. If this element contains basis functions that are not in any Lagrange space, this function should return None.

    Note that on a simplex cells, the polynomial space of Lagrange space is a complete polynomial space, but on other cells this is not true. For example, on quadrilateral cells, the degree 1 Lagrange space includes the degree 2 polynomial xy.

  is_cellwise_constant() → bool

    Check whether this element is spatially constant over each cell.

  property num_sub_elements: int

    Return number of sub-elements.

    This function does not recurse: ie it does not count the sub-elements of sub-elements.

  abstract property pullback: AbstractPullback

    Return the pullback for this element.

  abstract property reference_value_shape: tuple[int, ...]

    Return the shape of the value space on the reference cell.

  property reference_value_size: int

    Return the integer product of the reference value shape.

  abstract property sobolev_space: SobolevSpace

    Return the underlying Sobolev space.

  abstract property sub_elements: Sequence

    Return list of sub-elements.

    This function does not recurse: ie it does not extract the sub-elements of sub-elements.

class ufl.classes.AbstractFunctionSpace

  Bases: `object`

  Abstract function space.

  ufl_sub_spaces()

    Return ufl sub spaces.

class ufl.classes.AbstractPullback

  Bases: `ABC`

  An abstract pull back.

  apply(expr: Expr, domain: AbstractDomain | None = None) → Expr

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  abstract property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  abstractmethod physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.Acos(argument)

  Bases: `MathFunction`

  Inverse cosine.

class ufl.classes.Action(*args, **kw)

  Bases: `BaseForm`

  UFL base form type: respresents the action of an object on another.

  For example:

    res = Ax

  A would be the first argument, left and x would be the second argument, right.

  Action objects will result when the action of an assembled object (e.g. a Matrix) is taken. This delays the evaluation of the action until assembly occurs.

  equals(other)

    Check if two Actions are equal.

  left()

    Get left.

  right()

    Get right.

  ufl_domains()

    Return all domains found in the base form.

  ufl_function_spaces()

    Get the tuple of function spaces of the underlying form.

  ufl_operands: tuple[FormArgument, ...]

class ufl.classes.Adjoint(*args, **kw)

  Bases: `BaseForm`

  UFL base form type: represents the adjoint of an object.

  Adjoint objects will result when the adjoint of an assembled object (e.g. a Matrix) is taken. This delays the evaluation of the adjoint until assembly occurs.

  equals(other)

    Check if two Adjoints are equal.

  form()

    Return the form.

  ufl_domains()

    Return all domains found in the base form.

  ufl_function_spaces()

    Get the tuple of function spaces of the underlying form.

  ufl_operands: tuple[FormArgument, ...]

class ufl.classes.AndCondition(left, right)

  Bases: `BinaryCondition`

  And condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.Argument(*args, **kw)

  Bases: `FormArgument`, `BaseArgument`

  UFL value: Representation of an argument to a form.

  ufl_domains()

    Return UFL domains.

class ufl.classes.Asin(argument)

  Bases: `MathFunction`

  Inverse sine.

class ufl.classes.Atan(argument)

  Bases: `MathFunction`

  Inverse tangent.

class ufl.classes.Atan2(arg1, arg2)

  Bases: `Operator`

  Inverse tangent with two inputs.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.BaseForm

  Bases: `object`

  Description of an object containing arguments.

  arguments()

    Return all `Argument` objects found in form.

  coefficients()

    Return all `Coefficient` objects found in form.

  empty()

    Returns whether the BaseForm has no components.

  geometric_quantities()

    Return all `GeometricQuantity` objects found in form.

  ufl_domain()

    Return the single geometric integration domain occuring in the base form.

    Fails if multiple domains are found.

class ufl.classes.BaseFormCoordinateDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `BaseFormDerivative`, `CoordinateDerivative`

  Derivative of a base form w.r.t. the SpatialCoordinates.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.BaseFormDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `CoefficientDerivative`, `BaseForm`

  Derivative of a base form w.r.t the degrees of freedom in a discrete Coefficient.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.BaseFormOperator(*operands, function_space, derivatives=None, argument_slots=())

  Bases: `Operator`, `BaseForm`, `Counted`

  Base form operator.

  argument_slots(outer_form=False)

    Returns a tuple of expressions containing argument and coefficient based expressions.

    We get an argument uhat when we take the Gateaux derivative in the direction uhat: d/du N(u; v*) = dNdu(u; uhat, v*) where uhat is a ufl.Argument and v* a ufl.Coargument Applying the action replace the last argument by coefficient: action(dNdu(u; uhat, v*), w) = dNdu(u; w, v*) where du is a ufl.Coefficient.

  coefficients()

    Return all BaseCoefficient objects found in base form operator.

  count()

    Return the count associated to the base form operator.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_function_space()

    Return the function space associated to the operator.

    I.e. return the dual of the base form operator’s Coargument space.

  ufl_index_dimensions = ()
  ufl_operands: tuple['FormArgument', ...]
  property ufl_shape

    Return the UFL shape of the coefficient produced by the operator.

class ufl.classes.BaseFormOperatorCoordinateDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `BaseFormOperatorDerivative`, `CoordinateDerivative`

  Derivative of a base form operator w.r.t. the SpatialCoordinates.

  property ufl_free_indices

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_index_dimensions

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_shape

    Return the UFL shape of the coefficient produced by the operator.

class ufl.classes.BaseFormOperatorDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `BaseFormDerivative`, `BaseFormOperator`

  Derivative of a base form operator w.r.t the degrees of freedom in a discrete Coefficient.

  argument_slots(outer_form=False)

    Return a tuple of expressions containing argument and coefficient based expressions.

  property ufl_free_indices

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_index_dimensions

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_shape

    Return the UFL shape of the coefficient produced by the operator.

class ufl.classes.BesselFunction(name, nu, argument)

  Bases: `Operator`

  Base class for all bessel functions.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.BesselI(nu, argument)

  Bases: `BesselFunction`

  Bessel I function.

class ufl.classes.BesselJ(nu, argument)

  Bases: `BesselFunction`

  Bessel J function.

class ufl.classes.BesselK(nu, argument)

  Bases: `BesselFunction`

  Bessel K function.

class ufl.classes.BesselY(nu, argument)

  Bases: `BesselFunction`

  Bessel Y function.

class ufl.classes.BinaryCondition(name, left, right)

  Bases: `Condition`

  Binary condition.

class ufl.classes.Cell(cellname: str)

  Bases: `AbstractCell`

  Representation of a named finite element cell with known structure.

  cellname() → str

    Return the cellname of the cell.

  has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  is_simplex() → bool

    Return True if this is a simplex cell.

  num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  reconstruct(**kwargs: Any) → Cell

    Reconstruct this cell, overwriting properties by those in kwargs.

  sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  topological_dimension() → int

    Return the dimension of the topology of this cell.

class ufl.classes.CellAvg(f)

  Bases: `Operator`

  Cell average.

  evaluate(x, mapping, component, index_values)

    Performs an approximate symbolic evaluation, since we don’t have a cell.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.CellCoordinate(domain)

  Bases: `GeometricCellQuantity`

  The coordinate in a reference cell.

  In the context of expression integration, represents the reference cell coordinate of each quadrature point.

  In the context of expression evaluation in a point in a cell, represents that point in the reference coordinate system of the cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'X'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellDiameter(domain)

  Bases: `GeometricCellQuantity`

  The diameter of the cell, i.e., maximal distance of two points in the cell.

  name = 'diameter'

class ufl.classes.CellEdgeVectors(domain)

  Bases: `GeometricCellQuantity`

  The vectors between physical cell vertices for each edge in cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CEV'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellFacetJacobian(domain)

  Bases: `GeometricFacetQuantity`

  The Jacobian of the mapping from reference facet to reference cell coordinates.

  CFJ_ij = dX_i/dXf_j

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CFJ'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellFacetJacobianDeterminant(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-determinant of the CellFacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detCFJ'

class ufl.classes.CellFacetJacobianInverse(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-inverse of the CellFacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CFK'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellFacetOrigin(domain)

  Bases: `GeometricFacetQuantity`

  The reference cell coordinate corresponding to origin of a reference facet.

  name = 'X0f'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellNormal(domain)

  Bases: `GeometricCellQuantity`

  The upwards pointing normal vector of the current manifold cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'cell_normal'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.classes.CellOrientation(domain)

  Bases: `GeometricCellQuantity`

  The orientation (+1/-1) of the current cell.

  For non-manifold cells (tdim == gdim), this equals the sign of the Jacobian determinant, i.e. +1 if the physical cell is oriented the same way as the reference cell and -1 otherwise.

  For manifold cells of tdim==gdim-1 this is input data belonging to the mesh, used to distinguish between the sides of the manifold.

  name = 'cell_orientation'

class ufl.classes.CellOrigin(domain)

  Bases: `GeometricCellQuantity`

  The spatial coordinate corresponding to origin of a reference cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'x0'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellRidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to reference cell coordinates.

  CRJ_ij = dX_i/dXe_j

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CRJ'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellRidgeJacobianDeterminant(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-determinant of the CellRidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detCRJ'

class ufl.classes.CellRidgeJacobianInverse(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-inverse of the RidgeFacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CEK'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellRidgeOrigin(domain)

  Bases: `GeometricRidgeQuantity`

  The reference cell coordinate corresponding to origin of a reference ridge.

  name = 'X0e'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellVertices(domain)

  Bases: `GeometricCellQuantity`

  Physical cell vertices.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CV'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.CellVolume(domain)

  Bases: `GeometricCellQuantity`

  The volume of the cell.

  name = 'volume'

class ufl.classes.Circumradius(domain)

  Bases: `GeometricCellQuantity`

  The circumradius of the cell.

  name = 'circumradius'

class ufl.classes.Coargument(*args, **kw)

  Bases: `BaseForm`, `BaseArgument`

  UFL value: Representation of an argument to a form in a dual space.

  arguments(outer_form=None)

    Return all Argument objects found in form.

  equals(other)

    Check equality.

  ufl_domain()

    Return the UFL domain.

  ufl_operands: tuple[FormArgument, ...]

class ufl.classes.Coefficient(*args, **kw)

  Bases: `FormArgument`, `BaseCoefficient`

  UFL form argument type: Representation of a form coefficient.

  ufl_domains()

    Get the UFL domains.

class ufl.classes.CoefficientDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `Derivative`

  Derivative of form integrand w.r.t. the degrees of freedom in a discrete Coefficient.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.Cofactor(A)

  Bases: `CompoundTensorOperator`

  Cofactor.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

    Get the UFL shape.

class ufl.classes.Cofunction(*args, **kw)

  Bases: `BaseCoefficient`, `BaseForm`

  UFL form argument type: Representation of a form coefficient from a dual space.

  equals(other)

    Check equality.

  ufl_operands: tuple[FormArgument, ...]

class ufl.classes.ComplexValue(value)

  Bases: `ScalarValue`

  Representation of a constant, complex scalar.

  argument()

    Get the argument.

  modulus()

    Get the modulus.

class ufl.classes.ComponentTensor(expression, indices)

  Bases: `Operator`

  Maps the free indices of a scalar valued expression to tensor axes.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  indices()

    Get indices.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.classes.CompoundDerivative(operands)

  Bases: `Derivative`

  Base class for all compound derivative types.

class ufl.classes.CompoundTensorOperator(operands)

  Bases: `Operator`

  Compount tensor operator.

class ufl.classes.Condition(operands)

  Bases: `Operator`

  Condition.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Conditional(condition, true_value, false_value)

  Bases: `Operator`

  Conditional expression.

  In C++ these take the format (condition ? true_value : false_value).

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.Conj(a)

  Bases: `Operator`

  Complex conjugate.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.Constant(domain, shape=(), count=None)

  Bases: `Terminal`, `Counted`

  Constant.

  is_cellwise_constant()

    Return True if the function is cellwise constant.

  ufl_domain()

    Get the UFL domain.

  ufl_domains()

    Get the UFL domains.

  property ufl_shape

    Get the UFL shape.

class ufl.classes.ConstantValue

  Bases: `Terminal`

  Constant value.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  ufl_domains()

    Return tuple of domains related to this terminal object.

class ufl.classes.ContravariantPiola

  Bases: `AbstractPullback`

  The contravariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.CoordinateDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `CoefficientDerivative`

  Derivative of the integrand of a form w.r.t. the SpatialCoordinates.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.Cos(argument)

  Bases: `MathFunction`

  Cosine.

class ufl.classes.Cosh(argument)

  Bases: `MathFunction`

  Hyperbolic cosine.

class ufl.classes.CovariantContravariantPiola

  Bases: `AbstractPullback`

  The covariant contravariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.CovariantPiola

  Bases: `AbstractPullback`

  The covariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.Cross(a, b)

  Bases: `CompoundTensorOperator`

  Cross.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = (3,)

class ufl.classes.Curl(f)

  Bases: `CompoundDerivative`

  Compound derivative.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.classes.CustomPullback

  Bases: `AbstractPullback`

  Custom pull back.

  This should probably be removed.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.Derivative(operands)

  Bases: `Operator`

  Base class for all derivative types.

class ufl.classes.Determinant(A)

  Bases: `CompoundTensorOperator`

  Determinant.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Deviatoric(A)

  Bases: `CompoundTensorOperator`

  Deviatoric.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.DirectionalSobolevSpace(orders)

  Bases: `SobolevSpace`

  Directional Sobolev space.

  Symbolic representation of a Sobolev space with varying smoothness in different spatial directions.

class ufl.classes.Div(f)

  Bases: `CompoundDerivative`

  Div.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.Division(a, b)

  Bases: `Operator`

  Division.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Dot(a, b)

  Bases: `CompoundTensorOperator`

  Dot.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.DoubleContravariantPiola

  Bases: `AbstractPullback`

  The double contravariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.DoubleCovariantPiola

  Bases: `AbstractPullback`

  The double covariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.DualSpace(domain, element, label='')

  Bases: `BaseFunctionSpace`, `UFLObject`

  Representation of a Dual space.

  dual()

    Get the dual of the space.

class ufl.classes.EQ(left, right)

  Bases: `BinaryCondition`

  Equality condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.Equation(lhs, rhs)

  Bases: `object`

  Equation.

  This class is used to represent equations expressed by the “==” operator. Examples include a == L and F == 0 where a, L and F are Form objects.

class ufl.classes.Erf(argument)

  Bases: `MathFunction`

  Erf function.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.Exp(argument)

  Bases: `MathFunction`

  Exponentiation..

class ufl.classes.Expr

  Bases: `object`

  Base class for all UFL expression types.

  Instance properties

    Every `Expr` instance will have certain properties. The most important ones are `ufl_operands`, `ufl_shape`, `ufl_free_indices`, and `ufl_index_dimensions` properties. Expressions are immutable and hashable.

  Type traits

    The `Expr` API defines a number of type traits that each subclass needs to provide. Most of these are specified indirectly via the arguments to the `ufl_type` class decorator, allowing UFL to do some consistency checks and automate most of the traits for most types. Type traits are accessed via a class or instance object of the form `obj._ufl_traitname_`. See the source code for description of each type trait.

  Operators

    Some Python special functions are implemented in this class, some are implemented in subclasses, and some are attached to this class in the `ufl_type` class decorator.

  Defining subclasses

    To define a new expression class, inherit from either `Terminal` or `Operator`, and apply the `ufl_type` class decorator with suitable arguments. See the docstring of `ufl_type` for details on its arguments. Looking at existing classes similar to the one you wish to add is a good idea. Looking through the comments in the `Expr` class and `ufl_type` to understand all the properties that may need to be specified is also a good idea. Note that many algorithms in UFL and form compilers will need handlers implemented for each new type::.

        @ufl_type()
        class MyOperator(Operator):
            pass

  Type collections

    All `Expr` subclasses are collected by `ufl_type` in global variables available via `Expr`.

  Profiling

    Object creation statistics can be collected by doing

        Expr.ufl_enable_profiling()
        # ... run some code
        initstats, delstats = Expr.ufl_disable_profiling()

    Giving a list of creation and deletion counts for each typecode.

  property T

    Transpose a rank-2 tensor expression.

    For more general transpose operations of higher order tensor expressions, use indexing and Tensor.

  dx(*ii)

    Return the partial derivative with respect to spatial variable number ii.

  evaluate(x, mapping, component, index_values)

    Evaluate expression at given coordinate with given values for terminals.

  static ufl_disable_profiling()

    Turn off the object counting mechanism. Return object init and del counts.

  ufl_domain()

    Return the single unique domain this expression is defined on, or throw an error.

  ufl_domains()

    Return all domains this expression is defined on.

  static ufl_enable_profiling()

    Turn on the object counting mechanism and reset counts to zero.

class ufl.classes.ExprList(*operands)

  Bases: `Operator`

  List of Expr objects. For internal use, never to be created by end users.

  free_indices()

    Get the free indices.

  index_dimensions()

    Get the index dimensions.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

class ufl.classes.ExprMapping(*operands)

  Bases: `Operator`

  Mapping of Expr objects. For internal use, never to be created by end users.

  free_indices()

    Get the free indices.

  index_dimensions()

    Get the index dimensions.

  ufl_domains()

    Get the UFL domains.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

class ufl.classes.ExternalOperator(*operands, function_space, derivatives=None, argument_slots=())

  Bases: `BaseFormOperator`

  External operator.

  assemble(*args, **kwargs)

    Assemble the external operator.

  grad()

    Returns the symbolic grad of the external operator.

  ufl_element()

    Shortcut to get the finite element of the function space of the external operator.

  ufl_operands: tuple['FormArgument', ...]

class ufl.classes.FacetArea(domain)

  Bases: `GeometricFacetQuantity`

  The area of the facet.

  name = 'facetarea'

class ufl.classes.FacetAvg(f)

  Bases: `Operator`

  Facet average.

  evaluate(x, mapping, component, index_values)

    Performs an approximate symbolic evaluation, since we dont have a cell.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.FacetCoordinate(domain)

  Bases: `GeometricFacetQuantity`

  The coordinate in a reference cell of a facet.

  In the context of expression integration over a facet, represents the reference facet coordinate of each quadrature point.

  In the context of expression evaluation in a point on a facet, represents that point in the reference coordinate system of the facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'Xf'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.FacetEdgeVectors(domain)

  Bases: `GeometricFacetQuantity`

  The vectors between physical cell vertices for each edge in current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FEV'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.FacetJacobian(domain)

  Bases: `GeometricFacetQuantity`

  The Jacobian of the mapping from reference facet to spatial coordinates.

  > FJ_ij = dx_i/dXf_j

  The FacetJacobian is the product of the Jacobian and CellFacetJacobian:

  > FJ = dx/dXf = dx/dX dX/dXf = J * CFJ

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FJ'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.FacetJacobianDeterminant(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-determinant of the FacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detFJ'

class ufl.classes.FacetJacobianInverse(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-inverse of the FacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FK'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.FacetNormal(domain)

  Bases: `GeometricFacetQuantity`

  The outwards pointing normal vector of the current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'n'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.classes.FacetOrientation(domain)

  Bases: `GeometricFacetQuantity`

  The orientation (+1/-1) of the current facet relative to the reference cell.

  name = 'facet_orientation'

class ufl.classes.FacetOrigin(domain)

  Bases: `GeometricFacetQuantity`

  The spatial coordinate corresponding to origin of a reference facet.

  name = 'x0f'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.FacetRidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to reference facet coordinates.

  FRJ_ij = dXf_i/dXe_j

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FRJ'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.FixedIndex(value)

  Bases: `IndexBase`

  UFL value: An index with a specific value assigned.

class ufl.classes.FloatValue(value)

  Bases: `RealValue`

  Representation of a constant scalar floating point value.

class ufl.classes.Form(integrals)

  Bases: `BaseForm`

  Description of a weak form consisting of a sum of integrals over subdomains.

  base_form_operators()

    Return all `BaseFormOperator` objects found in form.

  coefficient_numbering()

    Return a contiguous numbering of coefficients in a mapping `{coefficient:number}`.

  coefficients()

    Return all `Coefficient` objects found in form.

  constant_numbering()

    Return a contiguous numbering of constants in a mapping `{constant:number}`.

  constants()

    Get constants.

  domain_numbering()

    Return a contiguous numbering of domains in a mapping `{domain:number}`.

  empty()

    Returns whether the form has no integrals.

  equals(other)

    Evaluate `bool(lhs_form == rhs_form)`.

  geometric_dimension()

    Return the geometric dimension shared by all domains and functions in this form.

  integrals()

    Return a sequence of all integrals in form.

  integrals_by_domain(domain)

    Return a sequence of all integrals with a particular integration domain.

  integrals_by_type(integral_type)

    Return a sequence of all integrals with a particular domain type.

  signature()

    Signature for use with jit cache (independent of incidental numbering of indices etc).

  subdomain_data()

    Returns a mapping on the form `{domain:{integral_type: subdomain_data}}`.

  terminal_numbering()

    Return a contiguous numbering for all counted objects in the form.

    The returned object is mapping from terminal to its number (an integer).

    The numbering is computed per type so `Coefficient`, `Constant`, etc will each be numbered from zero.

  ufl_cell()

    Return the single cell this form is defined on.

    Fails if multiple cells are found.

  ufl_domains()

    Return the geometric integration domains occuring in the form.

    NB! This does not include domains of coefficients defined on other meshes.

    The return type is a tuple even if only a single domain exists.

class ufl.classes.FormArgument

  Bases: `Terminal`

  An abstract class for a form argument (a thing in a primal finite element space).

class ufl.classes.FormSum(*args, **kwargs)

  Bases: `BaseForm`

  Form sum.

  Description of a weighted sum of variational forms and form-like objects components is the list of Forms to be summed arg_weights is a list of tuples of component index and weight

  components()

    Get components.

  empty()

    Returns whether the FormSum has no components.

  equals(other)

    Evaluate `bool(lhs_form == rhs_form)`.

  ufl_domains()

    Return all domains found in the base form.

  ufl_operands: tuple[FormArgument, ...]
  weights()

    Get weights.

class ufl.classes.FunctionSpace(domain, element, label='')

  Bases: `BaseFunctionSpace`, `UFLObject`

  Representation of a Function space.

  dual()

    Get the dual of the space.

class ufl.classes.GE(left, right)

  Bases: `BinaryCondition`

  Greater than or equal to condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.GT(left, right)

  Bases: `BinaryCondition`

  Greater than condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.GeometricCellQuantity(domain)

  Bases: `GeometricQuantity`

  Geometric cell quantity.

class ufl.classes.GeometricFacetQuantity(domain)

  Bases: `GeometricQuantity`

  Geometric facet quantity.

class ufl.classes.GeometricQuantity(domain)

  Bases: `Terminal`

  Geometric quantity.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  ufl_domains()

    Get the UFL domains.

  ufl_shape: tuple[int, ...] = ()

class ufl.classes.GeometricRidgeQuantity(domain)

  Bases: `GeometricQuantity`

  Geometric ridge quantity.

class ufl.classes.Grad(f)

  Bases: `CompoundDerivative`

  Grad.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get child from mapping and return the component asked for.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.Identity(dim)

  Bases: `ConstantValue`

  Representation of an identity matrix.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_shape: tuple[int, ...]

class ufl.classes.IdentityPullback

  Bases: `AbstractPullback`

  The identity pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.Imag(a)

  Bases: `Operator`

  Imaginary part.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.Index(count=None)

  Bases: `IndexBase`, `Counted`

  UFL value: An index with no value assigned.

  Used to represent free indices in Einstein indexing notation.

class ufl.classes.IndexBase

  Bases: `object`

  Base class for all indices.

class ufl.classes.IndexSum(summand, index)

  Bases: `Operator`

  Index sum.

  dimension()

    Get dimension.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  index()

    Get index.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  property ufl_shape

    Get UFL shape.

class ufl.classes.Indexed(expression, multiindex)

  Bases: `Operator`

  Indexed expression.

  evaluate(x, mapping, component, index_values, derivatives=())

    Evaluate.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Inner(a, b)

  Bases: `CompoundTensorOperator`

  Inner.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.IntValue(value)

  Bases: `RealValue`

  Representation of a constant scalar integer value.

class ufl.classes.Integral(integrand, integral_type, domain, subdomain_id, metadata, subdomain_data)

  Bases: `object`

  An integral over a single domain.

  integral_type()

    Return the domain type of this integral.

  integrand()

    Return the integrand expression, which is an `Expr` instance.

  metadata()

    Return the compiler metadata this integral has been annotated with.

  reconstruct(integrand=None, integral_type=None, domain=None, subdomain_id=None, metadata=None, subdomain_data=None)

    Construct a new Integral object with some properties replaced with new values.

    Example:

      <a = Integral instance> b = a.reconstruct(expand_compounds(a.integrand())) c = a.reconstruct(metadata={‘quadrature_degree’:2})

  subdomain_data()

    Return the domain data of this integral.

  subdomain_id()

    Return the subdomain id of this integral.

  ufl_domain()

    Return the integration domain of this integral.

class ufl.classes.Interpolate(expr, v)

  Bases: `BaseFormOperator`

  Symbolic representation of the interpolation operator.

  ufl_operands: tuple['FormArgument', ...]

class ufl.classes.Inverse(A)

  Bases: `CompoundTensorOperator`

  Inverse.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

    Get the UFL shape.

class ufl.classes.Jacobian(domain)

  Bases: `GeometricCellQuantity`

  The Jacobian of the mapping from reference cell to spatial coordinates.

  \[\begin{split}J_{ij} = \\frac{dx_i}{dX_j}\end{split}\]
  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'J'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.classes.JacobianDeterminant(domain)

  Bases: `GeometricCellQuantity`

  The determinant of the Jacobian.

  Represents the signed determinant of a square Jacobian or the pseudo-determinant of a non-square Jacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detJ'

class ufl.classes.JacobianInverse(domain)

  Bases: `GeometricCellQuantity`

  The inverse of the Jacobian.

  Represents the inverse of a square Jacobian or the pseudo-inverse of a non-square Jacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'K'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.classes.L2Piola

  Bases: `AbstractPullback`

  The L2 Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.LE(left, right)

  Bases: `BinaryCondition`

  Less than or equal condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.LT(left, right)

  Bases: `BinaryCondition`

  Less than condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.Label(count=None)

  Bases: `Terminal`, `Counted`

  Label.

  is_cellwise_constant()

    Return true if the object is constant on each cell.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

class ufl.classes.ListTensor(*expressions)

  Bases: `Operator`

  Wraps a list of expressions into a tensor valued expression of one higher rank.

  evaluate(x, mapping, component, index_values, derivatives=())

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.Ln(argument)

  Bases: `MathFunction`

  Natural logarithm.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.MathFunction(name, argument)

  Bases: `Operator`

  Base class for all unary scalar math functions.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Matrix(row_space, column_space, count=None)

  Bases: `BaseForm`, `Counted`

  An assemble linear operator between two function spaces.

  equals(other)

    Check equality.

  ufl_function_spaces()

    Get the tuple of function spaces of this coefficient.

  ufl_operands: tuple[FormArgument, ...]

class ufl.classes.MaxCellEdgeLength(domain)

  Bases: `GeometricCellQuantity`

  The maximum edge length of the cell.

  name = 'maxcelledgelength'

class ufl.classes.MaxFacetEdgeLength(domain)

  Bases: `GeometricFacetQuantity`

  The maximum edge length of the facet.

  name = 'maxfacetedgelength'

class ufl.classes.MaxValue(left, right)

  Bases: `Operator`

  Take the maximum of two values.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Measure(integral_type, domain=None, subdomain_id='everywhere', metadata=None, subdomain_data=None)

  Bases: `object`

  Representation of an integration measure.

  The Measure object holds information about integration properties to be transferred to a Form on multiplication with a scalar expression.

  integral_type()

    Return the domain type.

    Valid domain types are “cell”, “exterior_facet”, “interior_facet”, etc.

  metadata()

    Return the integral metadata.

    This data is not interpreted by UFL. It is passed to the form compiler which can ignore it or use it to compile each integral of a form in a different way.

  reconstruct(integral_type=None, subdomain_id=None, domain=None, metadata=None, subdomain_data=None)

    Construct a new Measure object with some properties replaced with new values.

    Example:

      <dm = Measure instance> b = dm.reconstruct(subdomain_id=2) c = dm.reconstruct(metadata={ “quadrature_degree”: 3 })

    Used by the call operator, so this is equivalent:

      b = dm(2) c = dm(0, { “quadrature_degree”: 3 })

  subdomain_data()

    Return the integral subdomain_data.

    This data is not interpreted by UFL. Its intension is to give a context in which the domain id is interpreted.

  subdomain_id()

    Return the domain id of this measure (integer).

  ufl_domain()

    Return the domain associated with this measure.

    This may be None or a Domain object.

class ufl.classes.MeasureProduct(*measures)

  Bases: `object`

  Represents a product of measures.

  This is a notational intermediate object to handle the notation

  > f*(dm1*dm2)

  This is work in progress and not functional. It needs support in other parts of ufl and the rest of the code generation chain.

  sub_measures()

    Return submeasures.

class ufl.classes.MeasureSum(*measures)

  Bases: `object`

  Represents a sum of measures.

  This is a notational intermediate object to translate the notation

    f*(ds(1)+ds(3))

  into

    f*ds(1) + f*ds(3)

class ufl.classes.Mesh(coordinate_element, ufl_id=None, cargo=None)

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mesh.

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  is_piecewise_linear_simplex_domain()

    Check if the domain is a piecewise linear simplex.

  iterable_like(element: AbstractFiniteElement) → Iterable[Mesh]

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  ufl_cargo()

    Return carried object that will not be used by UFL.

  ufl_cell()

    Get the cell.

  ufl_coordinate_element()

    Get the coordinate element.

  ufl_id()

    Return the ufl_id of this object.

class ufl.classes.MeshView(mesh, topological_dimension, ufl_id=None)

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mesh.

  is_piecewise_linear_simplex_domain()

    Check if the domain is a piecewise linear simplex.

  ufl_cell()

    Get the cell.

  ufl_id()

    Return the ufl_id of this object.

  ufl_mesh()

    Get the mesh.

class ufl.classes.MinCellEdgeLength(domain)

  Bases: `GeometricCellQuantity`

  The minimum edge length of the cell.

  name = 'mincelledgelength'

class ufl.classes.MinFacetEdgeLength(domain)

  Bases: `GeometricFacetQuantity`

  The minimum edge length of the facet.

  name = 'minfacetedgelength'

class ufl.classes.MinValue(left, right)

  Bases: `Operator`

  Take the minimum of two values.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.MixedFunctionSpace(*args)

  Bases: `AbstractFunctionSpace`, `UFLObject`

  Mixed function space.

  dual(*args)

    Return the dual to this function space.

    If no additional arguments are passed then a MixedFunctionSpace is returned whose components are the duals of the originals.

    If additional arguments are passed, these must be integers. In this case, the MixedFunctionSpace which is returned will have dual components in the positions corresponding to the arguments passed, and the original components in the other positions.

  num_sub_spaces()

    Return number of subspaces.

  ufl_domain()

    Return ufl domain.

  ufl_domains()

    Return ufl domains.

  ufl_element()

    Return ufl element.

  ufl_elements()

    Return ufl elements.

  ufl_sub_space(i)

    Return i-th ufl sub space.

  ufl_sub_spaces()

    Return ufl sub spaces.

class ufl.classes.MixedPullback(element: _AbstractFiniteElement)

  Bases: `AbstractPullback`

  Pull back for a mixed element.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.MultiIndex(indices)

  Bases: `Terminal`

  Represents a sequence of indices, either fixed or free.

  evaluate(x, mapping, component, index_values)

    Evaluate index.

  indices()

    Return tuple of indices.

  is_cellwise_constant()

    Check if cellwise constant.

    Always True.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  property ufl_free_indices

    Get the UFL free indices.

    This should not be used.

  property ufl_index_dimensions

    Get the UFL index dimensions.

    This should not be used.

  property ufl_shape

    Get the UFL shape.

    This should not be used.

class ufl.classes.NE(left, right)

  Bases: `BinaryCondition`

  Not equal condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.NablaDiv(f)

  Bases: `CompoundDerivative`

  Nabla div.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.NablaGrad(f)

  Bases: `CompoundDerivative`

  Nabla grad.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.NegativeRestricted(expression)

  Bases: `Restricted`

  Negative restriction.

exception ufl.classes.NonStandardPullbackException

  Bases: `BaseException`

  Exception to raise if a map is non-standard.

class ufl.classes.NotCondition(condition)

  Bases: `Condition`

  Not condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.Operator(operands=None)

  Bases: `Expr`

  Base class for all operators, i.e. non-terminal expression types.

  ufl_operands: tuple['FormArgument', ...]

class ufl.classes.OrCondition(left, right)

  Bases: `BinaryCondition`

  Or condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.classes.Outer(a, b)

  Bases: `CompoundTensorOperator`

  Outer.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.PermutationSymbol(dim)

  Bases: `ConstantValue`

  Representation of a permutation symbol.

  This is also known as the Levi-Civita symbol, antisymmetric symbol, or alternating symbol.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_shape: tuple[int, ...]

class ufl.classes.Perp(A)

  Bases: `CompoundTensorOperator`

  Perp.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = (2,)

class ufl.classes.PhysicalPullback

  Bases: `AbstractPullback`

  Physical pull back.

  This should probably be removed.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.PositiveRestricted(expression)

  Bases: `Restricted`

  Positive restriction.

class ufl.classes.Power(a, b)

  Bases: `Operator`

  Power.

  evaluate(x, mapping, component, index_values)

    Evalute.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Product(a, b)

  Bases: `Operator`

  The product of two or more UFL objects.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.QuadratureWeight(domain)

  Bases: `GeometricQuantity`

  The current quadrature weight.

  Only used inside a quadrature context.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'weight'

class ufl.classes.Real(a)

  Bases: `Operator`

  Real part.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.RealValue(value)

  Bases: `ScalarValue`

  Abstract class used to differentiate real values from complex ones.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.ReferenceCellEdgeVectors(domain)

  Bases: `GeometricCellQuantity`

  The vectors between reference cell vertices for each edge in cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RCEV'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.ReferenceCellVolume(domain)

  Bases: `GeometricCellQuantity`

  The volume of the reference cell.

  name = 'reference_cell_volume'

class ufl.classes.ReferenceCurl(f)

  Bases: `CompoundDerivative`

  Reference curl.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.classes.ReferenceDiv(f)

  Bases: `CompoundDerivative`

  Reference divergence.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.ReferenceFacetEdgeVectors(domain)

  Bases: `GeometricFacetQuantity`

  The vectors between reference cell vertices for each edge in current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RFEV'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.ReferenceFacetVolume(domain)

  Bases: `GeometricFacetQuantity`

  The volume of the reference cell of the current facet.

  name = 'reference_facet_volume'

class ufl.classes.ReferenceGrad(f)

  Bases: `CompoundDerivative`

  Reference grad.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get child from mapping and return the component asked for.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.classes.ReferenceNormal(domain)

  Bases: `GeometricFacetQuantity`

  The outwards pointing normal vector of the current facet on the reference cell.

  name = 'reference_normal'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.ReferenceRidgeVolume(domain)

  Bases: `GeometricRidgeQuantity`

  The volume of the reference cell of the current ridge.

  name = 'reference_ridge_volume'

class ufl.classes.ReferenceValue(f)

  Bases: `Operator`

  Representation of the reference cell value of a form argument.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get child from mapping and return the component asked for.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

    Get the UFL shape.

class ufl.classes.Restricted(expression)

  Bases: `Operator`

  Restriction.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  side()

    Get the side.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.RidgeCoordinate(domain)

  Bases: `GeometricRidgeQuantity`

  The coordinate in a reference cell of a ridge.

  In the context of expression integration over a ridge, represents the reference ridge coordinate of each quadrature point.

  In the context of expression evaluation in a point on a ridge, represents that point in the reference coordinate system of the ridge.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'Xe'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.RidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to spatial coordinates.

  > RJ_ij = dx_i/dXe_j

  The RidgeJacobian is the product of the Jacobian and CellRidgeJacobian:

  > RJ = dx/dXe = dx/dX dX/dXe = J * CRJ

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RJ'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.RidgeJacobianDeterminant(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-determinant of the RidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detRJ'

class ufl.classes.RidgeJacobianInverse(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-inverse of the RidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'EK'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.RidgeOrigin(domain)

  Bases: `GeometricRidgeQuantity`

  The spatial coordinate corresponding to origin of a reference ridge.

  name = 'x0e'
  property ufl_shape

    Get the UFL shape.

class ufl.classes.ScalarValue(value)

  Bases: `ConstantValue`

  A constant scalar value.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  imag()

    Imaginary part.

  real()

    Real part.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()
  value()

    Get the value.

class ufl.classes.Sin(argument)

  Bases: `MathFunction`

  Sine.

class ufl.classes.Sinh(argument)

  Bases: `MathFunction`

  Hyperbolic sine.

class ufl.classes.Skew(A)

  Bases: `CompoundTensorOperator`

  Skew.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.SobolevSpace(name, parents=None)

  Bases: `object`

  Symbolic representation of a Sobolev space.

  This implements a subset of the methods of a Python set so that finite elements and other Sobolev spaces can be tested for inclusion.

class ufl.classes.SpatialCoordinate(domain)

  Bases: `GeometricCellQuantity`

  The coordinate in a domain.

  In the context of expression integration, represents the domain coordinate of each quadrature point.

  In the context of expression evaluation in a point, represents the value of that point.

  count()

    Count.

  evaluate(x, mapping, component, index_values)

    Return the value of the coordinate.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'x'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.classes.Sqrt(argument)

  Bases: `MathFunction`

  Square root.

class ufl.classes.Sum(a, b)

  Bases: `Operator`

  Sum.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.Sym(A)

  Bases: `CompoundTensorOperator`

  Sym.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.classes.SymmetricPullback(element: _AbstractFiniteElement, symmetry: dict[tuple[int, ...], int])

  Bases: `AbstractPullback`

  Pull back for an element with symmetry.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.Tan(argument)

  Bases: `MathFunction`

  Tangent.

class ufl.classes.Tanh(argument)

  Bases: `MathFunction`

  Hyperbolic tangent.

class ufl.classes.TensorProductCell(*cells: AbstractCell)

  Bases: `AbstractCell`

  Tensor product cell.

  cellname() → str

    Return the cellname of the cell.

  has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  is_simplex() → bool

    Return True if this is a simplex cell.

  num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  reconstruct(**kwargs: Any) → AbstractCell

    Reconstruct this cell, overwriting properties by those in kwargs.

  sub_cells() → tuple[AbstractCell, ...]

    Return list of cell factors.

  sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  topological_dimension() → int

    Return the dimension of the topology of this cell.

class ufl.classes.TensorProductFunctionSpace(*function_spaces)

  Bases: `AbstractFunctionSpace`, `UFLObject`

  Tensor product function space.

  ufl_sub_spaces()

    Return ufl sub spaces.

class ufl.classes.Terminal

  Bases: `Expr`

  Base class for terminal objects.

  A terminal node in the UFL expression tree.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get self from mapping and return the component asked for.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_operands: tuple['FormArgument', ...] = ()

ufl.classes.TestFunction(function_space, part=None)

  UFL value: Create a test function argument to a form.

ufl.classes.TestFunctions(function_space)

  Create a TestFunction in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

class ufl.classes.Trace(A)

  Bases: `CompoundTensorOperator`

  Trace.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.classes.Transposed(A)

  Bases: `CompoundTensorOperator`

  Transposed tensor.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

ufl.classes.TrialFunction(function_space, part=None)

  UFL value: Create a trial function argument to a form.

ufl.classes.TrialFunctions(function_space)

  Create a TrialFunction in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

class ufl.classes.UndefinedPullback

  Bases: `AbstractPullback`

  Undefined pull back.

  This should probably be removed.

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.classes.Variable(expression, label=None)

  Bases: `Operator`

  A Variable is a representative for another expression.

  It will be used by the end-user mainly for defining a quantity to differentiate w.r.t. using diff. Example:

      e = <...>
      e = variable(e)
      f = exp(e**2)
      df = diff(f, e)

  evaluate(x, mapping, component, index_values)

    Evaluate.

  expression()

    Get expression.

  label()

    Get label.

  ufl_domains()

    Get the UFL domains.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

class ufl.classes.VariableDerivative(f, v)

  Bases: `Derivative`

  Variable Derivative.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.classes.Zero(shape=(), free_indices=(), index_dimensions=None)

  Bases: `ConstantValue`

  Representation of a zero valued expression.

  Class for representing zero tensors of different shapes.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.classes.ZeroBaseForm(arguments)

  Bases: `BaseForm`

  Description of a zero base form.

  ZeroBaseForm is idempotent with respect to assembly and is mostly used for sake of simplifying base-form expressions.

  form
  ufl_domains()

    Return all domains found in the base form.

  ufl_operands: tuple[FormArgument, ...]

## ufl.coefficient module

This module defines the Coefficient class and a number of related classes, including Constant.

class ufl.coefficient.BaseCoefficient(function_space, count=None)

  Bases: `Counted`

  UFL form argument type: Parent Representation of a form coefficient.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  ufl_domain()

    Shortcut to get the domain of the function space of this coefficient.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  ufl_element()

    Shortcut to get the finite element of the function space of this coefficient.

  ufl_function_space()

    Get the function space of this coefficient.

  property ufl_shape

    Return the associated UFL shape.

class ufl.coefficient.Coefficient(*args, **kw)

  Bases: `FormArgument`, `BaseCoefficient`

  UFL form argument type: Representation of a form coefficient.

  ufl_domains()

    Get the UFL domains.

ufl.coefficient.Coefficients(function_space)

  Create a Coefficient in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

class ufl.coefficient.Cofunction(*args, **kw)

  Bases: `BaseCoefficient`, `BaseForm`

  UFL form argument type: Representation of a form coefficient from a dual space.

  equals(other)

    Check equality.

  ufl_operands: tuple[FormArgument, ...]

## ufl.compound_expressions module

Support for compound expressions as equivalent representations using basic operators.

ufl.compound_expressions.adj_expr(A)

  Adjoint of a matrix.

ufl.compound_expressions.adj_expr_2x2(A)

  Adjoint of a 2 by 2 matrix.

ufl.compound_expressions.adj_expr_3x3(A)

  Adjoint of a 3 by 3 matrix.

ufl.compound_expressions.adj_expr_4x4(A)

  Adjoint of a 4 by 4 matrix.

ufl.compound_expressions.codeterminant_expr_nxn(A, rows, cols)

  Determinant of a n by n matrix.

ufl.compound_expressions.cofactor_expr(A)

  Cofactor of a matrix.

ufl.compound_expressions.cofactor_expr_2x2(A)

  Cofactor of a 2 by 2 matrix.

ufl.compound_expressions.cofactor_expr_3x3(A)

  Cofactor of a 3 by 3 matrix.

ufl.compound_expressions.cofactor_expr_4x4(A)

  Cofactor of a 4 by 4 matrix.

ufl.compound_expressions.cross_expr(a, b)

  Symbolic cross product.

ufl.compound_expressions.determinant_expr(A)

  Compute the (pseudo-)determinant of A.

ufl.compound_expressions.determinant_expr_2x2(B)

  Determinant of a 2 by 2 matrix.

ufl.compound_expressions.determinant_expr_3x3(A)

  Determinant of a 3 by 3 matrix.

ufl.compound_expressions.determinant_expr_nxn(A)

  Determinant of a n by n matrix.

ufl.compound_expressions.deviatoric_expr(A)

  Deviatoric of a matrix.

ufl.compound_expressions.deviatoric_expr_2x2(A)

  Deviatoric of a 2 by 2 matrix.

ufl.compound_expressions.deviatoric_expr_3x3(A)

  Deviatoric of a 3 by 3 matrix.

ufl.compound_expressions.generic_pseudo_determinant_expr(A)

  Compute the pseudo-determinant of A: sqrt(det(A.T*A)).

ufl.compound_expressions.generic_pseudo_inverse_expr(A)

  Compute the Penrose-Moore pseudo-inverse of A: (A.T*A)^-1 * A.T.

ufl.compound_expressions.inverse_expr(A)

  Compute the inverse of A.

ufl.compound_expressions.pseudo_determinant_expr(A)

  Compute the pseudo-determinant of A.

ufl.compound_expressions.pseudo_inverse_expr(A)

  Compute the Penrose-Moore pseudo-inverse of A: (A.T*A)^-1 * A.T.

## ufl.conditional module

This module defines classes for conditional expressions.

class ufl.conditional.AndCondition(left, right)

  Bases: `BinaryCondition`

  And condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.BinaryCondition(name, left, right)

  Bases: `Condition`

  Binary condition.

class ufl.conditional.Condition(operands)

  Bases: `Operator`

  Condition.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.conditional.Conditional(condition, true_value, false_value)

  Bases: `Operator`

  Conditional expression.

  In C++ these take the format (condition ? true_value : false_value).

  evaluate(x, mapping, component, index_values)

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.conditional.EQ(left, right)

  Bases: `BinaryCondition`

  Equality condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.GE(left, right)

  Bases: `BinaryCondition`

  Greater than or equal to condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.GT(left, right)

  Bases: `BinaryCondition`

  Greater than condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.LE(left, right)

  Bases: `BinaryCondition`

  Less than or equal condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.LT(left, right)

  Bases: `BinaryCondition`

  Less than condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.MaxValue(left, right)

  Bases: `Operator`

  Take the maximum of two values.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.conditional.MinValue(left, right)

  Bases: `Operator`

  Take the minimum of two values.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.conditional.NE(left, right)

  Bases: `BinaryCondition`

  Not equal condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.NotCondition(condition)

  Bases: `Condition`

  Not condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.conditional.OrCondition(left, right)

  Bases: `BinaryCondition`

  Or condition.

  evaluate(x, mapping, component, index_values)

    Evaluate.

## ufl.constant module

Support fpr non-literal values which are constant with respect to a domain.

class ufl.constant.Constant(domain, shape=(), count=None)

  Bases: `Terminal`, `Counted`

  Constant.

  is_cellwise_constant()

    Return True if the function is cellwise constant.

  ufl_domain()

    Get the UFL domain.

  ufl_domains()

    Get the UFL domains.

  property ufl_shape

    Get the UFL shape.

ufl.constant.TensorConstant(domain, count=None)

  Tensor constant.

ufl.constant.VectorConstant(domain, count=None)

  Vector constant.

## ufl.constantvalue module

This module defines classes representing constant values.

class ufl.constantvalue.ComplexValue(value)

  Bases: `ScalarValue`

  Representation of a constant, complex scalar.

  argument()

    Get the argument.

  modulus()

    Get the modulus.

class ufl.constantvalue.ConstantValue

  Bases: `Terminal`

  Constant value.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  ufl_shape: tuple[int, ...]

class ufl.constantvalue.FloatValue(value)

  Bases: `RealValue`

  Representation of a constant scalar floating point value.

class ufl.constantvalue.Identity(dim)

  Bases: `ConstantValue`

  Representation of an identity matrix.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_shape: tuple[int, ...]

class ufl.constantvalue.IntValue(value)

  Bases: `RealValue`

  Representation of a constant scalar integer value.

class ufl.constantvalue.PermutationSymbol(dim)

  Bases: `ConstantValue`

  Representation of a permutation symbol.

  This is also known as the Levi-Civita symbol, antisymmetric symbol, or alternating symbol.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_shape: tuple[int, ...]

class ufl.constantvalue.RealValue(value)

  Bases: `ScalarValue`

  Abstract class used to differentiate real values from complex ones.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.constantvalue.ScalarValue(value)

  Bases: `ConstantValue`

  A constant scalar value.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  imag()

    Imaginary part.

  real()

    Real part.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()
  value()

    Get the value.

class ufl.constantvalue.Zero(shape=(), free_indices=(), index_dimensions=None)

  Bases: `ConstantValue`

  Representation of a zero valued expression.

  Class for representing zero tensors of different shapes.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...]

ufl.constantvalue.as_ufl(expression)

  Converts expression to an Expr if possible.

ufl.constantvalue.format_float(x)

  Format float value based on global UFL precision.

ufl.constantvalue.zero(*shape)

  UFL literal constant: Return a zero tensor with the given shape.

## ufl.differentiation module

Differential operators.

class ufl.differentiation.BaseFormCoordinateDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `BaseFormDerivative`, `CoordinateDerivative`

  Derivative of a base form w.r.t. the SpatialCoordinates.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.differentiation.BaseFormDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `CoefficientDerivative`, `BaseForm`

  Derivative of a base form w.r.t the degrees of freedom in a discrete Coefficient.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.differentiation.BaseFormOperatorCoordinateDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `BaseFormOperatorDerivative`, `CoordinateDerivative`

  Derivative of a base form operator w.r.t. the SpatialCoordinates.

  property ufl_free_indices

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_index_dimensions

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_shape

    Return the UFL shape of the coefficient produced by the operator.

class ufl.differentiation.BaseFormOperatorDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `BaseFormDerivative`, `BaseFormOperator`

  Derivative of a base form operator w.r.t the degrees of freedom in a discrete Coefficient.

  argument_slots(outer_form=False)

    Return a tuple of expressions containing argument and coefficient based expressions.

  property ufl_free_indices

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_index_dimensions

    Built-in immutable sequence.

    If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

    If the argument is a tuple, the return value is the same object.

  property ufl_shape

    Return the UFL shape of the coefficient produced by the operator.

class ufl.differentiation.CoefficientDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `Derivative`

  Derivative of form integrand w.r.t. the degrees of freedom in a discrete Coefficient.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.differentiation.CompoundDerivative(operands)

  Bases: `Derivative`

  Base class for all compound derivative types.

  ufl_free_indices: tuple[int, ...]
  ufl_shape: tuple[int, ...]

class ufl.differentiation.CoordinateDerivative(integrand, coefficients, arguments, coefficient_derivatives)

  Bases: `CoefficientDerivative`

  Derivative of the integrand of a form w.r.t. the SpatialCoordinates.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.differentiation.Curl(f)

  Bases: `CompoundDerivative`

  Compound derivative.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.differentiation.Derivative(operands)

  Bases: `Operator`

  Base class for all derivative types.

  ufl_free_indices: tuple[int, ...]
  ufl_shape: tuple[int, ...]

class ufl.differentiation.Div(f)

  Bases: `CompoundDerivative`

  Div.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.differentiation.Grad(f)

  Bases: `CompoundDerivative`

  Grad.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get child from mapping and return the component asked for.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.differentiation.NablaDiv(f)

  Bases: `CompoundDerivative`

  Nabla div.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.differentiation.NablaGrad(f)

  Bases: `CompoundDerivative`

  Nabla grad.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.differentiation.ReferenceCurl(f)

  Bases: `CompoundDerivative`

  Reference curl.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.differentiation.ReferenceDiv(f)

  Bases: `CompoundDerivative`

  Reference divergence.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.differentiation.ReferenceGrad(f)

  Bases: `CompoundDerivative`

  Reference grad.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get child from mapping and return the component asked for.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.differentiation.VariableDerivative(f, v)

  Bases: `Derivative`

  Variable Derivative.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...]

## ufl.domain module

Types for representing a geometric domain.

class ufl.domain.AbstractDomain(topological_dimension, geometric_dimension)

  Bases: `object`

  Symbolic representation of a geometric domain.

  Domain has only a geometric and a topological dimension.

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  geometric_dimension()

    Return the dimension of the space this domain is embedded in.

  iterable_like(element: AbstractFiniteElement) → Iterable[Mesh] | MeshSequence

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  topological_dimension()

    Return the dimension of the topology of this domain.

class ufl.domain.Mesh(coordinate_element, ufl_id=None, cargo=None)

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mesh.

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  is_piecewise_linear_simplex_domain()

    Check if the domain is a piecewise linear simplex.

  iterable_like(element: AbstractFiniteElement) → Iterable[Mesh]

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  ufl_cargo()

    Return carried object that will not be used by UFL.

  ufl_cell()

    Get the cell.

  ufl_coordinate_element()

    Get the coordinate element.

  ufl_id()

    Return the ufl_id of this object.

class ufl.domain.MeshSequence(meshes: Sequence[Mesh])

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mixed mesh.

  This class represents a collection of meshes that, along with a `MixedElement`, represent a mixed function space defined on multiple domains. This abstraction allows for defining the mixed function space with the conventional `FunctionSpace` class and integrating multi-domain problems seamlessly.

  Currently, all component meshes must have the same cell type (and thus the same topological dimension).

  Currently, one can only perform cell integrations when `MeshSequence` is used.

      cell = triangle
      mesh0 = Mesh(FiniteElement("Lagrange", cell, 1, (2,), identity_pullback, H1))
      mesh1 = Mesh(FiniteElement("Lagrange", cell, 1, (2,), identity_pullback, H1))
      domain = MeshSequence([mesh0, mesh1])
      elem0 = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
      elem1 = FiniteElement("Lagrange", cell, 2, (), identity_pullback, H1)
      elem = MixedElement([elem0, elem1])
      V = FunctionSpace(domain, elem)
      v = TestFunction(V)
      v0, v1 = split(v)

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  iterable_like(element: AbstractFiniteElement) → MeshSequence

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  ufl_cell()

    Get the cell.

class ufl.domain.MeshView(mesh, topological_dimension, ufl_id=None)

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mesh.

  is_piecewise_linear_simplex_domain()

    Check if the domain is a piecewise linear simplex.

  ufl_cell()

    Get the cell.

  ufl_id()

    Return the ufl_id of this object.

  ufl_mesh()

    Get the mesh.

ufl.domain.as_domain(domain)

  Convert any valid object to an AbstractDomain type.

ufl.domain.extract_domains(expr: Expr | Form, expand_mesh_sequence: bool = True)

  Return all domains expression is defined on.

  Args:

    expr: Expr or Form. expand_mesh_sequence: If True, MeshSequence components are expanded.

  Returns:

    tuple of domains.

ufl.domain.extract_unique_domain(expr, expand_mesh_sequence: bool = True)

  Return the single unique domain expression is defined on or throw an error.

  Args:

    expr: Expr or Form. expand_mesh_sequence: If True, MeshSequence components are expanded.

  Returns:

    domain.

ufl.domain.find_geometric_dimension(expr)

  Find the geometric dimension of an expression.

ufl.domain.join_domains(domains: Sequence[AbstractDomain], expand_mesh_sequence: bool = True)

  Take a list of domains and return a set with only unique domain objects.

  Args:

    domains: Sequence of domains. expand_mesh_sequence: If True, MeshSequence components are expanded.

  Returns:

    set of domains.

ufl.domain.sort_domains(domains: Sequence[AbstractDomain])

  Sort domains in a canonical ordering.

  Args:

    domains: Sequence of domains.

  Returns:

    tuple of sorted domains.

## ufl.duals module

Predicates for recognising duals.

ufl.duals.is_dual(object)

  Determine if the object belongs to a dual space.

  This is not simply the negation of is_primal, because a mixed function space containing both primal and dual components is neither primal nor dual.

ufl.duals.is_primal(object)

  Determine if the object belongs to a primal space.

  This is not simply the negation of is_dual, because a mixed function space containing both primal and dual components is neither primal nor dual.

## ufl.equation module

The Equation class, used to express equations like a == L.

class ufl.equation.Equation(lhs, rhs)

  Bases: `object`

  Equation.

  This class is used to represent equations expressed by the “==” operator. Examples include a == L and F == 0 where a, L and F are Form objects.

## ufl.exprcontainers module

This module defines special types for representing mapping of expressions to expressions.

class ufl.exprcontainers.ExprList(*operands)

  Bases: `Operator`

  List of Expr objects. For internal use, never to be created by end users.

  free_indices()

    Get the free indices.

  index_dimensions()

    Get the index dimensions.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

class ufl.exprcontainers.ExprMapping(*operands)

  Bases: `Operator`

  Mapping of Expr objects. For internal use, never to be created by end users.

  free_indices()

    Get the free indices.

  index_dimensions()

    Get the index dimensions.

  ufl_domains()

    Get the UFL domains.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

## ufl.exprequals module

Expr equals.

ufl.exprequals.expr_equals(self, other)

  Checks whether the two expressions are represented the exact same way.

  This does not check if the expressions are mathematically equal or equivalent! Used by sets and dicts.

## ufl.exproperators module

Expr operators.

This module attaches special functions to Expr. This way we avoid circular dependencies between e.g. Sum and its superclass Expr.

## ufl.finiteelement module

This module defines the UFL finite element classes.

class ufl.finiteelement.AbstractFiniteElement

  Bases: `ABC`

  Base class for all finite elements.

  To make your element library compatible with UFL, you should make a subclass of AbstractFiniteElement and provide implementions of all the abstract methods and properties. All methods and properties that are not marked as abstract are implemented here and should not need to be overwritten in your subclass.

  An example of how the methods in your subclass could be implemented can be found in Basix; see https://github.com/FEniCS/basix/blob/main/python/basix/ufl.py

  abstract property cell: Cell

    Return the cell of the finite element.

  abstract property embedded_subdegree: int

    Degree of the maximum degree Lagrange space that is spanned by this element.

    This returns the degree of the highest degree Lagrange space such that the polynomial space of the Lagrange space is a subspace of this element’s polynomial space. If this element’s polynomial space does not include the constant function, this function should return -1.

    Note that on a simplex cells, the polynomial space of Lagrange space is a complete polynomial space, but on other cells this is not true. For example, on quadrilateral cells, the degree 1 Lagrange space includes the degree 2 polynomial xy.

  abstract property embedded_superdegree: int | None

    Degree of the minimum degree Lagrange space that spans this element.

    This returns the degree of the lowest degree Lagrange space such that the polynomial space of the Lagrange space is a superspace of this element’s polynomial space. If this element contains basis functions that are not in any Lagrange space, this function should return None.

    Note that on a simplex cells, the polynomial space of Lagrange space is a complete polynomial space, but on other cells this is not true. For example, on quadrilateral cells, the degree 1 Lagrange space includes the degree 2 polynomial xy.

  is_cellwise_constant() → bool

    Check whether this element is spatially constant over each cell.

  property num_sub_elements: int

    Return number of sub-elements.

    This function does not recurse: ie it does not count the sub-elements of sub-elements.

  abstract property pullback: AbstractPullback

    Return the pullback for this element.

  abstract property reference_value_shape: tuple[int, ...]

    Return the shape of the value space on the reference cell.

  property reference_value_size: int

    Return the integer product of the reference value shape.

  abstract property sobolev_space: SobolevSpace

    Return the underlying Sobolev space.

  abstract property sub_elements: Sequence

    Return list of sub-elements.

    This function does not recurse: ie it does not extract the sub-elements of sub-elements.

## ufl.form module

The Form class.

class ufl.form.BaseForm

  Bases: `object`

  Description of an object containing arguments.

  arguments()

    Return all `Argument` objects found in form.

  coefficients()

    Return all `Coefficient` objects found in form.

  empty()

    Returns whether the BaseForm has no components.

  geometric_quantities()

    Return all `GeometricQuantity` objects found in form.

  ufl_domain()

    Return the single geometric integration domain occuring in the base form.

    Fails if multiple domains are found.

class ufl.form.Form(integrals)

  Bases: `BaseForm`

  Description of a weak form consisting of a sum of integrals over subdomains.

  base_form_operators()

    Return all `BaseFormOperator` objects found in form.

  coefficient_numbering()

    Return a contiguous numbering of coefficients in a mapping `{coefficient:number}`.

  coefficients()

    Return all `Coefficient` objects found in form.

  constant_numbering()

    Return a contiguous numbering of constants in a mapping `{constant:number}`.

  constants()

    Get constants.

  domain_numbering()

    Return a contiguous numbering of domains in a mapping `{domain:number}`.

  empty()

    Returns whether the form has no integrals.

  equals(other)

    Evaluate `bool(lhs_form == rhs_form)`.

  geometric_dimension()

    Return the geometric dimension shared by all domains and functions in this form.

  integrals()

    Return a sequence of all integrals in form.

  integrals_by_domain(domain)

    Return a sequence of all integrals with a particular integration domain.

  integrals_by_type(integral_type)

    Return a sequence of all integrals with a particular domain type.

  signature()

    Signature for use with jit cache (independent of incidental numbering of indices etc).

  subdomain_data()

    Returns a mapping on the form `{domain:{integral_type: subdomain_data}}`.

  terminal_numbering()

    Return a contiguous numbering for all counted objects in the form.

    The returned object is mapping from terminal to its number (an integer).

    The numbering is computed per type so `Coefficient`, `Constant`, etc will each be numbered from zero.

  ufl_cell()

    Return the single cell this form is defined on.

    Fails if multiple cells are found.

  ufl_domains()

    Return the geometric integration domains occuring in the form.

    NB! This does not include domains of coefficients defined on other meshes.

    The return type is a tuple even if only a single domain exists.

class ufl.form.FormSum(*args, **kwargs)

  Bases: `BaseForm`

  Form sum.

  Description of a weighted sum of variational forms and form-like objects components is the list of Forms to be summed arg_weights is a list of tuples of component index and weight

  components()

    Get components.

  empty()

    Returns whether the FormSum has no components.

  equals(other)

    Evaluate `bool(lhs_form == rhs_form)`.

  ufl_domains()

    Return all domains found in the base form.

  ufl_operands: tuple[FormArgument, ...]
  weights()

    Get weights.

class ufl.form.ZeroBaseForm(arguments)

  Bases: `BaseForm`

  Description of a zero base form.

  ZeroBaseForm is idempotent with respect to assembly and is mostly used for sake of simplifying base-form expressions.

  form
  ufl_domains()

    Return all domains found in the base form.

  ufl_operands: tuple[FormArgument, ...]

ufl.form.as_form(form)

  Convert to form if not a form, otherwise return form.

## ufl.formoperators module

Various high level ways to transform a complete Form into a new Form.

ufl.formoperators.action(form, coefficient=None, derivatives_expanded=None)

  Get the action.

  Given a bilinear form, return a linear form with an additional coefficient, representing the action of the form on the coefficient. This can be used for matrix-free methods. For formbase objects,coefficient can be any object of the correct type, and this function returns an Action object.

  When action is being called multiple times on the same form, expanding derivatives become expensive -> derivatives_expanded enables to use caching mechanisms to avoid that.

ufl.formoperators.adjoint(form, reordered_arguments=None, derivatives_expanded=None)

  Get the adjoint.

  Given a combined bilinear form, compute the adjoint form by changing the ordering (count) of the test and trial functions, and taking the complex conjugate of the result.

  By default, new `Argument` objects will be created with opposite ordering. However, if the adjoint form is to be added to other forms later, their arguments must match. In that case, the user must provide a tuple *reordered_arguments*=(u2,v2).

  If the form is a baseform instance instead of a Form object, we return an Adjoint object instructing the adjoint to be computed at a later point.

  When adjoint is being called multiple times on the same form, expanding derivatives become expensive -> derivatives_expanded enables to use caching mechanisms to avoid that.

ufl.formoperators.derivative(form, coefficient, argument=None, coefficient_derivatives=None)

  Compute the Gateaux derivative of form w.r.t. coefficient in direction of argument.

  If the argument is omitted, a new `Argument` is created in the same space as the coefficient, with argument number one higher than the highest one in the form.

  The resulting form has one additional `Argument` in the same finite element space as the coefficient.

  A tuple of `Coefficient` s may be provided in place of a single `Coefficient`, in which case the new `Argument` argument is based on a `MixedElement` created from this tuple.

  An indexed `Coefficient` from a mixed space may be provided, in which case the argument should be in the corresponding subspace of the coefficient space.

  If provided, coefficient_derivatives should be a mapping from `Coefficient` instances to their derivatives w.r.t. coefficient.

ufl.formoperators.energy_norm(form, coefficient=None)

  Get the energy norm.

  Given a bilinear form a and a coefficient f, return the functional \(a(f,f)\).

ufl.formoperators.extract_blocks(form: Form, i: int | None = None, j: int | None = None, replace_argument: bool = True)

  Extract blocks.

  Given a linear or bilinear form on a mixed space, extract the block corresponding to the indices ix, iy.

  Example:

    a = inner(grad(u), grad(v))*dx + div(u)*q*dx + div(v)*p*dx extract_blocks(a, 0, 0) -> inner(grad(u), grad(v))*dx extract_blocks(a) -> [inner(grad(u), grad(v))*dx, div(v)*p*dx, div(u)*q*dx, 0]

ufl.formoperators.functional(form)

  Extract the functional part of form.

ufl.formoperators.lhs(form)

  Get the left hand side.

  Given a combined bilinear and linear form, extract the left hand side (bilinear form part).

  Example:

    a = u*v*dx + f*v*dx a = lhs(a) -> u*v*dx

ufl.formoperators.rhs(form)

  Get the right hand side.

  Given a combined bilinear and linear form, extract the right hand side (negated linear form part).

  Example:

    a = u*v*dx + f*v*dx L = rhs(a) -> -f*v*dx

ufl.formoperators.sensitivity_rhs(a, u, L, v)

  Compute the right hand side for a sensitivity calculation system.

  The derivation behind this computation is as follows. Assume a, L to be bilinear and linear forms corresponding to the assembled linear system

  \[Ax = b.\]

  Where x is the vector of the discrete function corresponding to u. Let v be some scalar variable this equation depends on. Then we can write

  \[ \begin{align}\begin{aligned}\begin{split}0 = \\frac{d}{dv}(Ax-b) = \\frac{dA}{dv} x + A \\frac{dx}{dv} - \\frac{db}{dv},\end{split}\\\begin{split}A \\frac{dx}{dv} = \\frac{db}{dv} - \\frac{dA}{dv} x,\end{split}\end{aligned}\end{align} \]

  and solve this system for \(\\frac{dx}{dv}\), using the same bilinear form a and matrix A from the original system. Assume the forms are written

      v = variable(v_expression)
      L = IL(v) * dx
      a = Ia(v) * dx

  where `IL` and `Ia` are integrand expressions. Define a `Coefficient u` representing the solution to the equations. Then we can compute \(\\frac{db}{dv}\) and \(\\frac{dA}{dv}\) from the forms

      da = diff(a, v)
      dL = diff(L, v)

  and the action of `da` on `u` by

      dau = action(da, u)

  In total, we can build the right hand side of the system to compute \(\\frac{du}{dv}\) with the single line

      dL = diff(L, v) - action(diff(a, v), u)

  or, using this function,

      dL = sensitivity_rhs(a, u, L, v)

ufl.formoperators.set_list_item(li, i, v)

  Set an item in a nested list.

ufl.formoperators.system(form)

  Split a form into the left hand side and right hand side.

  See `lhs` and `rhs`.

ufl.formoperators.zero_lists(shape)

  Createa list of zeros of the given shape.

## ufl.functionspace module

Types for representing function spaces.

class ufl.functionspace.AbstractFunctionSpace

  Bases: `object`

  Abstract function space.

  ufl_sub_spaces()

    Return ufl sub spaces.

class ufl.functionspace.BaseFunctionSpace(domain, element, label='')

  Bases: `AbstractFunctionSpace`, `UFLObject`

  Base function space.

  property components: dict[tuple[int, ...], int]

    Get the numbering of the components of the element of this space.

    Returns:

      A map from the components of the values on a physical cell (eg (0, 1)) to flat component numbers on the reference cell (eg 1)

  label()

    Return label of boundary domains to differentiate restricted and unrestricted.

  ufl_domain()

    Return ufl domain.

  ufl_domains()

    Return ufl domains.

  ufl_element()

    Return ufl element.

  ufl_sub_spaces()

    Return ufl sub spaces.

  property value_shape: tuple[int, ...]

    Return the shape of the value space on a physical domain.

  property value_size: int

    Return the integer product of the value shape on a physical domain.

class ufl.functionspace.DualSpace(domain, element, label='')

  Bases: `BaseFunctionSpace`, `UFLObject`

  Representation of a Dual space.

  dual()

    Get the dual of the space.

class ufl.functionspace.FunctionSpace(domain, element, label='')

  Bases: `BaseFunctionSpace`, `UFLObject`

  Representation of a Function space.

  dual()

    Get the dual of the space.

class ufl.functionspace.MixedFunctionSpace(*args)

  Bases: `AbstractFunctionSpace`, `UFLObject`

  Mixed function space.

  dual(*args)

    Return the dual to this function space.

    If no additional arguments are passed then a MixedFunctionSpace is returned whose components are the duals of the originals.

    If additional arguments are passed, these must be integers. In this case, the MixedFunctionSpace which is returned will have dual components in the positions corresponding to the arguments passed, and the original components in the other positions.

  num_sub_spaces()

    Return number of subspaces.

  ufl_domain()

    Return ufl domain.

  ufl_domains()

    Return ufl domains.

  ufl_element()

    Return ufl element.

  ufl_elements()

    Return ufl elements.

  ufl_sub_space(i)

    Return i-th ufl sub space.

  ufl_sub_spaces()

    Return ufl sub spaces.

class ufl.functionspace.TensorProductFunctionSpace(*function_spaces)

  Bases: `AbstractFunctionSpace`, `UFLObject`

  Tensor product function space.

  ufl_sub_spaces()

    Return ufl sub spaces.

## ufl.geometry module

Types for representing symbolic expressions for geometric quantities.

class ufl.geometry.CellCoordinate(domain)

  Bases: `GeometricCellQuantity`

  The coordinate in a reference cell.

  In the context of expression integration, represents the reference cell coordinate of each quadrature point.

  In the context of expression evaluation in a point in a cell, represents that point in the reference coordinate system of the cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'X'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellDiameter(domain)

  Bases: `GeometricCellQuantity`

  The diameter of the cell, i.e., maximal distance of two points in the cell.

  name = 'diameter'

class ufl.geometry.CellEdgeVectors(domain)

  Bases: `GeometricCellQuantity`

  The vectors between physical cell vertices for each edge in cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CEV'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellFacetJacobian(domain)

  Bases: `GeometricFacetQuantity`

  The Jacobian of the mapping from reference facet to reference cell coordinates.

  CFJ_ij = dX_i/dXf_j

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CFJ'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellFacetJacobianDeterminant(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-determinant of the CellFacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detCFJ'

class ufl.geometry.CellFacetJacobianInverse(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-inverse of the CellFacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CFK'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellFacetOrigin(domain)

  Bases: `GeometricFacetQuantity`

  The reference cell coordinate corresponding to origin of a reference facet.

  name = 'X0f'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellNormal(domain)

  Bases: `GeometricCellQuantity`

  The upwards pointing normal vector of the current manifold cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'cell_normal'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.geometry.CellOrientation(domain)

  Bases: `GeometricCellQuantity`

  The orientation (+1/-1) of the current cell.

  For non-manifold cells (tdim == gdim), this equals the sign of the Jacobian determinant, i.e. +1 if the physical cell is oriented the same way as the reference cell and -1 otherwise.

  For manifold cells of tdim==gdim-1 this is input data belonging to the mesh, used to distinguish between the sides of the manifold.

  name = 'cell_orientation'

class ufl.geometry.CellOrigin(domain)

  Bases: `GeometricCellQuantity`

  The spatial coordinate corresponding to origin of a reference cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'x0'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellRidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to reference cell coordinates.

  CRJ_ij = dX_i/dXe_j

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CRJ'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellRidgeJacobianDeterminant(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-determinant of the CellRidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detCRJ'

class ufl.geometry.CellRidgeJacobianInverse(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-inverse of the RidgeFacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CEK'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellRidgeOrigin(domain)

  Bases: `GeometricRidgeQuantity`

  The reference cell coordinate corresponding to origin of a reference ridge.

  name = 'X0e'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellVertices(domain)

  Bases: `GeometricCellQuantity`

  Physical cell vertices.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'CV'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.CellVolume(domain)

  Bases: `GeometricCellQuantity`

  The volume of the cell.

  name = 'volume'

class ufl.geometry.Circumradius(domain)

  Bases: `GeometricCellQuantity`

  The circumradius of the cell.

  name = 'circumradius'

class ufl.geometry.FacetArea(domain)

  Bases: `GeometricFacetQuantity`

  The area of the facet.

  name = 'facetarea'

class ufl.geometry.FacetCoordinate(domain)

  Bases: `GeometricFacetQuantity`

  The coordinate in a reference cell of a facet.

  In the context of expression integration over a facet, represents the reference facet coordinate of each quadrature point.

  In the context of expression evaluation in a point on a facet, represents that point in the reference coordinate system of the facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'Xf'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.FacetEdgeVectors(domain)

  Bases: `GeometricFacetQuantity`

  The vectors between physical cell vertices for each edge in current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FEV'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.FacetJacobian(domain)

  Bases: `GeometricFacetQuantity`

  The Jacobian of the mapping from reference facet to spatial coordinates.

  > FJ_ij = dx_i/dXf_j

  The FacetJacobian is the product of the Jacobian and CellFacetJacobian:

  > FJ = dx/dXf = dx/dX dX/dXf = J * CFJ

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FJ'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.FacetJacobianDeterminant(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-determinant of the FacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detFJ'

class ufl.geometry.FacetJacobianInverse(domain)

  Bases: `GeometricFacetQuantity`

  The pseudo-inverse of the FacetJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FK'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.FacetNormal(domain)

  Bases: `GeometricFacetQuantity`

  The outwards pointing normal vector of the current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'n'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.geometry.FacetOrientation(domain)

  Bases: `GeometricFacetQuantity`

  The orientation (+1/-1) of the current facet relative to the reference cell.

  name = 'facet_orientation'

class ufl.geometry.FacetOrigin(domain)

  Bases: `GeometricFacetQuantity`

  The spatial coordinate corresponding to origin of a reference facet.

  name = 'x0f'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.FacetRidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to reference facet coordinates.

  FRJ_ij = dXf_i/dXe_j

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'FRJ'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.GeometricCellQuantity(domain)

  Bases: `GeometricQuantity`

  Geometric cell quantity.

class ufl.geometry.GeometricFacetQuantity(domain)

  Bases: `GeometricQuantity`

  Geometric facet quantity.

class ufl.geometry.GeometricQuantity(domain)

  Bases: `Terminal`

  Geometric quantity.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  ufl_domains()

    Get the UFL domains.

  ufl_shape: tuple[int, ...] = ()

class ufl.geometry.GeometricRidgeQuantity(domain)

  Bases: `GeometricQuantity`

  Geometric ridge quantity.

class ufl.geometry.Jacobian(domain)

  Bases: `GeometricCellQuantity`

  The Jacobian of the mapping from reference cell to spatial coordinates.

  \[\begin{split}J_{ij} = \\frac{dx_i}{dX_j}\end{split}\]
  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'J'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.geometry.JacobianDeterminant(domain)

  Bases: `GeometricCellQuantity`

  The determinant of the Jacobian.

  Represents the signed determinant of a square Jacobian or the pseudo-determinant of a non-square Jacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detJ'

class ufl.geometry.JacobianInverse(domain)

  Bases: `GeometricCellQuantity`

  The inverse of the Jacobian.

  Represents the inverse of a square Jacobian or the pseudo-inverse of a non-square Jacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'K'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.geometry.MaxCellEdgeLength(domain)

  Bases: `GeometricCellQuantity`

  The maximum edge length of the cell.

  name = 'maxcelledgelength'

class ufl.geometry.MaxFacetEdgeLength(domain)

  Bases: `GeometricFacetQuantity`

  The maximum edge length of the facet.

  name = 'maxfacetedgelength'

class ufl.geometry.MinCellEdgeLength(domain)

  Bases: `GeometricCellQuantity`

  The minimum edge length of the cell.

  name = 'mincelledgelength'

class ufl.geometry.MinFacetEdgeLength(domain)

  Bases: `GeometricFacetQuantity`

  The minimum edge length of the facet.

  name = 'minfacetedgelength'

class ufl.geometry.QuadratureWeight(domain)

  Bases: `GeometricQuantity`

  The current quadrature weight.

  Only used inside a quadrature context.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'weight'

class ufl.geometry.ReferenceCellEdgeVectors(domain)

  Bases: `GeometricCellQuantity`

  The vectors between reference cell vertices for each edge in cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RCEV'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.ReferenceCellVolume(domain)

  Bases: `GeometricCellQuantity`

  The volume of the reference cell.

  name = 'reference_cell_volume'

class ufl.geometry.ReferenceFacetEdgeVectors(domain)

  Bases: `GeometricFacetQuantity`

  The vectors between reference cell vertices for each edge in current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RFEV'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.ReferenceFacetVolume(domain)

  Bases: `GeometricFacetQuantity`

  The volume of the reference cell of the current facet.

  name = 'reference_facet_volume'

class ufl.geometry.ReferenceNormal(domain)

  Bases: `GeometricFacetQuantity`

  The outwards pointing normal vector of the current facet on the reference cell.

  name = 'reference_normal'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.ReferenceRidgeVolume(domain)

  Bases: `GeometricRidgeQuantity`

  The volume of the reference cell of the current ridge.

  name = 'reference_ridge_volume'

class ufl.geometry.RidgeCoordinate(domain)

  Bases: `GeometricRidgeQuantity`

  The coordinate in a reference cell of a ridge.

  In the context of expression integration over a ridge, represents the reference ridge coordinate of each quadrature point.

  In the context of expression evaluation in a point on a ridge, represents that point in the reference coordinate system of the ridge.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'Xe'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.RidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to spatial coordinates.

  > RJ_ij = dx_i/dXe_j

  The RidgeJacobian is the product of the Jacobian and CellRidgeJacobian:

  > RJ = dx/dXe = dx/dX dX/dXe = J * CRJ

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RJ'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.RidgeJacobianDeterminant(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-determinant of the RidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detRJ'

class ufl.geometry.RidgeJacobianInverse(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-inverse of the RidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'EK'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.RidgeOrigin(domain)

  Bases: `GeometricRidgeQuantity`

  The spatial coordinate corresponding to origin of a reference ridge.

  name = 'x0e'
  property ufl_shape

    Get the UFL shape.

class ufl.geometry.SpatialCoordinate(domain)

  Bases: `GeometricCellQuantity`

  The coordinate in a domain.

  In the context of expression integration, represents the domain coordinate of each quadrature point.

  In the context of expression evaluation in a point, represents the value of that point.

  count()

    Count.

  evaluate(x, mapping, component, index_values)

    Return the value of the coordinate.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'x'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

## ufl.index_combination_utils module

Utilities for analysing and manipulating free index tuples.

ufl.index_combination_utils.create_slice_indices(component, shape, fi)

  Create slice indices.

ufl.index_combination_utils.merge_nonoverlapping_indices(a, b)

  Merge non-overlapping free indices into one representation.

  Example:

    C[i,j,r,s] = outer(A[i,s], B[j,r]) A, B -> (i,j,r,s), (idim,jdim,rdim,sdim)

ufl.index_combination_utils.merge_overlapping_indices(afi, afid, bfi, bfid)

  Merge overlapping free indices into one free and one repeated representation.

  Example:

    C[j,r] := A[i,j,k] * B[i,r,k] A, B -> (j,r), (jdim,rdim), (i,k), (idim,kdim)

ufl.index_combination_utils.merge_unique_indices(afi, afid, bfi, bfid)

  Merge two pairs of (index ids, index dimensions) sequences into one pair without duplicates.

  The id tuples afi, bfi are assumed already sorted by id. Given a list of (id, dim) tuples already sorted by id, return a unique list with duplicates removed. Also checks that the dimensions of duplicates are matching.

ufl.index_combination_utils.remove_indices(fi, fid, rfi)

  Remove indices.

ufl.index_combination_utils.unique_sorted_indices(indices)

  Get unique sorted indices.

  Given a list of (id, dim) tuples already sorted by id, return a unique list with duplicates removed. Also checks that the dimensions of duplicates are matching.

## ufl.indexed module

This module defines the Indexed class.

class ufl.indexed.Indexed(expression, multiindex)

  Bases: `Operator`

  Indexed expression.

  evaluate(x, mapping, component, index_values, derivatives=())

    Evaluate.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

## ufl.indexsum module

This module defines the IndexSum class.

class ufl.indexsum.IndexSum(summand, index)

  Bases: `Operator`

  Index sum.

  dimension()

    Get dimension.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  index()

    Get index.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  property ufl_shape

    Get UFL shape.

## ufl.integral module

The Integral class.

class ufl.integral.Integral(integrand, integral_type, domain, subdomain_id, metadata, subdomain_data)

  Bases: `object`

  An integral over a single domain.

  integral_type()

    Return the domain type of this integral.

  integrand()

    Return the integrand expression, which is an `Expr` instance.

  metadata()

    Return the compiler metadata this integral has been annotated with.

  reconstruct(integrand=None, integral_type=None, domain=None, subdomain_id=None, metadata=None, subdomain_data=None)

    Construct a new Integral object with some properties replaced with new values.

    Example:

      <a = Integral instance> b = a.reconstruct(expand_compounds(a.integrand())) c = a.reconstruct(metadata={‘quadrature_degree’:2})

  subdomain_data()

    Return the domain data of this integral.

  subdomain_id()

    Return the subdomain id of this integral.

  ufl_domain()

    Return the integration domain of this integral.

## ufl.integral_domain module

Integral domains.

class ufl.integral_domain.AbstractIntegralDomain

  Bases: `ABC`

  Abstract base class for integral domain.

  abstract property integral_type: str

    Integral type.

class ufl.integral_domain.DSIntegralDomain(coordinate_element_positive_side: AbstractFiniteElement, coordinate_element_negative_side: AbstractFiniteElement, facet_type: AbstractCell)

  Bases: `AbstractIntegralDomain`

  Integral domain for dS.

  property integral_type: str

    Integral type.

class ufl.integral_domain.DsIntegralDomain(coordinate_element: AbstractFiniteElement, facet_type: AbstractCell)

  Bases: `AbstractIntegralDomain`

  Integral domain for ds.

  property integral_type: str

    Integral type.

class ufl.integral_domain.DxIntegralDomain(coordinate_element: AbstractFiniteElement)

  Bases: `AbstractIntegralDomain`

  Integral domain for dx.

  property integral_type: str

    Integral type.

## ufl.mathfunctions module

This module provides basic mathematical functions.

class ufl.mathfunctions.Acos(argument)

  Bases: `MathFunction`

  Inverse cosine.

class ufl.mathfunctions.Asin(argument)

  Bases: `MathFunction`

  Inverse sine.

class ufl.mathfunctions.Atan(argument)

  Bases: `MathFunction`

  Inverse tangent.

class ufl.mathfunctions.Atan2(arg1, arg2)

  Bases: `Operator`

  Inverse tangent with two inputs.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.mathfunctions.BesselFunction(name, nu, argument)

  Bases: `Operator`

  Base class for all bessel functions.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.mathfunctions.BesselI(nu, argument)

  Bases: `BesselFunction`

  Bessel I function.

class ufl.mathfunctions.BesselJ(nu, argument)

  Bases: `BesselFunction`

  Bessel J function.

class ufl.mathfunctions.BesselK(nu, argument)

  Bases: `BesselFunction`

  Bessel K function.

class ufl.mathfunctions.BesselY(nu, argument)

  Bases: `BesselFunction`

  Bessel Y function.

class ufl.mathfunctions.Cos(argument)

  Bases: `MathFunction`

  Cosine.

class ufl.mathfunctions.Cosh(argument)

  Bases: `MathFunction`

  Hyperbolic cosine.

class ufl.mathfunctions.Erf(argument)

  Bases: `MathFunction`

  Erf function.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.mathfunctions.Exp(argument)

  Bases: `MathFunction`

  Exponentiation..

class ufl.mathfunctions.Ln(argument)

  Bases: `MathFunction`

  Natural logarithm.

  evaluate(x, mapping, component, index_values)

    Evaluate.

class ufl.mathfunctions.MathFunction(name, argument)

  Bases: `Operator`

  Base class for all unary scalar math functions.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.mathfunctions.Sin(argument)

  Bases: `MathFunction`

  Sine.

class ufl.mathfunctions.Sinh(argument)

  Bases: `MathFunction`

  Hyperbolic sine.

class ufl.mathfunctions.Sqrt(argument)

  Bases: `MathFunction`

  Square root.

class ufl.mathfunctions.Tan(argument)

  Bases: `MathFunction`

  Tangent.

class ufl.mathfunctions.Tanh(argument)

  Bases: `MathFunction`

  Hyperbolic tangent.

## ufl.matrix module

This module defines the Matrix class.

class ufl.matrix.Matrix(row_space, column_space, count=None)

  Bases: `BaseForm`, `Counted`

  An assemble linear operator between two function spaces.

  equals(other)

    Check equality.

  ufl_function_spaces()

    Get the tuple of function spaces of this coefficient.

  ufl_operands: tuple[FormArgument, ...]

## ufl.measure module

The Measure class.

class ufl.measure.Measure(integral_type, domain=None, subdomain_id='everywhere', metadata=None, subdomain_data=None)

  Bases: `object`

  Representation of an integration measure.

  The Measure object holds information about integration properties to be transferred to a Form on multiplication with a scalar expression.

  integral_type()

    Return the domain type.

    Valid domain types are “cell”, “exterior_facet”, “interior_facet”, etc.

  metadata()

    Return the integral metadata.

    This data is not interpreted by UFL. It is passed to the form compiler which can ignore it or use it to compile each integral of a form in a different way.

  reconstruct(integral_type=None, subdomain_id=None, domain=None, metadata=None, subdomain_data=None)

    Construct a new Measure object with some properties replaced with new values.

    Example:

      <dm = Measure instance> b = dm.reconstruct(subdomain_id=2) c = dm.reconstruct(metadata={ “quadrature_degree”: 3 })

    Used by the call operator, so this is equivalent:

      b = dm(2) c = dm(0, { “quadrature_degree”: 3 })

  subdomain_data()

    Return the integral subdomain_data.

    This data is not interpreted by UFL. Its intension is to give a context in which the domain id is interpreted.

  subdomain_id()

    Return the domain id of this measure (integer).

  ufl_domain()

    Return the domain associated with this measure.

    This may be None or a Domain object.

class ufl.measure.MeasureProduct(*measures)

  Bases: `object`

  Represents a product of measures.

  This is a notational intermediate object to handle the notation

  > f*(dm1*dm2)

  This is work in progress and not functional. It needs support in other parts of ufl and the rest of the code generation chain.

  sub_measures()

    Return submeasures.

class ufl.measure.MeasureSum(*measures)

  Bases: `object`

  Represents a sum of measures.

  This is a notational intermediate object to translate the notation

    f*(ds(1)+ds(3))

  into

    f*ds(1) + f*ds(3)

ufl.measure.as_integral_type(integral_type)

  Map short name to long name and require a valid one.

ufl.measure.integral_types()

  Return a tuple of all domain type strings.

ufl.measure.measure_names()

  Return a tuple of all measure name strings.

ufl.measure.register_integral_type(integral_type, measure_name)

  Register an integral type.

## ufl.objects module

Utility objects for pretty syntax in user code.

## ufl.operators module

Operators.

This module extends the form language with free function operators, which are either already available as member functions on UFL objects or defined as compound operators involving basic operations on the UFL objects.

ufl.operators.And(left, right)

  A boolean expression (left and right) for use with conditional.

ufl.operators.Dn(f)

  Take the directional derivative of f in the facet normal direction.

  The facet normal is Dn(f) := dot(grad(f), n).

ufl.operators.Dx(f, *i)

  Take the partial derivative of f with respect to spatial variable number i.

  Equivalent to f.dx(*i).

ufl.operators.Not(condition)

  A boolean expression (not condition) for use with conditional.

ufl.operators.Or(left, right)

  A boolean expression (left or right) for use with conditional.

ufl.operators.acos(f)

  Take the inverse cosine of f.

ufl.operators.asin(f)

  Take the inverse sine of f.

ufl.operators.atan(f)

  Take the inverse tangent of f.

ufl.operators.atan2(f1, f2)

  Take the inverse tangent with two the arguments f1 and f2.

ufl.operators.avg(v)

  Take the average of v across a facet.

ufl.operators.bessel_I(nu, f)

  Regular modified cylindrical Bessel function.

ufl.operators.bessel_J(nu, f)

  Cylindrical Bessel function of the first kind.

ufl.operators.bessel_K(nu, f)

  Irregular modified cylindrical Bessel function.

ufl.operators.bessel_Y(nu, f)

  Cylindrical Bessel function of the second kind.

ufl.operators.cell_avg(f)

  Take the average of v over a cell.

ufl.operators.cofac(A)

  Take the cofactor of A.

ufl.operators.conditional(condition, true_value, false_value)

  A conditional expression.

  This takes the value of true_value when condition evaluates to true and false_value otherwise.

ufl.operators.conj(f)

  The complex conjugate of f.

ufl.operators.conjugate(f)

  The complex conjugate of f.

ufl.operators.cos(f)

  Take the cosine of f.

ufl.operators.cosh(f)

  Take the hyperbolic cosine of f.

ufl.operators.cross(a, b)

  Take the cross product of a and b.

ufl.operators.curl(f)

  Take the curl of f.

ufl.operators.det(A)

  Take the determinant of A.

ufl.operators.dev(A)

  Take the deviatoric part of A.

ufl.operators.diag(A)

  Diagonal ranl-2 tensor.

  Take the diagonal part of rank 2 tensor A or make a diagonal rank 2 tensor from a rank 1 tensor.

  Always returns a rank 2 tensor. See also diag_vector.

ufl.operators.diag_vector(A)

  Take the diagonal part of rank 2 tensor A and return as a vector.

  See also diag.

ufl.operators.diff(f, v)

  Take the derivative of f with respect to the variable v.

  If f is a form, diff is applied to each integrand.

ufl.operators.div(f)

  Take the divergence of f.

  This operator follows the div convention where

    div(v) = v[i].dx(i) div(T)[:] = T[:,i].dx(i)

  for vector expressions v, and arbitrary rank tensor expressions T.

  See also: `nabla_div()`

ufl.operators.dot(a, b)

  Take the dot product of a and b.

  This won’t take the complex conjugate of the second argument.

ufl.operators.elem_div(A, B)

  Take the elementwise division of tensors A and B with the same shape.

ufl.operators.elem_mult(A, B)

  Take the elementwise multiplication of tensors A and B with the same shape.

ufl.operators.elem_op(op, *args)

  Apply element-wise operations.

  Take the element-wise application of operator op on scalar values from one or more tensor arguments.

ufl.operators.elem_op_items(op_ind, indices, *args)

  Elem op items.

ufl.operators.elem_pow(A, B)

  Take the elementwise power of tensors A and B with the same shape.

ufl.operators.eq(left, right)

  A boolean expression (left == right) for use with conditional.

ufl.operators.erf(f)

  Take the error function of f.

ufl.operators.exp(f)

  Take the exponential of f.

ufl.operators.exterior_derivative(f)

  Take the exterior derivative of f.

  The exterior derivative uses the element Sobolev space to determine whether id, grad, curl or div should be used.

  Note that this uses the grad and div operators, as opposed to nabla_grad and nabla_div.

ufl.operators.facet_avg(f)

  Take the average of v over a facet.

ufl.operators.ge(left, right)

  A boolean expression (left >= right) for use with conditional.

ufl.operators.grad(f)

  Take the gradient of f.

  This operator follows the grad convention where

    grad(s)[i] = s.dx(i) grad(v)[i,j] = v[i].dx(j) grad(T)[:,i] = T[:].dx(i)

  for scalar expressions s, vector expressions v, and arbitrary rank tensor expressions T.

  See also: `nabla_grad()`

ufl.operators.gt(left, right)

  A boolean expression (left > right) for use with conditional.

ufl.operators.imag(f)

  The imaginary part of f.

ufl.operators.inner(a, b)

  Take the inner product of a and b.

  The complex conjugate of the second argument is taken.

ufl.operators.inv(A)

  Take the inverse of A.

ufl.operators.jump(v, n=None)

  Take the jump of v across a facet.

ufl.operators.le(left, right)

  A boolean expression (left <= right) for use with conditional.

ufl.operators.ln(f)

  Take the natural logarithm of f.

ufl.operators.lt(left, right)

  A boolean expression (left < right) for use with conditional.

ufl.operators.max_value(x, y)

  Take the maximum of x and y.

ufl.operators.min_value(x, y)

  Take the minimum of x and y.

ufl.operators.nabla_div(f)

  Take the divergence of f.

  This operator follows the div convention where

    nabla_div(v) = v[i].dx(i) nabla_div(T)[:] = T[i,:].dx(i)

  for vector expressions v, and arbitrary rank tensor expressions T.

  See also: `div()`

ufl.operators.nabla_grad(f)

  Take the gradient of f.

  This operator follows the grad convention where

    nabla_grad(s)[i] = s.dx(i) nabla_grad(v)[i,j] = v[j].dx(i) nabla_grad(T)[i,:] = T[:].dx(i)

  for scalar expressions s, vector expressions v, and arbitrary rank tensor expressions T.

  See also: `grad()`

ufl.operators.ne(left, right)

  A boolean expression (left != right) for use with conditional.

ufl.operators.outer(*operands)

  Take the outer product of two or more operands.

  The complex conjugate of the first argument is taken.

ufl.operators.perp(v)

  Take the perp of v.

  I.e. \((-v_1, +v_0)\).

ufl.operators.rank(f)

  The rank of f.

ufl.operators.real(f)

  The real part of f.

ufl.operators.rot(f)

  Take the curl of f.

ufl.operators.shape(f)

  The shape of f.

ufl.operators.sign(x)

  Return the sign of x.

  This returns +1 if x is positive, -1 if x is negative, and 0 if x is 0.

ufl.operators.sin(f)

  Take the sine of f.

ufl.operators.sinh(f)

  Take the hyperbolic sine of f.

ufl.operators.skew(A)

  Take the skew symmetric part of A.

ufl.operators.sqrt(f)

  Take the square root of f.

ufl.operators.sym(A)

  Take the symmetric part of A.

ufl.operators.tan(f)

  Take the tangent of f.

ufl.operators.tanh(f)

  Take the hyperbolic tangent of f.

ufl.operators.tr(A)

  Take the trace of A.

ufl.operators.transpose(A)

  Take the transposed of tensor A.

ufl.operators.variable(e)

  Define a variable representing the given expression.

  See also diff().

## ufl.permutation module

This module provides utility functions for computing permutations and generating index lists.

ufl.permutation.build_component_numbering(shape, symmetry)

  Build a numbering of components within the given value shape.

  This takes into consideration a symmetry mapping which leaves the mapping noncontiguous. Returns a dict { component -> numbering } and an ordered list of components [ numbering -> component ]. The dict contains all components while the list only contains the ones not mapped by the symmetry mapping.

ufl.permutation.compute_indices(shape)

  Compute all index combinations for given shape.

## ufl.precedence module

Precedence handling.

ufl.precedence.assign_precedences(precedence_list)

  Given a precedence list, assign ints to class._precedence.

ufl.precedence.build_precedence_list()

  Build precedence list.

ufl.precedence.build_precedence_mapping(precedence_list)

  Given a precedence list, build a dict with class->int mappings.

  Utility function used by some external code.

ufl.precedence.parstr(child, parent, pre='(', post=')', format=<class 'str'>)

  Parstr.

## ufl.protocols module

Protocols.

ufl.protocols.id_or_none(obj)

  Returns None if the object is None, obj.ufl_id() if available, or id(obj) if not.

  This allows external libraries to implement an alternative to id(obj) in the ufl_id() function, such that ufl can identify objects as the same without knowing about their types.

## ufl.pullback module

Pull back and push forward maps.

class ufl.pullback.AbstractPullback

  Bases: `ABC`

  An abstract pull back.

  apply(expr: Expr, domain: AbstractDomain | None = None) → Expr

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  abstract property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  abstractmethod physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.ContravariantPiola

  Bases: `AbstractPullback`

  The contravariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.CovariantContravariantPiola

  Bases: `AbstractPullback`

  The covariant contravariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.CovariantPiola

  Bases: `AbstractPullback`

  The covariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.CustomPullback

  Bases: `AbstractPullback`

  Custom pull back.

  This should probably be removed.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.DoubleContravariantPiola

  Bases: `AbstractPullback`

  The double contravariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.DoubleCovariantPiola

  Bases: `AbstractPullback`

  The double covariant Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.IdentityPullback

  Bases: `AbstractPullback`

  The identity pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.L2Piola

  Bases: `AbstractPullback`

  The L2 Piola pull back.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.MixedPullback(element: _AbstractFiniteElement)

  Bases: `AbstractPullback`

  Pull back for a mixed element.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

exception ufl.pullback.NonStandardPullbackException

  Bases: `BaseException`

  Exception to raise if a map is non-standard.

class ufl.pullback.PhysicalPullback

  Bases: `AbstractPullback`

  Physical pull back.

  This should probably be removed.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.SymmetricPullback(element: _AbstractFiniteElement, symmetry: dict[tuple[int, ...], int])

  Bases: `AbstractPullback`

  Pull back for an element with symmetry.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.pullback.UndefinedPullback

  Bases: `AbstractPullback`

  Undefined pull back.

  This should probably be removed.

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

## ufl.referencevalue module

Representation of the reference value of a function.

class ufl.referencevalue.ReferenceValue(f)

  Bases: `Operator`

  Representation of the reference cell value of a form argument.

  evaluate(x, mapping, component, index_values, derivatives=())

    Get child from mapping and return the component asked for.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

    Get the UFL shape.

## ufl.restriction module

Restriction operations.

class ufl.restriction.NegativeRestricted(expression)

  Bases: `Restricted`

  Negative restriction.

class ufl.restriction.PositiveRestricted(expression)

  Bases: `Restricted`

  Positive restriction.

class ufl.restriction.Restricted(expression)

  Bases: `Operator`

  Restriction.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  side()

    Get the side.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

## ufl.sobolevspace module

Sobolev spaces.

This module defines a symbolic heirarchy of Sobolev spaces to enable symbolic reasoning about the spaces in which finite elements lie.

class ufl.sobolevspace.DirectionalSobolevSpace(orders)

  Bases: `SobolevSpace`

  Directional Sobolev space.

  Symbolic representation of a Sobolev space with varying smoothness in different spatial directions.

class ufl.sobolevspace.SobolevSpace(name, parents=None)

  Bases: `object`

  Symbolic representation of a Sobolev space.

  This implements a subset of the methods of a Python set so that finite elements and other Sobolev spaces can be tested for inclusion.

## ufl.sorting module

Sorting.

This module contains a sorting rule for expr objects that is more robust w.r.t. argument numbering than using repr.

ufl.sorting.cmp_expr(a, b)

  Replacement for cmp(a, b), removed in Python 3, for Expr objects.

ufl.sorting.sorted_expr(sequence)

  Return a canonically sorted list of Expr objects in sequence.

ufl.sorting.sorted_expr_sum(seq)

  Sorted expr sum.

## ufl.split_functions module

Algorithm for splitting a Coefficient or Argument into subfunctions.

ufl.split_functions.split(v)

  Split a coefficient or argument.

  If v is a Coefficient or Argument in a mixed space, returns a tuple with the function components corresponding to the subelements.

## ufl.tensoralgebra module

Compound tensor algebra operations.

class ufl.tensoralgebra.Cofactor(A)

  Bases: `CompoundTensorOperator`

  Cofactor.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

    Get the UFL shape.

class ufl.tensoralgebra.CompoundTensorOperator(operands)

  Bases: `Operator`

  Compount tensor operator.

  ufl_free_indices: tuple[int, ...]
  ufl_shape: tuple[int, ...]

class ufl.tensoralgebra.Cross(a, b)

  Bases: `CompoundTensorOperator`

  Cross.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = (3,)

class ufl.tensoralgebra.Determinant(A)

  Bases: `CompoundTensorOperator`

  Determinant.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = ()

class ufl.tensoralgebra.Deviatoric(A)

  Bases: `CompoundTensorOperator`

  Deviatoric.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.tensoralgebra.Dot(a, b)

  Bases: `CompoundTensorOperator`

  Dot.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.tensoralgebra.Inner(a, b)

  Bases: `CompoundTensorOperator`

  Inner.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.tensoralgebra.Inverse(A)

  Bases: `CompoundTensorOperator`

  Inverse.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

    Get the UFL shape.

class ufl.tensoralgebra.Outer(a, b)

  Bases: `CompoundTensorOperator`

  Outer.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

class ufl.tensoralgebra.Perp(A)

  Bases: `CompoundTensorOperator`

  Perp.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  ufl_shape: tuple[int, ...] = (2,)

class ufl.tensoralgebra.Skew(A)

  Bases: `CompoundTensorOperator`

  Skew.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.tensoralgebra.Sym(A)

  Bases: `CompoundTensorOperator`

  Sym.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

class ufl.tensoralgebra.Trace(A)

  Bases: `CompoundTensorOperator`

  Trace.

  property ufl_free_indices
  property ufl_index_dimensions
  ufl_shape: tuple[int, ...] = ()

class ufl.tensoralgebra.Transposed(A)

  Bases: `CompoundTensorOperator`

  Transposed tensor.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

## ufl.tensors module

Classes used to group scalar expressions into expressions with rank > 0.

class ufl.tensors.ComponentTensor(expression, indices)

  Bases: `Operator`

  Maps the free indices of a scalar valued expression to tensor axes.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  indices()

    Get indices.

  ufl_free_indices: tuple[int, ...]
  ufl_index_dimensions
  ufl_shape: tuple[int, ...]

class ufl.tensors.ListTensor(*expressions)

  Bases: `Operator`

  Wraps a list of expressions into a tensor valued expression of one higher rank.

  evaluate(x, mapping, component, index_values, derivatives=())

    Evaluate.

  property ufl_free_indices
  property ufl_index_dimensions
  property ufl_shape

    Get the UFL shape.

ufl.tensors.as_matrix(expressions, indices=None)

  As as_tensor(), but limited to rank 2 tensors.

ufl.tensors.as_scalar(expression)

  As scalar.

  Given a scalar or tensor valued expression A, returns either of the tuples::

    (a,b) = (A, ()) (a,b) = (A[indices], indices)

  such that a is always a scalar valued expression.

ufl.tensors.as_scalars(*expressions)

  As scalars.

  Given multiple scalar or tensor valued expressions A, returns either of the tuples::

    (a,b) = (A, ()) (a,b) = ([A[0][indices], …, A[-1][indices]], indices)

  such that a is always a list of scalar valued expressions.

ufl.tensors.as_tensor(expressions, indices=None)

  Make a tensor valued expression.

  This works in two different ways, by using indices or lists.

  1) Returns \(A\) such that \(A\) [indices] = expressions. If indices are provided, expressions must be a scalar valued expression with all the provided indices among its free indices. This operator will then map each of these indices to a tensor axis, thereby making a tensor valued expression from a scalar valued expression with free indices.

  2) Returns \(A\) such that \(A[k,...]\) = expressions*[k]. If no indices are provided, *expressions must be a list or tuple of expressions. The expressions can also consist of recursively nested lists to build higher rank tensors.

ufl.tensors.as_vector(expressions, index=None)

  As `as_tensor()`, but limited to rank 1 tensors.

ufl.tensors.from_numpy_to_lists(expressions)

  Convert Numpy array to lists.

ufl.tensors.numpy2nestedlists(arr)

  Convert Numpy array to a nested list.

ufl.tensors.unit_indexed_tensor(shape, component)

  Unit indexed tensor.

ufl.tensors.unit_list(i, n)

  Create a list of zeros where the ith entry is 1.

ufl.tensors.unit_list2(i, j, n)

  Creage a two dimensional list of zeros where the (i,j)th entry is 1.

ufl.tensors.unit_matrices(d)

  A tuple of constant unit matrices in all directions with dimension d.

ufl.tensors.unit_matrix(i, j, d)

  A constant unit matrix in direction i,*j* with dimension d.

ufl.tensors.unit_vector(i, d)

  A constant unit vector in direction i with dimension d.

ufl.tensors.unit_vectors(d)

  A tuple of constant unit vectors in all directions with dimension d.

ufl.tensors.unwrap_list_tensor(lt)

  Unwrap a list tensor.

## ufl.variable module

Define the Variable and Label classes.

These are used to label expressions as variables for differentiation.

class ufl.variable.Label(count=None)

  Bases: `Terminal`, `Counted`

  Label.

  is_cellwise_constant()

    Return true if the object is constant on each cell.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

class ufl.variable.Variable(expression, label=None)

  Bases: `Operator`

  A Variable is a representative for another expression.

  It will be used by the end-user mainly for defining a quantity to differentiate w.r.t. using diff. Example:

      e = <...>
      e = variable(e)
      f = exp(e**2)
      df = diff(f, e)

  evaluate(x, mapping, component, index_values)

    Evaluate.

  expression()

    Get expression.

  label()

    Get label.

  ufl_domains()

    Get the UFL domains.

  ufl_free_indices: tuple[int, ...] = ()
  ufl_index_dimensions = ()
  property ufl_shape

## Module contents

UFL: The Unified Form Language.

The Unified Form Language is an embedded domain specific language for definition of variational forms intended for finite element discretization. More precisely, it defines a fixed interface for choosing finite element spaces and defining expressions for weak forms in a notation close to the mathematical one.

This Python module contains the language as well as algorithms to work with it.

- To import the language, type:

      import ufl

- To import the underlying classes an UFL expression tree is built from, type

      import ufl.classes

- Various algorithms for working with UFL expression trees can be accessed by

      import ufl.algorithms

Classes and algorithms are considered implementation details and should not be used in form definitions.

For more details on the language, see

> http://www.fenicsproject.org

and

> http://arxiv.org/abs/1211.4047

The development version can be found in the repository at

> https://github.com/FEniCS/ufl

A very brief overview of the language contents follows:

- Cells:

      -AbstractCell
      -Cell
      -TensorProductCell
      -vertex
      -interval
      -triangle
      -tetrahedron
      -quadrilateral
      -hexahedron
      -prism
      -pyramid
      -pentatope
      -tesseract

- Domains:

      -AbstractDomain
      -Mesh
      -MeshSequence
      -MeshView

- Sobolev spaces:

      -L2
      -H1
      -H2
      -HInf
      -HDiv
      -HCurl
      -HEin
      -HDivDiv
      -HCurlDiv

- Pull backs:

      -identity_pullback
      -contravariant_piola
      -covariant_piola
      -l2_piola
      -double_contravariant_piola
      -double_covariant_piola
      -covariant_contravariant_piola

- Function spaces:

      -FunctionSpace
      -MixedFunctionSpace

- Arguments:

      -Argument
      -TestFunction
      -TrialFunction
      -Arguments
      -TestFunctions
      -TrialFunctions

- Coefficients:

      -Coefficient
      -Constant
      -VectorConstant
      -TensorConstant

- Splitting form arguments in mixed spaces:

      -split

- Literal constants:

      -Identity
      -PermutationSymbol

- Geometric quantities:

      -SpatialCoordinate
      -FacetNormal
      -CellNormal
      -CellVolume
      -CellDiameter
      -Circumradius
      -MinCellEdgeLength
      -MaxCellEdgeLength
      -FacetArea
      -MinFacetEdgeLength
      -MaxFacetEdgeLength
      -Jacobian
      -JacobianDeterminant
      -JacobianInverse

- Indices:

      -Index
      -indices
      -i, j, k, l
      -p, q, r, s

- Scalar to tensor expression conversion:

      -as_tensor
      -as_vector
      -as_matrix

- Unit vectors and matrices:

      -unit_vector
      -unit_vectors
      -unit_matrix
      -unit_matrices

- Tensor algebra operators:

      -outer, inner, dot, cross, perp
      -det, inv, cofac
      -transpose, tr, diag, diag_vector
      -dev, skew, sym

- Elementwise tensor operators:

      -elem_mult
      -elem_div
      -elem_pow
      -elem_op

- Differential operators:

      -variable
      (-diff,)
      -grad, nabla_grad
      -div, nabla_div
      -curl, rot
      -Dx, Dn

- Nonlinear functions:

      -max_value, min_value
      -abs, sign
      -sqrt
      -exp, ln, erf
      -cos, sin, tan
      -acos, asin, atan, atan2
      -cosh, sinh, tanh
      -bessel_J, bessel_Y, bessel_I, bessel_K

- Complex operations:

      - conj, real, imag
      conjugate is an alias for conj

- Discontinuous Galerkin operators:

      -v("+"), v("-")
      -jump
      -avg
      -cell_avg, facet_avg

- Conditional operators:

      - eq, ne, le, ge, lt, gt
      - <, >, <=, >=
      - And, Or, Not
      - conditional

- Integral measures:

      -dx, ds, dS, dP, dl
      -dc, dC, dO, dI, dX
      -ds_b, ds_t, ds_tb, ds_v, dS_h, dS_v

- Form transformations:

      -rhs, lhs
      -system
      -functional
      -replace
      -adjoint
      -action
      (-energy_norm,)
      -sensitivity_rhs
      -derivative

class ufl.AbstractCell

  Bases: `UFLObject`

  A base class for all cells.

  abstractmethod cellname() → str

    Return the cellname of the cell.

  edge_types() → tuple[AbstractCell, ...]

    Get the unique edge types.

  edges() → tuple[AbstractCell, ...]

    Get the edges.

  face_types() → tuple[AbstractCell, ...]

    Get the unique face types.

  faces() → tuple[AbstractCell, ...]

    Get the faces.

  facet_types() → tuple[AbstractCell, ...]

    Get the unique facet types.

    Facets are entities of dimension tdim-1.

  facets() → tuple[AbstractCell, ...]

    Get the facets.

    Facets are entities of dimension tdim-1.

  abstractmethod has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  abstractmethod is_simplex() → bool

    Return True if this is a simplex cell.

  num_edges() → int

    Get the number of edges.

  num_faces() → int

    Get the number of faces.

  num_facets() → int

    Get the number of facets.

    Facets are entities of dimension tdim-1.

  num_peaks() → int

    Get the number of peaks.

    Peaks are entities of dimension tdim-3.

  num_ridges() → int

    Get the number of ridges.

    Ridges are entities of dimension tdim-2.

  abstractmethod num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  num_vertices() → int

    Get the number of vertices.

  peak_types() → tuple[AbstractCell, ...]

    Get the unique peak types.

    Peaks are entities of dimension tdim-3.

  peaks() → tuple[AbstractCell, ...]

    Get the peaks.

    Peaks are entities of dimension tdim-3.

  abstractmethod reconstruct(**kwargs: Any) → AbstractCell

    Reconstruct this cell, overwriting properties by those in kwargs.

  ridge_types() → tuple[AbstractCell, ...]

    Get the unique ridge types.

    Ridges are entities of dimension tdim-2.

  ridges() → tuple[AbstractCell, ...]

    Get the ridges.

    Ridges are entities of dimension tdim-2.

  abstractmethod sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  abstractmethod sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  abstractmethod topological_dimension() → int

    Return the dimension of the topology of this cell.

  vertex_types() → tuple[AbstractCell, ...]

    Get the unique vertices types.

  vertices() → tuple[AbstractCell, ...]

    Get the vertices.

class ufl.AbstractDomain(topological_dimension, geometric_dimension)

  Bases: `object`

  Symbolic representation of a geometric domain.

  Domain has only a geometric and a topological dimension.

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  geometric_dimension()

    Return the dimension of the space this domain is embedded in.

  iterable_like(element: AbstractFiniteElement) → Iterable[Mesh] | MeshSequence

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  topological_dimension()

    Return the dimension of the topology of this domain.

class ufl.AbstractFiniteElement

  Bases: `ABC`

  Base class for all finite elements.

  To make your element library compatible with UFL, you should make a subclass of AbstractFiniteElement and provide implementions of all the abstract methods and properties. All methods and properties that are not marked as abstract are implemented here and should not need to be overwritten in your subclass.

  An example of how the methods in your subclass could be implemented can be found in Basix; see https://github.com/FEniCS/basix/blob/main/python/basix/ufl.py

  abstract property cell: Cell

    Return the cell of the finite element.

  abstract property embedded_subdegree: int

    Degree of the maximum degree Lagrange space that is spanned by this element.

    This returns the degree of the highest degree Lagrange space such that the polynomial space of the Lagrange space is a subspace of this element’s polynomial space. If this element’s polynomial space does not include the constant function, this function should return -1.

    Note that on a simplex cells, the polynomial space of Lagrange space is a complete polynomial space, but on other cells this is not true. For example, on quadrilateral cells, the degree 1 Lagrange space includes the degree 2 polynomial xy.

  abstract property embedded_superdegree: int | None

    Degree of the minimum degree Lagrange space that spans this element.

    This returns the degree of the lowest degree Lagrange space such that the polynomial space of the Lagrange space is a superspace of this element’s polynomial space. If this element contains basis functions that are not in any Lagrange space, this function should return None.

    Note that on a simplex cells, the polynomial space of Lagrange space is a complete polynomial space, but on other cells this is not true. For example, on quadrilateral cells, the degree 1 Lagrange space includes the degree 2 polynomial xy.

  is_cellwise_constant() → bool

    Check whether this element is spatially constant over each cell.

  property num_sub_elements: int

    Return number of sub-elements.

    This function does not recurse: ie it does not count the sub-elements of sub-elements.

  abstract property pullback: AbstractPullback

    Return the pullback for this element.

  abstract property reference_value_shape: tuple[int, ...]

    Return the shape of the value space on the reference cell.

  property reference_value_size: int

    Return the integer product of the reference value shape.

  abstract property sobolev_space: SobolevSpace

    Return the underlying Sobolev space.

  abstract property sub_elements: Sequence

    Return list of sub-elements.

    This function does not recurse: ie it does not extract the sub-elements of sub-elements.

class ufl.AbstractPullback

  Bases: `ABC`

  An abstract pull back.

  apply(expr: Expr, domain: AbstractDomain | None = None) → Expr

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  abstract property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  abstractmethod physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

class ufl.Action(*args, **kw)

  Bases: `BaseForm`

  UFL base form type: respresents the action of an object on another.

  For example:

    res = Ax

  A would be the first argument, left and x would be the second argument, right.

  Action objects will result when the action of an assembled object (e.g. a Matrix) is taken. This delays the evaluation of the action until assembly occurs.

  equals(other)

    Check if two Actions are equal.

  left()

    Get left.

  right()

    Get right.

  ufl_domains()

    Return all domains found in the base form.

  ufl_function_spaces()

    Get the tuple of function spaces of the underlying form.

  ufl_operands: tuple[FormArgument, ...]

class ufl.Adjoint(*args, **kw)

  Bases: `BaseForm`

  UFL base form type: represents the adjoint of an object.

  Adjoint objects will result when the adjoint of an assembled object (e.g. a Matrix) is taken. This delays the evaluation of the adjoint until assembly occurs.

  equals(other)

    Check if two Adjoints are equal.

  form()

    Return the form.

  ufl_domains()

    Return all domains found in the base form.

  ufl_function_spaces()

    Get the tuple of function spaces of the underlying form.

  ufl_operands: tuple[FormArgument, ...]

ufl.And(left, right)

  A boolean expression (left and right) for use with conditional.

class ufl.Argument(*args, **kw)

  Bases: `FormArgument`, `BaseArgument`

  UFL value: Representation of an argument to a form.

  ufl_domains()

    Return UFL domains.

ufl.Arguments(function_space, number)

  Create an Argument in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

class ufl.BaseForm

  Bases: `object`

  Description of an object containing arguments.

  arguments()

    Return all `Argument` objects found in form.

  coefficients()

    Return all `Coefficient` objects found in form.

  empty()

    Returns whether the BaseForm has no components.

  geometric_quantities()

    Return all `GeometricQuantity` objects found in form.

  ufl_domain()

    Return the single geometric integration domain occuring in the base form.

    Fails if multiple domains are found.

class ufl.Cell(cellname: str)

  Bases: `AbstractCell`

  Representation of a named finite element cell with known structure.

  cellname() → str

    Return the cellname of the cell.

  has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  is_simplex() → bool

    Return True if this is a simplex cell.

  num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  reconstruct(**kwargs: Any) → Cell

    Reconstruct this cell, overwriting properties by those in kwargs.

  sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  topological_dimension() → int

    Return the dimension of the topology of this cell.

class ufl.CellDiameter(domain)

  Bases: `GeometricCellQuantity`

  The diameter of the cell, i.e., maximal distance of two points in the cell.

  name = 'diameter'

class ufl.CellNormal(domain)

  Bases: `GeometricCellQuantity`

  The upwards pointing normal vector of the current manifold cell.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'cell_normal'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.CellVolume(domain)

  Bases: `GeometricCellQuantity`

  The volume of the cell.

  name = 'volume'

class ufl.Circumradius(domain)

  Bases: `GeometricCellQuantity`

  The circumradius of the cell.

  name = 'circumradius'

class ufl.Coargument(*args, **kw)

  Bases: `BaseForm`, `BaseArgument`

  UFL value: Representation of an argument to a form in a dual space.

  arguments(outer_form=None)

    Return all Argument objects found in form.

  equals(other)

    Check equality.

  ufl_domain()

    Return the UFL domain.

  ufl_operands: tuple[FormArgument, ...]

class ufl.Coefficient(*args, **kw)

  Bases: `FormArgument`, `BaseCoefficient`

  UFL form argument type: Representation of a form coefficient.

  ufl_domains()

    Get the UFL domains.

ufl.Coefficients(function_space)

  Create a Coefficient in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

class ufl.Cofunction(*args, **kw)

  Bases: `BaseCoefficient`, `BaseForm`

  UFL form argument type: Representation of a form coefficient from a dual space.

  equals(other)

    Check equality.

  ufl_operands: tuple[FormArgument, ...]

class ufl.Constant(domain, shape=(), count=None)

  Bases: `Terminal`, `Counted`

  Constant.

  is_cellwise_constant()

    Return True if the function is cellwise constant.

  ufl_domain()

    Get the UFL domain.

  ufl_domains()

    Get the UFL domains.

  property ufl_shape

    Get the UFL shape.

class ufl.DSIntegralDomain(coordinate_element_positive_side: AbstractFiniteElement, coordinate_element_negative_side: AbstractFiniteElement, facet_type: AbstractCell)

  Bases: `AbstractIntegralDomain`

  Integral domain for dS.

  property integral_type: str

    Integral type.

ufl.Dn(f)

  Take the directional derivative of f in the facet normal direction.

  The facet normal is Dn(f) := dot(grad(f), n).

class ufl.DsIntegralDomain(coordinate_element: AbstractFiniteElement, facet_type: AbstractCell)

  Bases: `AbstractIntegralDomain`

  Integral domain for ds.

  property integral_type: str

    Integral type.

ufl.Dx(f, *i)

  Take the partial derivative of f with respect to spatial variable number i.

  Equivalent to f.dx(*i).

class ufl.DxIntegralDomain(coordinate_element: AbstractFiniteElement)

  Bases: `AbstractIntegralDomain`

  Integral domain for dx.

  property integral_type: str

    Integral type.

class ufl.ExternalOperator(*operands, function_space, derivatives=None, argument_slots=())

  Bases: `BaseFormOperator`

  External operator.

  assemble(*args, **kwargs)

    Assemble the external operator.

  grad()

    Returns the symbolic grad of the external operator.

  ufl_element()

    Shortcut to get the finite element of the function space of the external operator.

  ufl_operands: tuple['FormArgument', ...]

class ufl.FacetArea(domain)

  Bases: `GeometricFacetQuantity`

  The area of the facet.

  name = 'facetarea'

class ufl.FacetNormal(domain)

  Bases: `GeometricFacetQuantity`

  The outwards pointing normal vector of the current facet.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'n'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.Form(integrals)

  Bases: `BaseForm`

  Description of a weak form consisting of a sum of integrals over subdomains.

  base_form_operators()

    Return all `BaseFormOperator` objects found in form.

  coefficient_numbering()

    Return a contiguous numbering of coefficients in a mapping `{coefficient:number}`.

  coefficients()

    Return all `Coefficient` objects found in form.

  constant_numbering()

    Return a contiguous numbering of constants in a mapping `{constant:number}`.

  constants()

    Get constants.

  domain_numbering()

    Return a contiguous numbering of domains in a mapping `{domain:number}`.

  empty()

    Returns whether the form has no integrals.

  equals(other)

    Evaluate `bool(lhs_form == rhs_form)`.

  geometric_dimension()

    Return the geometric dimension shared by all domains and functions in this form.

  integrals()

    Return a sequence of all integrals in form.

  integrals_by_domain(domain)

    Return a sequence of all integrals with a particular integration domain.

  integrals_by_type(integral_type)

    Return a sequence of all integrals with a particular domain type.

  signature()

    Signature for use with jit cache (independent of incidental numbering of indices etc).

  subdomain_data()

    Returns a mapping on the form `{domain:{integral_type: subdomain_data}}`.

  terminal_numbering()

    Return a contiguous numbering for all counted objects in the form.

    The returned object is mapping from terminal to its number (an integer).

    The numbering is computed per type so `Coefficient`, `Constant`, etc will each be numbered from zero.

  ufl_cell()

    Return the single cell this form is defined on.

    Fails if multiple cells are found.

  ufl_domains()

    Return the geometric integration domains occuring in the form.

    NB! This does not include domains of coefficients defined on other meshes.

    The return type is a tuple even if only a single domain exists.

class ufl.FormSum(*args, **kwargs)

  Bases: `BaseForm`

  Form sum.

  Description of a weighted sum of variational forms and form-like objects components is the list of Forms to be summed arg_weights is a list of tuples of component index and weight

  components()

    Get components.

  empty()

    Returns whether the FormSum has no components.

  equals(other)

    Evaluate `bool(lhs_form == rhs_form)`.

  ufl_domains()

    Return all domains found in the base form.

  ufl_operands: tuple[FormArgument, ...]
  weights()

    Get weights.

class ufl.FunctionSpace(domain, element, label='')

  Bases: `BaseFunctionSpace`, `UFLObject`

  Representation of a Function space.

  dual()

    Get the dual of the space.

class ufl.Identity(dim)

  Bases: `ConstantValue`

  Representation of an identity matrix.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_shape: tuple[int, ...]

class ufl.Index(count=None)

  Bases: `IndexBase`, `Counted`

  UFL value: An index with no value assigned.

  Used to represent free indices in Einstein indexing notation.

class ufl.Integral(integrand, integral_type, domain, subdomain_id, metadata, subdomain_data)

  Bases: `object`

  An integral over a single domain.

  integral_type()

    Return the domain type of this integral.

  integrand()

    Return the integrand expression, which is an `Expr` instance.

  metadata()

    Return the compiler metadata this integral has been annotated with.

  reconstruct(integrand=None, integral_type=None, domain=None, subdomain_id=None, metadata=None, subdomain_data=None)

    Construct a new Integral object with some properties replaced with new values.

    Example:

      <a = Integral instance> b = a.reconstruct(expand_compounds(a.integrand())) c = a.reconstruct(metadata={‘quadrature_degree’:2})

  subdomain_data()

    Return the domain data of this integral.

  subdomain_id()

    Return the subdomain id of this integral.

  ufl_domain()

    Return the integration domain of this integral.

class ufl.Interpolate(expr, v)

  Bases: `BaseFormOperator`

  Symbolic representation of the interpolation operator.

  ufl_operands: tuple['FormArgument', ...]

class ufl.Jacobian(domain)

  Bases: `GeometricCellQuantity`

  The Jacobian of the mapping from reference cell to spatial coordinates.

  \[\begin{split}J_{ij} = \\frac{dx_i}{dX_j}\end{split}\]
  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'J'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.JacobianDeterminant(domain)

  Bases: `GeometricCellQuantity`

  The determinant of the Jacobian.

  Represents the signed determinant of a square Jacobian or the pseudo-determinant of a non-square Jacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detJ'

class ufl.JacobianInverse(domain)

  Bases: `GeometricCellQuantity`

  The inverse of the Jacobian.

  Represents the inverse of a square Jacobian or the pseudo-inverse of a non-square Jacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'K'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.Label(count=None)

  Bases: `Terminal`, `Counted`

  Label.

  is_cellwise_constant()

    Return true if the object is constant on each cell.

  ufl_domains()

    Return tuple of domains related to this terminal object.

  property ufl_free_indices

    Get the UFL free indices.

  property ufl_index_dimensions

    Get the UFL index dimensions.

  property ufl_shape

    Get the UFL shape.

class ufl.Matrix(row_space, column_space, count=None)

  Bases: `BaseForm`, `Counted`

  An assemble linear operator between two function spaces.

  equals(other)

    Check equality.

  ufl_function_spaces()

    Get the tuple of function spaces of this coefficient.

  ufl_operands: tuple[FormArgument, ...]

class ufl.MaxCellEdgeLength(domain)

  Bases: `GeometricCellQuantity`

  The maximum edge length of the cell.

  name = 'maxcelledgelength'

class ufl.MaxFacetEdgeLength(domain)

  Bases: `GeometricFacetQuantity`

  The maximum edge length of the facet.

  name = 'maxfacetedgelength'

class ufl.Measure(integral_type, domain=None, subdomain_id='everywhere', metadata=None, subdomain_data=None)

  Bases: `object`

  Representation of an integration measure.

  The Measure object holds information about integration properties to be transferred to a Form on multiplication with a scalar expression.

  integral_type()

    Return the domain type.

    Valid domain types are “cell”, “exterior_facet”, “interior_facet”, etc.

  metadata()

    Return the integral metadata.

    This data is not interpreted by UFL. It is passed to the form compiler which can ignore it or use it to compile each integral of a form in a different way.

  reconstruct(integral_type=None, subdomain_id=None, domain=None, metadata=None, subdomain_data=None)

    Construct a new Measure object with some properties replaced with new values.

    Example:

      <dm = Measure instance> b = dm.reconstruct(subdomain_id=2) c = dm.reconstruct(metadata={ “quadrature_degree”: 3 })

    Used by the call operator, so this is equivalent:

      b = dm(2) c = dm(0, { “quadrature_degree”: 3 })

  subdomain_data()

    Return the integral subdomain_data.

    This data is not interpreted by UFL. Its intension is to give a context in which the domain id is interpreted.

  subdomain_id()

    Return the domain id of this measure (integer).

  ufl_domain()

    Return the domain associated with this measure.

    This may be None or a Domain object.

class ufl.Mesh(coordinate_element, ufl_id=None, cargo=None)

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mesh.

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  is_piecewise_linear_simplex_domain()

    Check if the domain is a piecewise linear simplex.

  iterable_like(element: AbstractFiniteElement) → Iterable[Mesh]

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  ufl_cargo()

    Return carried object that will not be used by UFL.

  ufl_cell()

    Get the cell.

  ufl_coordinate_element()

    Get the coordinate element.

  ufl_id()

    Return the ufl_id of this object.

class ufl.MeshSequence(meshes: Sequence[Mesh])

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mixed mesh.

  This class represents a collection of meshes that, along with a `MixedElement`, represent a mixed function space defined on multiple domains. This abstraction allows for defining the mixed function space with the conventional `FunctionSpace` class and integrating multi-domain problems seamlessly.

  Currently, all component meshes must have the same cell type (and thus the same topological dimension).

  Currently, one can only perform cell integrations when `MeshSequence` is used.

      cell = triangle
      mesh0 = Mesh(FiniteElement("Lagrange", cell, 1, (2,), identity_pullback, H1))
      mesh1 = Mesh(FiniteElement("Lagrange", cell, 1, (2,), identity_pullback, H1))
      domain = MeshSequence([mesh0, mesh1])
      elem0 = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
      elem1 = FiniteElement("Lagrange", cell, 2, (), identity_pullback, H1)
      elem = MixedElement([elem0, elem1])
      V = FunctionSpace(domain, elem)
      v = TestFunction(V)
      v0, v1 = split(v)

  can_make_function_space(element: AbstractFiniteElement) → bool

    Check whether this mesh can make a function space with `element`.

  iterable_like(element: AbstractFiniteElement) → MeshSequence

    Return iterable object that is iterable like `element`.

  property meshes

    Return the component meshes.

  ufl_cell()

    Get the cell.

class ufl.MeshView(mesh, topological_dimension, ufl_id=None)

  Bases: `AbstractDomain`, `UFLObject`

  Symbolic representation of a mesh.

  is_piecewise_linear_simplex_domain()

    Check if the domain is a piecewise linear simplex.

  ufl_cell()

    Get the cell.

  ufl_id()

    Return the ufl_id of this object.

  ufl_mesh()

    Get the mesh.

class ufl.MinCellEdgeLength(domain)

  Bases: `GeometricCellQuantity`

  The minimum edge length of the cell.

  name = 'mincelledgelength'

class ufl.MinFacetEdgeLength(domain)

  Bases: `GeometricFacetQuantity`

  The minimum edge length of the facet.

  name = 'minfacetedgelength'

class ufl.MixedFunctionSpace(*args)

  Bases: `AbstractFunctionSpace`, `UFLObject`

  Mixed function space.

  dual(*args)

    Return the dual to this function space.

    If no additional arguments are passed then a MixedFunctionSpace is returned whose components are the duals of the originals.

    If additional arguments are passed, these must be integers. In this case, the MixedFunctionSpace which is returned will have dual components in the positions corresponding to the arguments passed, and the original components in the other positions.

  num_sub_spaces()

    Return number of subspaces.

  ufl_domain()

    Return ufl domain.

  ufl_domains()

    Return ufl domains.

  ufl_element()

    Return ufl element.

  ufl_elements()

    Return ufl elements.

  ufl_sub_space(i)

    Return i-th ufl sub space.

  ufl_sub_spaces()

    Return ufl sub spaces.

class ufl.MixedPullback(element: _AbstractFiniteElement)

  Bases: `AbstractPullback`

  Pull back for a mixed element.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

ufl.Not(condition)

  A boolean expression (not condition) for use with conditional.

ufl.Or(left, right)

  A boolean expression (left or right) for use with conditional.

class ufl.PermutationSymbol(dim)

  Bases: `ConstantValue`

  Representation of a permutation symbol.

  This is also known as the Levi-Civita symbol, antisymmetric symbol, or alternating symbol.

  evaluate(x, mapping, component, index_values)

    Evaluate.

  ufl_shape: tuple[int, ...]

class ufl.RidgeJacobian(domain)

  Bases: `GeometricRidgeQuantity`

  The Jacobian of the mapping from reference ridge to spatial coordinates.

  > RJ_ij = dx_i/dXe_j

  The RidgeJacobian is the product of the Jacobian and CellRidgeJacobian:

  > RJ = dx/dXe = dx/dX dX/dXe = J * CRJ

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'RJ'
  property ufl_shape

    Get the UFL shape.

class ufl.RidgeJacobianDeterminant(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-determinant of the RidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'detRJ'

class ufl.RidgeJacobianInverse(domain)

  Bases: `GeometricRidgeQuantity`

  The pseudo-inverse of the RidgeJacobian.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'EK'
  property ufl_shape

    Get the UFL shape.

class ufl.SpatialCoordinate(domain)

  Bases: `GeometricCellQuantity`

  The coordinate in a domain.

  In the context of expression integration, represents the domain coordinate of each quadrature point.

  In the context of expression evaluation in a point, represents the value of that point.

  count()

    Count.

  evaluate(x, mapping, component, index_values)

    Return the value of the coordinate.

  is_cellwise_constant()

    Return whether this expression is spatially constant over each cell.

  name = 'x'
  property ufl_shape

    Return the number of coordinates defined (i.e. the geometric dimension of the domain).

class ufl.SymmetricPullback(element: _AbstractFiniteElement, symmetry: dict[tuple[int, ...], int])

  Bases: `AbstractPullback`

  Pull back for an element with symmetry.

  apply(expr, domain=None)

    Apply the pull back.

    Args:

      expr: A function on a physical cell domain: The domain on which the function is defined

    Returns: The function pulled back to the reference cell

  property is_identity: bool

    Is this pull back the identity (or the identity applied to mutliple components).

  physical_value_shape(element, domain) → tuple[int, ...]

    Get the physical value shape when this pull back is applied to an element on a domain.

    Args:

      element: The element that the pull back is applied to domain: The domain

    Returns:

      The value shape when the pull back is applied to the given element

ufl.TensorConstant(domain, count=None)

  Tensor constant.

class ufl.TensorProductCell(*cells: AbstractCell)

  Bases: `AbstractCell`

  Tensor product cell.

  cellname() → str

    Return the cellname of the cell.

  has_simplex_facets() → bool

    Return True if all the facets of this cell are simplex cells.

  is_simplex() → bool

    Return True if this is a simplex cell.

  num_sub_entities(dim: int) → int

    Get the number of sub-entities of the given dimension.

  reconstruct(**kwargs: Any) → AbstractCell

    Reconstruct this cell, overwriting properties by those in kwargs.

  sub_cells() → tuple[AbstractCell, ...]

    Return list of cell factors.

  sub_entities(dim: int) → tuple[AbstractCell, ...]

    Get the sub-entities of the given dimension.

  sub_entity_types(dim: int) → tuple[AbstractCell, ...]

    Get the unique sub-entity types of the given dimension.

  topological_dimension() → int

    Return the dimension of the topology of this cell.

ufl.TestFunction(function_space, part=None)

  UFL value: Create a test function argument to a form.

ufl.TestFunctions(function_space)

  Create a TestFunction in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

ufl.TrialFunction(function_space, part=None)

  UFL value: Create a trial function argument to a form.

ufl.TrialFunctions(function_space)

  Create a TrialFunction in a mixed space.

  Returns a tuple with the function components corresponding to the subelements.

ufl.VectorConstant(domain, count=None)

  Vector constant.

class ufl.ZeroBaseForm(arguments)

  Bases: `BaseForm`

  Description of a zero base form.

  ZeroBaseForm is idempotent with respect to assembly and is mostly used for sake of simplifying base-form expressions.

  form
  ufl_domains()

    Return all domains found in the base form.

  ufl_operands: tuple[FormArgument, ...]

ufl.acos(f)

  Take the inverse cosine of f.

ufl.action(form, coefficient=None, derivatives_expanded=None)

  Get the action.

  Given a bilinear form, return a linear form with an additional coefficient, representing the action of the form on the coefficient. This can be used for matrix-free methods. For formbase objects,coefficient can be any object of the correct type, and this function returns an Action object.

  When action is being called multiple times on the same form, expanding derivatives become expensive -> derivatives_expanded enables to use caching mechanisms to avoid that.

ufl.adjoint(form, reordered_arguments=None, derivatives_expanded=None)

  Get the adjoint.

  Given a combined bilinear form, compute the adjoint form by changing the ordering (count) of the test and trial functions, and taking the complex conjugate of the result.

  By default, new `Argument` objects will be created with opposite ordering. However, if the adjoint form is to be added to other forms later, their arguments must match. In that case, the user must provide a tuple *reordered_arguments*=(u2,v2).

  If the form is a baseform instance instead of a Form object, we return an Adjoint object instructing the adjoint to be computed at a later point.

  When adjoint is being called multiple times on the same form, expanding derivatives become expensive -> derivatives_expanded enables to use caching mechanisms to avoid that.

ufl.as_cell(cell: AbstractCell | str | tuple[AbstractCell, ...]) → AbstractCell

  Convert any valid object to a Cell or return cell if it is already a Cell.

  Allows an already valid cell, a known cellname string, or a tuple of cells for a product cell.

ufl.as_matrix(expressions, indices=None)

  As as_tensor(), but limited to rank 2 tensors.

ufl.as_tensor(expressions, indices=None)

  Make a tensor valued expression.

  This works in two different ways, by using indices or lists.

  1) Returns \(A\) such that \(A\) [indices] = expressions. If indices are provided, expressions must be a scalar valued expression with all the provided indices among its free indices. This operator will then map each of these indices to a tensor axis, thereby making a tensor valued expression from a scalar valued expression with free indices.

  2) Returns \(A\) such that \(A[k,...]\) = expressions*[k]. If no indices are provided, *expressions must be a list or tuple of expressions. The expressions can also consist of recursively nested lists to build higher rank tensors.

ufl.as_ufl(expression)

  Converts expression to an Expr if possible.

ufl.as_vector(expressions, index=None)

  As `as_tensor()`, but limited to rank 1 tensors.

ufl.asin(f)

  Take the inverse sine of f.

ufl.atan(f)

  Take the inverse tangent of f.

ufl.atan2(f1, f2)

  Take the inverse tangent with two the arguments f1 and f2.

ufl.avg(v)

  Take the average of v across a facet.

ufl.bessel_I(nu, f)

  Regular modified cylindrical Bessel function.

ufl.bessel_J(nu, f)

  Cylindrical Bessel function of the first kind.

ufl.bessel_K(nu, f)

  Irregular modified cylindrical Bessel function.

ufl.bessel_Y(nu, f)

  Cylindrical Bessel function of the second kind.

ufl.cell_avg(f)

  Take the average of v over a cell.

ufl.cofac(A)

  Take the cofactor of A.

ufl.conditional(condition, true_value, false_value)

  A conditional expression.

  This takes the value of true_value when condition evaluates to true and false_value otherwise.

ufl.conj(f)

  The complex conjugate of f.

ufl.cos(f)

  Take the cosine of f.

ufl.cosh(f)

  Take the hyperbolic cosine of f.

ufl.cross(a, b)

  Take the cross product of a and b.

ufl.curl(f)

  Take the curl of f.

ufl.derivative(form, coefficient, argument=None, coefficient_derivatives=None)

  Compute the Gateaux derivative of form w.r.t. coefficient in direction of argument.

  If the argument is omitted, a new `Argument` is created in the same space as the coefficient, with argument number one higher than the highest one in the form.

  The resulting form has one additional `Argument` in the same finite element space as the coefficient.

  A tuple of `Coefficient` s may be provided in place of a single `Coefficient`, in which case the new `Argument` argument is based on a `MixedElement` created from this tuple.

  An indexed `Coefficient` from a mixed space may be provided, in which case the argument should be in the corresponding subspace of the coefficient space.

  If provided, coefficient_derivatives should be a mapping from `Coefficient` instances to their derivatives w.r.t. coefficient.

ufl.det(A)

  Take the determinant of A.

ufl.dev(A)

  Take the deviatoric part of A.

ufl.diag(A)

  Diagonal ranl-2 tensor.

  Take the diagonal part of rank 2 tensor A or make a diagonal rank 2 tensor from a rank 1 tensor.

  Always returns a rank 2 tensor. See also diag_vector.

ufl.diag_vector(A)

  Take the diagonal part of rank 2 tensor A and return as a vector.

  See also diag.

ufl.diff(f, v)

  Take the derivative of f with respect to the variable v.

  If f is a form, diff is applied to each integrand.

ufl.div(f)

  Take the divergence of f.

  This operator follows the div convention where

    div(v) = v[i].dx(i) div(T)[:] = T[:,i].dx(i)

  for vector expressions v, and arbitrary rank tensor expressions T.

  See also: `nabla_div()`

ufl.dot(a, b)

  Take the dot product of a and b.

  This won’t take the complex conjugate of the second argument.

ufl.elem_div(A, B)

  Take the elementwise division of tensors A and B with the same shape.

ufl.elem_mult(A, B)

  Take the elementwise multiplication of tensors A and B with the same shape.

ufl.elem_op(op, *args)

  Apply element-wise operations.

  Take the element-wise application of operator op on scalar values from one or more tensor arguments.

ufl.elem_pow(A, B)

  Take the elementwise power of tensors A and B with the same shape.

ufl.energy_norm(form, coefficient=None)

  Get the energy norm.

  Given a bilinear form a and a coefficient f, return the functional \(a(f,f)\).

ufl.eq(left, right)

  A boolean expression (left == right) for use with conditional.

ufl.erf(f)

  Take the error function of f.

ufl.exp(f)

  Take the exponential of f.

ufl.exterior_derivative(f)

  Take the exterior derivative of f.

  The exterior derivative uses the element Sobolev space to determine whether id, grad, curl or div should be used.

  Note that this uses the grad and div operators, as opposed to nabla_grad and nabla_div.

ufl.extract_blocks(form: Form, i: int | None = None, j: int | None = None, replace_argument: bool = True)

  Extract blocks.

  Given a linear or bilinear form on a mixed space, extract the block corresponding to the indices ix, iy.

  Example:

    a = inner(grad(u), grad(v))*dx + div(u)*q*dx + div(v)*p*dx extract_blocks(a, 0, 0) -> inner(grad(u), grad(v))*dx extract_blocks(a) -> [inner(grad(u), grad(v))*dx, div(v)*p*dx, div(u)*q*dx, 0]

ufl.facet_avg(f)

  Take the average of v over a facet.

ufl.functional(form)

  Extract the functional part of form.

ufl.ge(left, right)

  A boolean expression (left >= right) for use with conditional.

ufl.grad(f)

  Take the gradient of f.

  This operator follows the grad convention where

    grad(s)[i] = s.dx(i) grad(v)[i,j] = v[i].dx(j) grad(T)[:,i] = T[:].dx(i)

  for scalar expressions s, vector expressions v, and arbitrary rank tensor expressions T.

  See also: `nabla_grad()`

ufl.gt(left, right)

  A boolean expression (left > right) for use with conditional.

ufl.imag(f)

  The imaginary part of f.

ufl.indices(n)

  Return a tuple of n new Index objects.

ufl.inner(a, b)

  Take the inner product of a and b.

  The complex conjugate of the second argument is taken.

ufl.integral_types()

  Return a tuple of all domain type strings.

ufl.interpolate(expr, v)

  Create symbolic representation of the interpolation operator.

  Args:
    expr:

      a UFL expression to interpolate.

    v:

      the FunctionSpace to interpolate into or the Coargument defined on the dual of the FunctionSpace to interpolate into.

ufl.inv(A)

  Take the inverse of A.

ufl.jump(v, n=None)

  Take the jump of v across a facet.

ufl.le(left, right)

  A boolean expression (left <= right) for use with conditional.

ufl.lhs(form)

  Get the left hand side.

  Given a combined bilinear and linear form, extract the left hand side (bilinear form part).

  Example:

    a = u*v*dx + f*v*dx a = lhs(a) -> u*v*dx

ufl.ln(f)

  Take the natural logarithm of f.

ufl.lt(left, right)

  A boolean expression (left < right) for use with conditional.

ufl.max_value(x, y)

  Take the maximum of x and y.

ufl.min_value(x, y)

  Take the minimum of x and y.

ufl.nabla_div(f)

  Take the divergence of f.

  This operator follows the div convention where

    nabla_div(v) = v[i].dx(i) nabla_div(T)[:] = T[i,:].dx(i)

  for vector expressions v, and arbitrary rank tensor expressions T.

  See also: `div()`

ufl.nabla_grad(f)

  Take the gradient of f.

  This operator follows the grad convention where

    nabla_grad(s)[i] = s.dx(i) nabla_grad(v)[i,j] = v[j].dx(i) nabla_grad(T)[i,:] = T[:].dx(i)

  for scalar expressions s, vector expressions v, and arbitrary rank tensor expressions T.

  See also: `grad()`

ufl.ne(left, right)

  A boolean expression (left != right) for use with conditional.

ufl.outer(*operands)

  Take the outer product of two or more operands.

  The complex conjugate of the first argument is taken.

ufl.perp(v)

  Take the perp of v.

  I.e. \((-v_1, +v_0)\).

ufl.product(sequence)

  Return the product of all elements in a sequence.

ufl.rank(f)

  The rank of f.

ufl.real(f)

  The real part of f.

ufl.register_integral_type(integral_type, measure_name)

  Register an integral type.

ufl.replace(e, mapping)

  Replace subexpressions in expression.

  Params:

    e: An Expr or Form mapping: A dict with from:to replacements to perform

  Returns:

    The expression with replacements performed

ufl.rhs(form)

  Get the right hand side.

  Given a combined bilinear and linear form, extract the right hand side (negated linear form part).

  Example:

    a = u*v*dx + f*v*dx L = rhs(a) -> -f*v*dx

ufl.rot(f)

  Take the curl of f.

ufl.sensitivity_rhs(a, u, L, v)

  Compute the right hand side for a sensitivity calculation system.

  The derivation behind this computation is as follows. Assume a, L to be bilinear and linear forms corresponding to the assembled linear system

  \[Ax = b.\]

  Where x is the vector of the discrete function corresponding to u. Let v be some scalar variable this equation depends on. Then we can write

  \[ \begin{align}\begin{aligned}\begin{split}0 = \\frac{d}{dv}(Ax-b) = \\frac{dA}{dv} x + A \\frac{dx}{dv} - \\frac{db}{dv},\end{split}\\\begin{split}A \\frac{dx}{dv} = \\frac{db}{dv} - \\frac{dA}{dv} x,\end{split}\end{aligned}\end{align} \]

  and solve this system for \(\\frac{dx}{dv}\), using the same bilinear form a and matrix A from the original system. Assume the forms are written

      v = variable(v_expression)
      L = IL(v) * dx
      a = Ia(v) * dx

  where `IL` and `Ia` are integrand expressions. Define a `Coefficient u` representing the solution to the equations. Then we can compute \(\\frac{db}{dv}\) and \(\\frac{dA}{dv}\) from the forms

      da = diff(a, v)
      dL = diff(L, v)

  and the action of `da` on `u` by

      dau = action(da, u)

  In total, we can build the right hand side of the system to compute \(\\frac{du}{dv}\) with the single line

      dL = diff(L, v) - action(diff(a, v), u)

  or, using this function,

      dL = sensitivity_rhs(a, u, L, v)

ufl.shape(f)

  The shape of f.

ufl.sign(x)

  Return the sign of x.

  This returns +1 if x is positive, -1 if x is negative, and 0 if x is 0.

ufl.sin(f)

  Take the sine of f.

ufl.sinh(f)

  Take the hyperbolic sine of f.

ufl.skew(A)

  Take the skew symmetric part of A.

ufl.split(v)

  Split a coefficient or argument.

  If v is a Coefficient or Argument in a mixed space, returns a tuple with the function components corresponding to the subelements.

ufl.sqrt(f)

  Take the square root of f.

ufl.sym(A)

  Take the symmetric part of A.

ufl.system(form)

  Split a form into the left hand side and right hand side.

  See `lhs` and `rhs`.

ufl.tan(f)

  Take the tangent of f.

ufl.tanh(f)

  Take the hyperbolic tangent of f.

ufl.tr(A)

  Take the trace of A.

ufl.transpose(A)

  Take the transposed of tensor A.

ufl.unit_matrices(d)

  A tuple of constant unit matrices in all directions with dimension d.

ufl.unit_matrix(i, j, d)

  A constant unit matrix in direction i,*j* with dimension d.

ufl.unit_vector(i, d)

  A constant unit vector in direction i with dimension d.

ufl.unit_vectors(d)

  A tuple of constant unit vectors in all directions with dimension d.

ufl.variable(e)

  Define a variable representing the given expression.

  See also diff().

ufl.zero(*shape)

  UFL literal constant: Return a zero tensor with the given shape.