cashocs.ScalarTrackingFunctional#
- class cashocs.ScalarTrackingFunctional(
- integrand: ufl_legacy.Form,
- tracking_goal: float | int | c_float | c_double,
- weight: float | int = 1.0,
Bases:
FunctionalTracking cost functional for scalar quantities arising due to integration.
Initializes self.
- Parameters:
integrand (ufl.Form) – The integrand of the functional
tracking_goal (float | int | ctypes.c_float | ctypes.c_double) – A real number, which the integral of the integrand should track. Note, that when a ctypes object is passed, the float is assumed to be mutable and the tracking_goal is updated every iteration.
weight (float | int) – A real number which gives the scaling factor for this functional
Methods Summary
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
- 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]
- derivative(
- argument: ufl_legacy.core.expr.Expr,
- direction: ufl_legacy.core.expr.Expr,
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
- evaluate() float[source]#
Evaluates the functional.
- Returns:
The current value of the functional.
- Return type:
float