pycif.plugins.transforms.complex.moist2dry — API reference

Contents

pycif.plugins.transforms.complex.moist2dry — API reference#

Configuration reference: moist2dry plugin

pycif.plugins.transforms.complex.moist2dry.adjoint.adjoint(transf, inout_datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, onlyinit=False, **kwargs)[source]#

Apply the moist-to-dry conversion factor to the adjoint sensitivity.

The adjoint of forward(): multiplies adj_out of the species input by the same dry_coef scalar used in the forward pass.

Note: the sensitivity w.r.t. specific humidity q is not computed (q is treated as a fixed diagnostic field, not a control variable).

Parameters:
  • transf (Plugin) – moist2dry plugin instance.

  • inout_datastore (dict) – mutable datastore.

  • controlvect – unused.

  • obsvect – unused.

  • mapper (dict) – transform mapper.

  • di (datetime) – sub-simulation start date.

  • df (datetime) – sub-simulation end date.

  • mode (str) – 'adj'.

  • runsubdir (str) – unused.

  • workdir (str) – unused.

  • onlyinit (bool) – if True, return immediately.

  • **kwargs – unused.

pycif.plugins.transforms.complex.moist2dry.forward.forward(transf, inout_datastore, controlvect, obsvect, mapper, di, df, mode, runsubdir, workdir, onlyinit=False, **kwargs)[source]#

Convert a moist-air mixing ratio to a dry-air number concentration.

Applies the conversion:

\[C_{dry} = C_{moist} \cdot \underbrace{\left(1 - \beta \frac{q}{1-q}\right) \cdot \frac{R}{R_{dry} \cdot M} \cdot 10^{12}}_{\text{dry\_coef}}\]

where:

  • \(\beta = (R_{vapor} - R_{dry}) / R_{vapor}\) (≈ 0.378)

  • \(R = 8.314\) J mol⁻¹ K⁻¹ (universal gas constant)

  • \(R_{dry} = 287.05\) J kg⁻¹ K⁻¹ (dry-air gas constant)

  • \(M\) = transf.molmass (g mol⁻¹)

  • q = specific humidity from the specific_humidity input

In TL mode the same scalar coefficient is applied to the increment field.

Parameters:
  • transf (Plugin) – moist2dry plugin instance (must carry molmass in g mol⁻¹ and component/parameter attributes).

  • inout_datastore (dict) – mutable datastore; 'inputs' must contain both the species field and the specific_humidity field.

  • controlvect – unused.

  • obsvect – unused.

  • mapper (dict) – transform mapper.

  • di (datetime) – sub-simulation start date.

  • df (datetime) – sub-simulation end date.

  • mode (str) – 'fwd' or 'tl'.

  • runsubdir (str) – unused.

  • workdir (str) – unused.

  • onlyinit (bool) – unused.

  • **kwargs – unused.