tlm_adjoint.markers
Module Contents
- class tlm_adjoint.markers.ControlsMarker(M)
Represents
\[m = m_\text{input},\]where \(m\) is the control and \(m_\text{input}\) the input value for the control. The forward residual is defined
\[\mathcal{F} \left( m \right) = m - m_\text{input}.\]- Parameters:
M – A variable or a
Sequence
of variables defining the control \(m\). May be static.
- adjoint_jacobian_solve(adj_X, nl_deps, B)
Compute an adjoint solution.
- Parameters:
adj_X – Either None, or a variable (if the adjoint solution has a single component) or
Sequence
of variables (otherwise) defining the initial guess for an iterative solve. May be modified or returned. Subclasses may replace this argument with adj_x if the adjoint solution has a single component.nl_deps – A
Sequence
of variables defining values for non-linear dependencies. Should not be modified.B – The right-hand-side. A variable (if the adjoint solution has a single component) or
Sequence
of variables (otherwise) storing the value of the right-hand-side. May be modified or returned. Subclasses may replace this argument with b if the adjoint solution has a single component.
- Returns:
A variable or
Sequence
of variables storing the value of the adjoint solution. May return None to indicate a value of zero.
- class tlm_adjoint.markers.FunctionalMarker(J)
Represents
\[J_\text{output} = J,\]where \(J\) is the functional and \(J_\text{output}\) is the output value for the functional. The forward residual is defined
\[\mathcal{F} \left( J_\text{output}, J \right) = J_\text{output} - J.\]- Parameters:
J – A variable defining the functional \(J\).
- adjoint_derivative_action(nl_deps, dep_index, adj_x)
Return the action of the adjoint of a derivative of the forward residual on the adjoint solution. This is the negative of an adjoint right-hand-side term.
- Parameters:
nl_deps – A
Sequence
of variables defining values for non-linear dependencies. Should not be modified.dep_index – An
int
. The derivative is defined by differentiation of the forward residual with respect to self.dependencies()[dep_index].adj_X – The adjoint solution. A variable if the adjoint solution has a single component, otherwise a
Sequence
of variables. Should not be modified. Subclasses may replace this argument with adj_x if the adjoint solution has a single component.
- Returns:
The action of the adjoint of a derivative on the adjoint solution. Will be passed to
subtract_adjoint_derivative_action()
, and valid types depend upon the adjoint variable type. Typically this will be a variable, or a two elementtuple
(alpha, F), where alpha is anumbers.Complex
and F a variable, with the value defined by the product of alpha and F.
- adjoint_jacobian_solve(adj_x, nl_deps, b)
Compute an adjoint solution.
- Parameters:
adj_X – Either None, or a variable (if the adjoint solution has a single component) or
Sequence
of variables (otherwise) defining the initial guess for an iterative solve. May be modified or returned. Subclasses may replace this argument with adj_x if the adjoint solution has a single component.nl_deps – A
Sequence
of variables defining values for non-linear dependencies. Should not be modified.B – The right-hand-side. A variable (if the adjoint solution has a single component) or
Sequence
of variables (otherwise) storing the value of the right-hand-side. May be modified or returned. Subclasses may replace this argument with b if the adjoint solution has a single component.
- Returns:
A variable or
Sequence
of variables storing the value of the adjoint solution. May return None to indicate a value of zero.