tlm_adjoint.fenics.variables

FEniCS variables.

Module Contents

class tlm_adjoint.fenics.variables.Constant(value=None, *args, name=None, domain=None, space=None, space_type='primal', shape=None, comm=None, static=False, cache=None, **kwargs)

Extends the DOLFIN Constant class.

Parameters:
  • value – The initial value. None indicates a value of zero.

  • name – A str name.

  • domain – The domain on which the Constant is defined.

  • space – The space on which the Constant is defined.

  • space_type – The space type for the Constant. ‘primal’, ‘dual’, ‘conjugate’, or ‘conjugate_dual’.

  • shape – A tuple of int objects defining the shape of the value.

  • comm – The communicator for the Constant.

  • static – Defines whether the Constant is static, meaning that it is stored by reference in checkpointing/replay, and an associated tangent-linear variable is zero.

  • cache – Defines whether results involving the Constant may be cached. Default static.

Remaining arguments are passed to the DOLFIN Constant constructor.

class tlm_adjoint.fenics.variables.Function(*args, space_type='primal', static=False, cache=None, **kwargs)

Extends the DOLFIN Function class.

Parameters:
  • space_type – The space type for the Function. ‘primal’, ‘dual’, ‘conjugate’, or ‘conjugate_dual’.

  • static – Defines whether the Function is static, meaning that it is stored by reference in checkpointing/replay, and an associated tangent-linear variable is zero.

  • cache – Defines whether results involving the Function may be cached. Default static.

Remaining arguments are passed to the DOLFIN Function constructor.

class tlm_adjoint.fenics.variables.ZeroConstant(*, name=None, domain=None, space=None, space_type='primal', shape=None, comm=None)

A Constant which is flagged as having a value of zero.

Arguments are passed to the Constant constructor, together with static=True and cache=True.

class tlm_adjoint.fenics.variables.ZeroFunction(*args, **kwargs)

A Function which is flagged as having a value of zero.

Arguments are passed to the Function constructor, together with static=True and cache=True.

class tlm_adjoint.fenics.variables.ReplacementConstant(x, count)

Represents a symbolic DOLFIN Constant, but has no value.

class tlm_adjoint.fenics.variables.ReplacementFunction(x, count)

Represents a symbolic DOLFIN Function, but has no value.

class tlm_adjoint.fenics.variables.ReplacementZeroConstant(*args, **kwargs)

Represents a symbolic DOLFIN Constant which is zero, but has no value.

class tlm_adjoint.fenics.variables.ReplacementZeroFunction(*args, **kwargs)

Represents a symbolic DOLFIN Function which is zero, but has no value.

tlm_adjoint.fenics.variables.to_fenics(y, space, *, name=None)

Convert a variable to a DOLFIN Function.

Parameters:
  • y – A variable.

  • space – The space for the return value.

  • name – A str name.

Returns:

The DOLFIN Function.