############################# Developments around CHIMERE ############################# .. role:: bash(code) :language: bash How to pass a new parameter from the yaml to CHIMERE ----------------------------------------------------- 0. From a yaml that works. Add the new parameter in the yaml (with one of its possible values). Example for a switch, here :bash:`ignore_input_dates`, which can be 0 or 1, True or False: .. code-block:: yaml model : plugin: name : CHIMERE version : std direxec: /home/users/ipison/cif/model_sources/chimereGES/ ignore_input_dates: True [...] 1. Add the new input arguments in :bash:`__init__.py` with all the relevant information: .. code-block:: python input_arguments = { "direxec": { "doc": "Path to CHIMERE sources and/or executables. " "For executables, ``fwdchimere.e``, ``tlchimere.e`` and ``achimere.e`` should be in " "``${path}/src``, ``${path}/src_tl`` and ``${path}/src_ad`` respective sub-folders.", "default": None, "accepted": str }, "ignore_input_dates": { "doc": "Ignore errors in CHIMERE that checks the consistency of dates " "in AEMISSIONS, BEMISSIONS, BOUN_CONCS, etc; " "this is useful if you want to use input files from " "another period as is", "default": False, "accepted": bool } [...] 2. Pass this argument to CHIMERE via its input file :bash:`chimere.nml`. This file is generated by :bash:`io/inputs/params.py` by function :bash:`make_nml` so that the new information has simply to be added to the list. .. code-block:: python def make_nml(self, runsubdir, sdc, mode, ddi): # Default values nvegtype = getattr(self, "nvegtype", 16) # Fills in chimere.nml domain = self.domain chemistry = self.chemistry dirchem = chemistry.dirchem_ref schemeid = chemistry.schemeid nho = self.nho # NML string to write with open("{}/chimere.nml".format(runsubdir), "w") as f: f.write("&args\n") [...] f.write("hpulse = {}\n".format(self.hpulse)) f.write("ignore_chck_dates = {}\n".format(1 if self.ignore_input_dates else 0)) f.write("/\n") Important: for easier use in the fortran, True/False are often "converted" into 1/0. Remark: the name used in CHIMERE is here different from the name in the yaml. Remark: it is also pssible to access parameters which are defined in a paragraph that is not :bash:`model` e.g. :bash:`chemistry`. 3. Make use of the new information in CHIMERE's sources, in :bash:`model_sources/chimereGES/src*`: a) Declare it in :bash:`modules/chimere_common.F90` and, if the information is to be used by the workers as well as by the master, in :`model/worker_common.F90` (which is not the case for the example :bash:`ignore_chck_dates`). b) Read it in :bash:`initio/iniread.F90` c) If declared in :bash:`model/wotker_common.F90`, pass it from the master to the workers through the relevant subroutine in :bash:`module/master_message_subs.F90` and the matching one in :bash:`model/worker_message_subs.F90`, plus declare the communication in :bash:`module/master_message_defs.F90`. d) Make use of the information where it is relevant in CHIMERE's sources. Compile CHIMERE to check that everything is OK in the fortan sources. 4. Run a test case with the yaml including this parameter.