firedrake.adjoint package

Submodules

firedrake.adjoint.ufl_constraints module

class firedrake.adjoint.ufl_constraints.UFLConstraint(form, control)[source]

Bases: Constraint

Easily implement scalar constraints using UFL.

The form must be a 0-form that depends on a Function control.

function(m)[source]

Evaluate c(m), where c(m) == 0 for equality constraints and c(m) >= 0 for inequality constraints.

c(m) must return a numpy array or a dolfin Function or Constant.

hessian_action(m, dm, dp, result)[source]

Computes the Hessian action of c(m) in direction dm and dp.

Stores the result in result.

jacobian(m)[source]

Returns the full Jacobian matrix as a list of vector-like objects representing the gradient of the constraint function with respect to the parameter m.

The objects returned must be of the same type as m’s data.

jacobian_action(m, dm, result)[source]

Computes the Jacobian action of c(m) in direction dm.

Stores the result in result.

jacobian_adjoint_action(m, dp, result)[source]

Computes the Jacobian adjoint action of c(m) in direction dp.

Stores the result in result.

output_workspace()[source]

Return an object like the output of c(m) for calculations.

update_control(m)[source]
class firedrake.adjoint.ufl_constraints.UFLEqualityConstraint(form, control)[source]

Bases: UFLConstraint, EqualityConstraint

class firedrake.adjoint.ufl_constraints.UFLInequalityConstraint(form, control)[source]

Bases: UFLConstraint, InequalityConstraint

Module contents

The public interface to Firedrake’s adjoint.

To start taping, run:

from firedrake.adjoint import *
continue_annotation()