Source code for pycif.plugins.transforms.basic.background.adjoint
import copy
[docs]
def adjoint(
transform,
inout_datastore,
controlvect,
obsvect,
mapper,
di,
df,
mode,
runsubdir,
workdir,
onlyinit=False,
**kwargs
):
"""Pass the output sensitivity directly to the concentration input.
The adjoint of addition is trivial: the sensitivity to the total
``y = y_concs + y_background`` is identical for both terms. The
background field is not a control variable, so only the ``concs``
sensitivity is propagated.
Args:
transform (Plugin): background instance (carries ``spec``).
inout_datastore (dict): mutable datastore.
controlvect: unused.
obsvect: unused.
mapper (dict): transform mapper.
di (datetime): sub-simulation start date.
df (datetime): unused.
mode (str): ``'adj'``.
runsubdir (str): unused.
workdir (str): unused.
onlyinit (bool): unused.
**kwargs: unused.
"""
xmod_in = inout_datastore["inputs"]
xmod_out = inout_datastore["outputs"]
xmod_in[("concs", transform.spec)] = copy.deepcopy(
xmod_out[("concs", transform.spec)])