pycif.plugins.models.lmdz_acc — API reference#

Configuration reference: lmdz_acc plugin

pycif.plugins.models.lmdz_acc.compile.make_command(self)[source]#

Build the make command list for compiling LMDZ-ACC.

Assembles make arguments from the plugin’s compile-time attributes: domain dimensions (DIM), compile mode (MODE), OpenACC target (TARGET), and optional Fortran compiler / NetCDF paths.

Parameters:

self – LMDZ-ACC model plugin instance.

Returns:

the make command and its arguments.

Return type:

list[str]

pycif.plugins.models.lmdz_acc.compile.compile(self)[source]#

Compile or copy LMDZ-ACC executables into the CIF work directory.

Attempts to copy pre-compiled binaries from self.direxec first (skipped if force-recompile is set), then falls back to running make_command() inside the LMDZ source tree.

Parameters:

self – LMDZ-ACC model plugin instance with workdir and direxec (or dirsrc) set.

pycif.plugins.models.lmdz_acc.flushrun.flushrun(self, rundir, mode, transform_id, full_flush=True)[source]#

Cleaning the simulation directories to limit space usage

pycif.plugins.models.lmdz_acc.ini_mapper.ini_mapper(model, transform_type, general_mapper={}, backup_comps={}, transforms_order=[], ref_transform='', transform_name='', **kwargs)[source]#

Build the data-flow mapper for the LMDZ-ACC model.

Declares flux, meteorology, initial-condition, end-concentration, and (optionally) observation inputs, plus concentration and diagnostic outputs. Also populates outputs2inputs linking each output tracer to its source inputs for adjoint sensitivity routing.

Two date grids are used:

  • input_dates — coarser grid for initial/end concentrations.

  • flx_input_dates — finer grid for flux and meteo inputs.

Parameters:
  • model – LMDZ-ACC model plugin instance.

  • transform_type (str) – unused; kept for API compatibility.

  • general_mapper (dict) – unused.

  • backup_comps (dict) – unused.

  • transforms_order (list) – unused.

  • ref_transform (str) – unused.

  • transform_name (str) – unused.

  • **kwargs – unused.

Returns:

mapper with inputs, outputs, and outputs2inputs.

Return type:

dict

pycif.plugins.models.lmdz_acc.ini_periods.ini_periods(self, **kwargs)[source]#

Compute temporal discretisation for the LMDZ-ACC model.

Splits the full simulation window into sub-simulation periods and builds time-step arrays at the resolution dictated by the LMDZ domain’s dynamical (dsplit) and physical (psplit) sub-steps and the meteorological offset time step (meteo.offtstep).

Sets on self:

  • subsimu_dates — period boundary dates.

  • tstep_dates — per-period time-step arrays.

  • input_dates — per-period initial/end-concentration date arrays.

  • flx_input_dates — per-period flux/meteo input date arrays.

  • tstep_all — sorted unique merge of all time steps.

  • iniobs, reset_obs — per-period observation bookkeeping flags.

  • chain — per-period flag indicating whether the period is chained from the previous one.

Parameters:
  • self – LMDZ-ACC model plugin instance with datei, datef, periods, domain, and meteo set.

  • **kwargs – unused.

pycif.plugins.models.lmdz_acc.perturb_model.append_attribute(plugin: Any, key: str, attr: Any) None[source]#

Set attr as attribute key on plugin and append key to plugin.attributes.

pycif.plugins.models.lmdz_acc.perturb_model.remove_attribute(plugin: Any, key: str) None[source]#

Delete attribute key from plugin and remove it from plugin.attributes.

pycif.plugins.models.lmdz_acc.perturb_model.perturb_model(self, nsamples, transf_mapper)[source]#

Extend the LMDZ-ACC chemistry scheme to accommodate ensemble members.

Creates nsamples copies of each active, output, and emitted species using the __sample#NNN naming convention, then removes the original un-suffixed species. Records self.perturbed_species mapping sample names back to originals.

Parameters:
  • self – LMDZ-ACC model plugin instance.

  • nsamples (int) – number of ensemble members.

  • transf_mapper (dict) – unused; kept for API consistency.

pycif.plugins.models.lmdz_acc.run.run_dispersion(self, runsubdir)[source]#

Launch the LMDZ-ACC dispersion executable for one sub-simulation period.

Runs the LMDZ-ACC binary in runsubdir, optionally setting the ACC_NUM_CORES environment variable for GPU/OpenACC thread control. Raises on non-zero exit code.

Parameters:
  • self – LMDZ-ACC model plugin instance.

  • runsubdir (str) – path to the period run directory.

Raises:

subprocess.CalledProcessError – if the dispersion run fails.

pycif.plugins.models.lmdz_acc.run.run(self, runsubdir, mode, workdir, ddi, do_simu=True, approx_transf=False, ref_fwd_dir='', overlap=False, **kwargs)[source]#

Run LMDZ model in forward or adjoint mode

Parameters:
  • runsubdir (str) – working directory for the current run

  • mode (str) – forward or backward

  • workdir (str) – pycif working directory

  • do_simu (bool) – if False, considers that the simulation was already run

pycif.plugins.models.lmdz_acc.run.check_approx_threshold(self, ddi, mode, runsubdir)[source]#

Decide whether to skip transport and approximate with linear chemistry.

If species concentrations from the forward run exceed a configured threshold (self.approx_thresholds), marks the period for approximate treatment so that the expensive LMDZ transport is skipped and replaced by a local linear-chemistry approximation.

Parameters:
  • self – LMDZ-ACC model plugin instance.

  • ddi (datetime) – period start date.

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

  • runsubdir (str) – path to the period run directory.