################################################################## First forward simulation with LMDz-SACS ################################################################## .. role:: bash(code) :language: bash Here we run a forward simulation of :doc:`LMDz-SACS Model` including the comparison to observation data. Please note :doc:`here` some instructions about how pyCIF deals with paths. 1. Prepare the executable ========================== In directory :bash:`model_sources/DISPERSION_gch`: - Edit :bash:`compile_dispersion` to select the resolution and parameter for filtering (first lines, user defined variables :bash:`dim` and :bash:`para`, available choices are detailed in the comments); save and close - Compile the fortran chemistry-transport model: .. code-block:: bash ./compile_dispersion In case of a previous compilation, running the command below ensures that previous compilations are removed before compiling again. .. code-block:: bash ./compile_dispersion --clean => At this point, check that you obtain an executable named :bash:`dispersion.e`, about 30M in size. 2. Gather the input files ========================== Some files must be pre-processed and provided in the format directly read by LMDz-SACS: XXXXXXXXXXXX NE GARDER ICIQUE CEUX QUI NE SONT PAS GERES PAR UN PRE-PROC OU CEUX QUI SONT A L'ORIGINE DES FICHIERS D'ENTREE MAIS DOIVENT ETRE VRAIMENT TROUVES TOUT FAITS ex: les flux de masse XXXXXXXXXXXXXX LMDz-SACS requires multiple input files, which are generally precomputed by the online version of LMDz (for mass fluxes) or INCA (for prescribed species): - a definition of the horizontal LMDz grid and of the vertical coefficients Ap and Bp in a :doc:`netcdf file` - the :doc:`mass fluxes`, generally precomputed by the online version of LMDz - the :doc:`emission files` associated to each simulated tracer (or tracer family). No simulation can run without these files. Other files are required depending on the configuration to run. If chemistry is taken into account, various fields are required, depending on the chemical scheme: - if any, the prescribed concentrations i.e. the concentration fields of species that react with the tracer(s). The :doc:`binary files for the prescribed species` (see ``do_chemistry``) are generated by the CIF from NetCDF files with the :doc:`lmdz_prescrconcs` plugin. .. Prescribed fields associated to the emitted/simulated tracers (netCDF files). Must be monthly files with daily values (28-31 depending on the month). Latitude and longitude coordinates must be consistent with specified domain. The number of levels must be consistent with the definition of the vertical coordinate. The unit must be Volume Mixing Ratio (VMR). Variables must have therefore four coordinates (time, pressure_level, latitude, longitude), following this order. - if any, the :doc:`3d-production and loss fields` (see ``do_chemistry``) i.e. the fields of given (chemical) production and loss by chemistry not explicitly described in the chemical scheme. These are read by the CIF from NetCDF files with the :doc:`lmdz_prodloss3d` plugin. - if any deposited species, the :doc:`associated deposition velocities` (see ``do_chemistry``) XXX a detailler dans la doc, tout comme les prescribedXXXX - the :doc:`kinetic data for chemical reactions`: pressure, temperatue and, if any photolysis reactions, the associated photolysis constant rates (see ``do_chemistry``). These are read by the CIF from NetCDF files with the :doc:`lmdz_photochem` plugin. Finally, a restart file is not mandatory but strongly recommended to prescribe realistic initial conditions. XX TO CHECK XX XXXXXXXXXXXXXXXXXXXXXXX So far, at least one observation must be provided in the last period of the simulation. To avoid running unnecessary simulations, it is indeed implemented that periods without observations are not run. The :doc:`random` plugin can be used to override this behavior. 3. Prepare the chemical scheme: =============================== The chemical scheme is a yaml file based on the following template: .. code-block:: yaml # Name of the chemical scheme schemeid: my_scheme # Active species : species to be transported in the model acspecies: SPEC1: restart_id: 1 # number used as ID for the species in the restart files to read/to be created mass: 16.0425 # molar mass SPEC2: restart_id: 3 mass: 16.0 # emitted species (among the active species) emis_species: SPEC1: # State variables and J for photolysis kinetic: dir: a_reference_directory file: file_containing_Js_prescribed_fields_and_state_variables.nc # Prescribed species: they are not active and reacts with the emitted species prescrconcs: P1: P2: P3: # Deposited species, among the active species deposition: SPEC2: dir: another_reference_directory file: file_containing_deposition_velocities # Chemical reactions reactions: r1: SPEC1+P1->AA+P2 k=1.125e-10 r2: SPEC2+P2->BB+CC k=3.75e-11 r3: SPEC1+P2->CC k(T)=Aexp(-B/T),A=2.45e-12,B=1775 r4: SPEC1+P3->DD+EE k(T)=Aexp(-B/T),A=7.1e-12,B=1270 r5: SPEC2->CC J=4 Examples: :doc:`here` or :doc:`here` It is then necessary to check that the associated LMDz-SACS input files are available. 4. Write the YAML file : ======================== a. PyCIF parameters ------------------- section for PyCIF parameters: .. code-block:: yaml ##################################################################### ##################################################################### # PYCIF parameters # Verbose level # 1 = Debugging # 2 = Basic information verbose : 1 # Log file (to be saved in $wordkir) logfile: pycif.log # Execution directory workdir: /absolute/path/to/working/directory # Initial date # Use the following compatible format for the date: # YYYY-mm-dd or YYYY-mm-dd HH:mm:ss datei : 2011-07-01 # End date (same as for the initial date) datef : 2011-07-31 In this section of the YAML, it is possible to define :doc:`anchors` to be used in the rest of the file. b. mode ------- .. include:: ../common/mode.rst c. obsoperator -------------- .. include:: ../common/obsoperator.rst d. controlvect -------------- .. include:: ../common/controlvect.rst e. model -------- The :doc:`lmdz` plugin is used to define the LMDz parameters which requires a "controle vector" NetCDF file defining several constants for LMDz: .. code-block:: yaml model: plugin: name: LMDZ version: std periods: 1MS # Length of simulation sub-periods # Convection scheme: One of : # 'TK' = 'Tiedke' # 'KE' = 'Kerry Emmanuel' # 'KE-Therm' = 'Kerry Emmanuel + some thermics' conv_scheme: TK physic: True # Include physics do_chemistry: True # Include chemistry fileexec: /absolute/path/to/dispersion.e # Executable file_controle: /absolute/path/to/LMDz_controle_vector.nc dump: False # Dump outputs into a NetCDF file .. container:: toggle .. container:: header Show/Hide ``controle_vector.nc`` .. code-block:: c netcdf LMDz_controle_vector { dimensions: index = 100 ; variables: double controle(index) ; controle:long_name = "LMDz constant parameters" ; data: controle = 96, 95, 39, 0, 2000, 6400000, 7.272205e-05, 9.8, 1004.70885, 0.285716, 86400, 10800, 1.30538662221103e+24, 5.02451481750085e+19, 10591741.6416624, 1.77078159248505e+21, 1.05527896355447e+27, 50000, 101325, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; } f. obsvect ---------- .. include:: ../common/obsvect.rst g. platform ----------- .. include:: ../common/platform.rst h. domain --------- Two files are required to specify the LMDz domain with the :doc:`LMDZ grid` plugin: - a grid text file containing the horizontal grid coordinates - a "vcoord" NetCDF file .. code-block:: yaml # Domain definition domain: plugin: name: LMDZ version: std filegrid: /absolute/path/to/LMDz_grid.txt dir_vcoord: /path/to/vcoord/directory file_vcoord: LMDz_vcoord.nc .. container:: toggle .. container:: header Show/Hide ``LMDz_grid.txt`` .. code-block:: text 97 -180 -176.25 -172.5 ... 172.5 176.25 180 96 90 88.1053 86.2105 ... -86.2105 -88.1053 -90 12 6 .. container:: toggle .. container:: header Show/Hide ``LMDz_voord.nc`` .. code-block:: c dimensions: temps = UNLIMITED ; // (0 currently) index = 100 ; rlonu = 97 ; rlatu = 96 ; rlonv = 97 ; rlatv = 95 ; sig = 40 ; variables: double controle(index) ; controle:_FillValue = NaN ; controle:long_name = "controle parameters" ; double rlonu(rlonu) ; rlonu:_FillValue = NaN ; rlonu:long_name = "u points longitude" ; rlonu:units = "degrees_east" ; double rlatu(rlatu) ; rlatu:long_name = "u points latitude" ; rlatu:units = "degrees_north" ; double rlonv(rlonv) ; rlonv:long_name = "v points longitude" ; rlonv:units = "degrees_east" ; double rlatv(rlatv) ; rlatv:long_name = "v points latitude" ; rlatv:units = "degrees_north" ; double ap(sig) ; ap:long_name = "A coefficient for pressure" ; ap:units = "Pa" ; double bp(sig) ; bp:long_name = "B coefficient for pressure" ; bp:units = "None" ; double cu(rlatu, rlonu) ; double cv(rlatv, rlonv) ; double aire(rlatu, rlonv) ; aire:long_name = "grid cell area" ; aire:units = "m2" ; i. chemistry ------------ Chemistry is usually defined in a separeted YAML file: .. code-block:: yaml # Chemical scheme chemistry: file_yaml: /absolute/path/to/chemistry.yaml j. datavect ----------- The :doc:`datavect` plugin is used to define the various inputs: .. container:: toggle .. container:: header Show/Hide code .. code-block:: yaml datavect: plugin: name: standard version: std components: concs: parameters: XX: ... inicond: parameters: XX: plugin: type: field name: LMDZ version: ic ... ... meteo: plugin: name: LMDZ version: mass-fluxes ... kinetic: plugin: type: field name: LMDZ version: photochem ... prescrconcs: plugin: type: field name: LMDZ version: prescrconcs parameters: YY: ... ... flux: parameters: XX: ...