cashocs.Functional#

class cashocs.Functional[source]#

Bases: ABC

Base class for all cost functionals.

Methods Summary

coefficients()

Computes the ufl coefficients which are used in the functional.

derivative(argument, direction)

Computes the derivative of the functional w.r.t.

evaluate()

Evaluates the functional.

scale(scaling_factor)

Scales the functional by a scalar.

update()

Updates the functional after solving the state equation.

Methods Documentation

abstractmethod coefficients() tuple[fenics.Function][source]#

Computes the ufl coefficients which are used in the functional.

Returns:

The set of used coefficients.

Return type:

tuple[fenics.Function]

abstractmethod derivative(argument: ufl_legacy.core.expr.Expr, direction: ufl_legacy.core.expr.Expr) ufl_legacy.Form[source]#

Computes the derivative of the functional w.r.t. argument towards direction.

Parameters:
  • argument (ufl_legacy.core.expr.Expr) – The argument, w.r.t. which the functional is differentiated

  • direction (ufl_legacy.core.expr.Expr) – The direction into which the derivative is computed

Returns:

A form of the resulting derivative

Return type:

ufl_legacy.Form

abstractmethod evaluate() float[source]#

Evaluates the functional.

Returns:

The current value of the functional.

Return type:

float

abstractmethod scale(scaling_factor: float | int) None[source]#

Scales the functional by a scalar.

Parameters:

scaling_factor (float | int) – The scaling factor used to scale the functional

Return type:

None

abstractmethod update() None[source]#

Updates the functional after solving the state equation.

Return type:

None