Browse Source

Adding 3.3.3.2

Pierre-Yves Barriat 3 years ago
parent
commit
2dac0cb565

+ 320 - 0
3.3.3.2/runtime/classic/config-run.xml

@@ -0,0 +1,320 @@
+<?xml version="1.0"?>
+
+<Configuration xmlns:xi="http://www.w3.org/2001/XInclude">
+
+    <Translation name="RUN_OCE">
+        <Description>Run script file (oce only run)</Description>
+        <Template>ece-nemo.sh.tmpl</Template>
+        <Target>ece-nemo.sh</Target>
+        <Properties>executable</Properties>
+    </Translation>
+
+    <Translation name="RUN_ESM">
+        <Description>Run script file (coupled run: atm+esm components)</Description>
+        <Template>ece-esm.sh.tmpl</Template>
+        <Target>ece-esm.sh</Target>
+        <Properties>executable</Properties>
+    </Translation>
+
+    <Translation name="RUN_LSM">
+        <Description>Run script file (offline land surface run)</Description>
+        <Template>ece-lsm.sh.tmpl</Template>
+        <Target>ece-lsm.sh</Target>
+        <Properties>executable</Properties>
+    </Translation>
+
+    <Translation name="RT_CTRL_CHE">
+        <Description>Control file for TM5</Description>
+        <Template>ctrl/tm5-config-run.rc.tmpl</Template>
+        <Target>ctrl/tm5-config-run.rc</Target>
+        <Properties>executable</Properties>
+    </Translation>
+
+    <xi:include href="platform/zenobe-intelmpi.xml" />
+    <xi:include href="platform/bsc-nord3.xml" />
+    <xi:include href="platform/bsc-marenostrum4.xml" />
+    <xi:include href="platform/dmi-hpcdev-intel.xml" />
+    <xi:include href="platform/ecmwf-cca-cray.xml" />
+    <xi:include href="platform/ecmwf-cca-intel.xml" />
+    <xi:include href="platform/fmi-voima.xml" />
+    <xi:include href="platform/knmi-rhino.xml" />
+    <xi:include href="platform/csc-puhti-intel.xml" />
+    <xi:include href="platform/csc-puhti-intel-intelmpi.xml" />
+    <xi:include href="platform/nsc-bi.xml" />
+    <xi:include href="platform/nsc-tetralith.xml" />
+    <xi:include href="platform/pdc-beskow.xml" />
+    <xi:include href="platform/surfsara-cartesius.xml" />
+
+    <Model name="GENERAL">
+
+        <Parameter name="EXP_NAME">
+            <Description>Experiment name (4 letters)</Description>
+            <Type>STRING</Type>
+            <Value>ECE3</Value>
+        </Parameter>
+
+        <Parameter name="RUN_START_DATE">
+            <Description>Start date of the simulation. Use any reasonable syntax.</Description>
+            <Type>DATE</Type>
+            <Value>1990-01-01</Value>
+        </Parameter>
+
+        <Parameter name="RUN_END_DATE">
+            <Description>End date of the simulation. Use any reasonable syntax.</Description>
+            <Type>STRING</Type>
+            <Value>${run_start_date} + 4 years</Value>
+        </Parameter>
+
+        <Parameter name="FORCE_RUN_FROM_SCRATCH">
+            <Description>Start simulation from scratch, possibly ignoring any restart files. [true/false]</Description>
+            <Type>BOOLEAN</Type>
+            <Value>true</Value>
+        </Parameter>
+
+        <Parameter name="RST_FREQ">
+            <Description>Restart frequency, e.g., 2 months</Description>
+            <Type>STRING</Type>
+            <Value>1 year</Value>
+        </Parameter>
+
+        <Parameter name="RUN_NUM_LEGS">
+            <Description>Number of restart legs</Description>
+            <Type>INTEGER</Type>
+            <Value>2</Value>
+        </Parameter>
+
+        <Parameter name="OUTPUT_CONTROL_FILES_DIR">
+            <Description>The path to the IFS ppt and NEMO file_def file dir</Description>
+            <Type>PATH</Type>
+            <Value>ctrl</Value>
+        </Parameter>
+
+    </Model>
+
+    <Model name="OASIS">
+
+        <Parameter name="CPL_FREQ_ATM_CHE_HRS">
+            <Description>Coupling frequency between IFS and TM5 in hours</Description>
+            <Type>INTEGER</Type>
+            <Value>6</Value>
+        </Parameter>
+
+        <Parameter name="CPL_FREQ_ATM_LPJG_HRS">
+            <Description>Coupling frequency between IFS|TM5 and LPJG in hours</Description>
+            <Type>INTEGER</Type>
+            <Value>24</Value>
+        </Parameter>
+
+        <Parameter name="LUCIA">
+            <Description>Lucia output: 0 -> Deactivated, -1 -> Legacy, -2 -> Updated CERFACS tool, -3 lucia_lite BSC</Description>
+            <Type>INTEGER</Type>
+            <Value>0</Value>
+        </Parameter>
+
+    </Model>
+
+    <Model name="IFS">
+
+        <Parameter name="GRID">
+            <Description>Resolution of IFS grid</Description>
+            <Type>STRING</Type>
+            <Value>T255L91</Value>
+        </Parameter>
+
+        <Parameter name="NUMPROC">
+            <Description>Number of processors running IFS</Description>
+            <Type>INTEGER</Type>
+            <Value>320</Value>
+        </Parameter>
+
+        <Parameter name="CMIP6">
+            <Description>Use CMIP6 forcings (TRUE or FALSE)</Description>
+            <Type>BOOLEAN</Type>
+            <Value>TRUE</Value>
+        </Parameter>
+
+        <Parameter name="CMIP6_SCENARIO">
+            <Description>SSP selection for 2015 onwards</Description>
+            <Type>STRING</Type>
+            <Value>historical</Value>
+        </Parameter>
+
+        <Parameter name="CMIP6_A4xCO2">
+            <Description>Use Abrupt4xCO2 in CMIP6 DECK (TRUE or FALSE)</Description>
+            <Type>BOOLEAN</Type>
+            <Value>FALSE</Value>
+        </Parameter>
+
+        <Parameter name="CMIP6_1PCTCO2">
+            <Description>Use 1pctCO2 for radiation in CMIP6 DECK (TRUE or FALSE)</Description>
+            <Type>BOOLEAN</Type>
+            <Value>FALSE</Value>
+        </Parameter>
+
+        <Parameter name="CMIP6_1PCTCO2_BGC">
+            <Description>Use 1pctCO2 for BGC components (LPJ-GUESS, PISCES) in CMIP6 DECK (TRUE or FALSE)</Description>
+            <Type>BOOLEAN</Type>
+            <Value>FALSE</Value>
+        </Parameter>
+
+        <Parameter name="CMIP5">
+            <Description>Use CMIP5 forcings (TRUE or FALSE)</Description>
+            <Type>BOOLEAN</Type>
+            <Value>TRUE</Value>
+        </Parameter>
+
+        <Parameter name="CMIP5_RCP">
+            <Description>RCP selection (1-4 or 0 for historical run)</Description>
+            <Type>INTEGER</Type>
+            <Value>0</Value>
+        </Parameter>
+
+        <Parameter name="CMIP_FIXYEAR">
+            <Description>Fix CMIP5/CMIP6 forcings at the indicated year (or 0 to ignore for transient runs)</Description>
+            <Type>INTEGER</Type>
+            <Value>0</Value>
+        </Parameter>
+
+        <Parameter name="CMIP_FIXYEAR_CH4">
+            <Description>Fix CMIP5/CMIP6 CH4 mixing ratios at the indicated year (or 0 to ignore for transient runs)</Description>
+            <Type>INTEGER</Type>
+            <Value>0</Value>
+        </Parameter>
+
+    </Model>
+
+    <Model name="NEM">
+
+        <Parameter name="GRID">
+            <Description>Resolution of NEMO grid</Description>
+            <Type>STRING</Type>
+            <Value>ORCA1L75</Value>
+        </Parameter>
+
+        <Parameter name="NUMPROC">
+            <Description>Number of processors running NEMO</Description>
+            <Type>INTEGER</Type>
+            <Value>86</Value>
+        </Parameter>
+
+    </Model>
+
+    <Model name="XIO">
+
+        <Parameter name="NUMPROC">
+            <Description>Number of processors running XIOS</Description>
+            <Type>INTEGER</Type>
+            <Value>1</Value>
+        </Parameter>
+
+    </Model>
+
+    <Model name="TM5">
+
+        <Parameter name="NLEVS">
+            <Description>Number of levels in TM5 (4, 10, 34 or 91)</Description>
+            <Type>INTEGER</Type>
+            <Value>10</Value>
+        </Parameter>
+
+        <Parameter name="ISTART">
+            <Description>TM5 initial tracer fields option (2,5,9,31,32 or 33)</Description>
+            <Type>INTEGER</Type>
+            <Value>9</Value>
+        </Parameter>
+
+        <Parameter name="TIME_STEP_SEC">
+            <Description>TM5 time step in seconds</Description>
+            <Type>INTEGER</Type>
+            <Value>3600</Value>
+        </Parameter>
+
+        <Parameter name="NUMPROC_X">
+            <Description>Number of processors in the X direction running TM5 (max 4)</Description>
+            <Type>INTEGER</Type>
+            <Value>2</Value>
+        </Parameter>
+
+        <Parameter name="NUMPROC_Y">
+            <Description>Number of processors in the Y direction running TM5 (max 45)</Description>
+            <Type>INTEGER</Type>
+            <Value>45</Value>
+        </Parameter>
+
+        <Parameter name="EMISS_FIXYEAR">
+            <Description>Fix EMISSIONS at the indicated year (0 to ignore, -1 to disable emissions for co2 version)</Description>
+            <Type>INTEGER</Type>
+            <Value>0</Value>
+        </Parameter>
+
+    </Model>
+
+    <Model name="LPJG">
+
+        <Parameter name="TIME_STEP_SEC">
+            <Description>LPJ-GUESS time step in seconds</Description>
+            <Type>INTEGER</Type>
+            <Value>86400</Value>
+        </Parameter>
+
+        <Parameter name="NUMPROC">
+            <Description>Number of processors running LPJG (min )</Description>
+            <Type>INTEGER</Type>
+            <Value>32</Value>
+        </Parameter>
+
+        <Parameter name="LPJG_FIXNDEPAFTER">
+            <Description>Fix N-Deposition from (>=0: year, -1:off)</Description>
+            <Type>INTEGER</Type>
+            <Value>-1</Value>
+        </Parameter>
+
+        <Parameter name="LPJG_FIXLUAFTER">
+            <Description>Fix Land-Use from (>=0: year, -1:off)</Description>
+            <Type>INTEGER</Type>
+            <Value>-1</Value>
+          </Parameter>
+
+        <Parameter name="LPJG_IFS_OUTPUT_DIR">
+          <Description>IFS output directory for lpjg_forcing to find ICMGG* files</Description>
+          <Type>PATH</Type>
+          <Value>${SCRATCH}/ECEARTH-RUNS/AAAA/output/ifs</Value>
+        </Parameter>
+
+        <Parameter name="LPJG_FORCING_DIR">
+          <Description>LPJG directory to find forcing</Description>
+          <Type>PATH</Type>
+          <Value>${SCRATCH}/ECEARTH-RUNS/LPJG_FORCING/${exp_name}</Value>
+        </Parameter>
+
+    </Model>
+    
+    <Model name="OSM">
+
+        <Parameter name="NUMPROC">
+            <Description>Number of processors/threads running OSM:openMP</Description>
+            <Type>INTEGER</Type>
+            <Value>12</Value>
+        </Parameter>
+
+        <Parameter name="OSM_FORCING_TYPE">
+          <Description>OSM forcing type, either ifs or one or the ERA reanalyses (erai, era20c, gswp3, era5)</Description>
+          <Type>STRING</Type>
+          <Value>ifs</Value>
+        </Parameter>
+
+        <Parameter name="OSM_IFS_OUTPUT_DIR">
+          <Description>IFS output directory for OSM to find ICMGG* files</Description>
+          <Type>PATH</Type>
+          <Value>${SCRATCH}/ECEARTH-RUNS/AAAA/output/ifs</Value>
+        </Parameter>
+
+        <Parameter name="OSM_FORCING_DIR">
+          <Description>OSM directory to find forcing or save if generated</Description>
+          <Type>PATH</Type>
+          <Value>${SCRATCH}/ECEARTH-RUNS/OSM_FORCING/${exp_name}</Value>
+        </Parameter>
+        
+    </Model>
+
+</Configuration>

+ 114 - 0
3.3.3.2/runtime/classic/ctrl/file_def_nemo-lim3.xml

@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+    <!-- $id$ -->
+    
+ <!--
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files for lim3                                =
+=                                         put the variables you want...                                    =
+============================================================================================================
+  -->
+    
+    <file_definition type="one_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">
+  
+      <file_group id="1ts_lim" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+      <file_group id="1h_lim" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
+      <file_group id="2h_lim" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
+      <file_group id="3h_lim" output_freq="3h"  output_level="10" enabled=".TRUE."/> <!-- 3h files -->     
+      <file_group id="4h_lim" output_freq="4h"  output_level="10" enabled=".TRUE."/> <!-- 4h files -->
+      <file_group id="6h_lim" output_freq="6h"  output_level="10" enabled=".TRUE."/> <!-- 6h files -->        
+
+      <file_group id="1d_lim" output_freq="1d"  output_level="10" enabled=".TRUE.">  <!-- 5d files -->   	
+        <file id="file40" name_suffix="_icemod" description="ice icemod variables">
+          <field field_ref="uice_ipa"     name="siu"       long_name="sea_ice_x_velocity"/>
+          <field field_ref="vice_ipa"     name="siv"       long_name="sea_ice_y_velocity"/>
+          <field field_ref="iceconc"      name="siconc"    long_name="sea_ice_area_fraction"/>
+          <field field_ref="icethic"      name="sithick"   long_name="sea_ice_thickness"/>
+          <field field_ref="snothic"      name="sisnthick" long_name="surface_snow_thickness"/>
+          <field field_ref="icest"        name="sitemptop" long_name="sea_ice_surface_temperature"/>
+          <field field_ref="icevel"       name="sispeed"   long_name="sea_ice_speed"/>
+          <field field_ref="utau_ice"     name="sistrxdtop"     long_name="surface_downward_x_stress"/>
+          <field field_ref="vtau_ice"     name="sistrydtop"     long_name="surface_downward_y_stress"/>
+          <field field_ref="idive"        name="sidivvel"       long_name="divergence_of_sea_ice_velocity"/>
+        </file>
+      </file_group>
+
+      <file_group id="5d_lim" output_freq="5d"  output_level="10" enabled=".TRUE."/>  <!-- 5d files -->   	
+
+      <file_group id="1m_lim" output_freq="1mo" output_level="10" enabled=".TRUE."> <!-- real monthly files -->
+
+       <file id="file41" name_suffix="_icemod" description="ice variables" >
+    
+          <field field_ref="uice_ipa"     name="siu"            long_name="sea_ice_x_velocity"/>
+          <field field_ref="vice_ipa"     name="siv"            long_name="sea_ice_y_velocity"/>
+          <field field_ref="iceconc"      name="siconc"         long_name="sea_ice_area_fraction"/>
+          <field field_ref="icethic"      name="sithick"        long_name="sea_ice_thickness"/>
+          <field field_ref="icevolu"      name="sivol"          long_name="sea_ice_volume"/>
+          <field field_ref="snothic"      name="sisnthick"      long_name="surface_snow_thickness"/>
+          <field field_ref="icest"        name="sitemptop"      long_name="sea_ice_surface_temperature"/>
+          <field field_ref="icevel"       name="sispeed"        long_name="sea_ice_speed"/>
+          <field field_ref="icealb"       name="alb_ice"        long_name="sea_ice_albedo"/>
+          <field field_ref="icestr"       name="sicompstren"    long_name="compressive_strength_of_sea_ice"/>
+          <field field_ref="miceage"      name="siage"          long_name="age_of_sea_ice"/>
+          <field field_ref="qsr_ice"      name="siflswdtop"     long_name="surface_downwelling_shortwave_flux_in_air"/>
+          <field field_ref="utau_ice"     name="sistrxdtop"     long_name="surface_downward_x_stress"/>
+          <field field_ref="vtau_ice"     name="sistrydtop"     long_name="surface_downward_y_stress"/>
+          <field field_ref="dmsspr"       name="prsn"           long_name="snowfall_flux"/>
+          <field field_ref="dmssub"       name="sidmassevapsubl" long_name="water_evaporation_flux"/>
+          <field field_ref="idive"        name="sidivvel"       long_name="divergence_of_sea_ice_velocity"/>
+          <field field_ref="iceconc_cat"  name="siitdconc"      long_name="sea_ice_area_fraction_over_categories"/>
+          <field field_ref="icethic_cat"  name="siitdthick"     long_name="sea_ice_thickness_over_categories"/>
+          <field field_ref="snowthic_cat" name="siitdsnthick"   long_name="snow_thickness_over_categories"/>
+          <field field_ref="micesalt"     name="sisali"         long_name="sea_ice_salinity"/>
+
+          <field field_ref="snowvol"      name="snvolu" />
+          <field field_ref="vfxice"       name="vfxice" />
+          <field field_ref="vfxsnw"       name="vfxsnw" />
+          <field field_ref="vfxsub"       name="vfxsub" />
+          <field field_ref="vfxsub_err"   name="vfxsub_err" />
+          <field field_ref="vfxspr"       name="vfxspr" />
+
+          <field field_ref="icetrp"       name="sivtrp" />
+          <field field_ref="snwtrp"       name="snvtrp" />
+          <field field_ref="saltrp"       name="saltrp" />
+          <field field_ref="deitrp"       name="deitrp" />
+          <field field_ref="destrp"       name="destrp" />
+
+          <field field_ref="sfx"          name="sfx" />
+
+          <field field_ref="hfxout"       name="hfxout"    />
+          <field field_ref="hfxin"        name="hfxin"    />
+
+          <!-- diags -->
+          <field field_ref="isst"         name="sst" />
+          <field field_ref="isss"         name="sss" />
+          <field field_ref="micet"        name="sitemp" />
+          <field field_ref="icehc"        name="siheco" />
+          <field field_ref="isnowhc"      name="snheco" />
+
+          <field field_ref="ishear"       name="sishea" />
+
+          <field field_ref="ibrinv"       name="sibrin" />
+          <field field_ref="icecolf"      name="sicolf" />
+
+          <field field_ref="iceage_cat"   name="siagecat" />
+          <field field_ref="salinity_cat" name="salincat" />
+          <field field_ref="brinevol_cat" name="sibricat" />
+          <field field_ref="icetemp_cat"  name="sitemcat" />
+          <field field_ref="snwtemp_cat"  name="sntemcat" />
+
+        </file>
+
+      </file_group>
+
+      <file_group id="2m_lim" output_freq="2mo" output_level="10" enabled=".TRUE."/> <!-- real 2m files -->
+      <file_group id="3m_lim" output_freq="3mo" output_level="10" enabled=".TRUE."/> <!-- real 3m files -->
+      <file_group id="4m_lim" output_freq="4mo" output_level="10" enabled=".TRUE."/> <!-- real 4m files -->
+      <file_group id="6m_lim" output_freq="6mo" output_level="10" enabled=".TRUE."/> <!-- real 6m files -->
+      <file_group id="1y_lim"  output_freq="1y" output_level="10" enabled=".TRUE."/> <!-- real yearly files -->
+      <file_group id="2y_lim"  output_freq="2y" output_level="10" enabled=".TRUE."/> <!-- real 2y files -->
+      <file_group id="5y_lim"  output_freq="5y" output_level="10" enabled=".TRUE."/> <!-- real 5y files -->
+      <file_group id="10y_lim" output_freq="10y" output_level="10" enabled=".TRUE."/> <!-- real 10y files -->
+
+
+   </file_definition>

+ 450 - 0
3.3.3.2/runtime/classic/ctrl/file_def_nemo-opa.xml

@@ -0,0 +1,450 @@
+<?xml version="1.0"?>
+
+<!--
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own filesfor ocean dynamics context                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+   
+    <file_definition type="one_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">
+
+      <file_group id="1ts_opa" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
+      <file_group id="1h_opa" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
+
+      <file_group id="2h_opa" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
+
+      <file_group id="3h_opa" output_freq="3h"  output_level="10" enabled=".TRUE."> <!-- 3h files -->    
+        <file id="file1" name_suffix="_grid_T" description="ocean T grid variables">
+          <field field_ref="sst"          name="tos"      long_name="sea_surface_temperature"                       />
+        </file>
+      </file_group> 
+
+      <file_group id="4h_opa" output_freq="4h"  output_level="10" enabled=".TRUE."/> <!-- 4h files -->
+
+      <file_group id="6h_opa" output_freq="6h"  output_level="10" enabled=".TRUE."/> <!-- 6h files -->     
+
+      
+      <file_group id="1d_opa" output_freq="1d"  output_level="10" enabled=".TRUE.">  <!-- 1d files -->   
+	
+        <file id="file2" name_suffix="_grid_T" description="ocean T grid variables" >
+	  <field field_ref="sst"          name="tos"      long_name="sea_surface_temperature"                       />
+          <field field_ref="sst2"         name="tossq"    long_name="square_of_sea_surface_temperature"             />
+	  <field field_ref="sss"          name="sos"      long_name="sea_surface_salinity"                          />
+	  <field field_ref="ssh"          name="zos"      long_name="sea_surface_height_above_geoid"                />
+          <field field_ref="mldr10_1"     name="mlotst"   long_name="ocean_mixed_layer_thickness_defined_by_sigma_t" />
+	</file>
+
+        <file id="file3" name_suffix="_grid_U" description="ocean U grid variables">
+          <field field_ref="utau"        name="tauuo"      long_name="surface_downward_x_stress"/> <!-- available with key_diaar5 -->
+         </file>
+
+        <file id="file4" name_suffix="_grid_V" description="ocean V grid variables">
+          <field field_ref="vtau"        name="tauvo"      long_name="surface_downward_y_stress"/> <!-- available with key_diaar5 -->
+        </file>       
+       
+        <file id="file5" name_suffix="_scalar" description="scalar variables" >
+	  <!-- Volume -->
+          <!-- global contents -->
+	  <field field_ref="voltot"       grid_ref="grid_1point"   name="scvoltot"  />
+	  <field field_ref="sshtot"       grid_ref="grid_1point"   name="scsshtot"  />
+	  <field field_ref="sshsteric"    grid_ref="grid_1point"   name="scsshste"  />
+          <!--field field_ref="sshthster"    grid_ref="grid_1point"   name="scsshtst"  /-->
+	  <field field_ref="masstot"      grid_ref="grid_1point"   name="scmastot"  />
+	  <field field_ref="temptot"      grid_ref="grid_1point"   name="sctemtot"  />
+	  <field field_ref="saltot"       grid_ref="grid_1point"   name="scsaltot"  />
+	  
+	  <!-- global drifts (conservation checks) -->
+	  <field field_ref="bgtemper"     grid_ref="grid_1point"   name="bgtemper"    />
+	  <field field_ref="bgsaline"     grid_ref="grid_1point"   name="bgsaline"    />
+	  <field field_ref="bgheatco"     grid_ref="grid_1point"   name="bgheatco"    />
+	  <field field_ref="bgheatfx"     grid_ref="grid_1point"   name="bgheatfx"    />
+	  <field field_ref="bgsaltco"     grid_ref="grid_1point"   name="bgsaltco"    />
+	  <field field_ref="bgvolssh"     grid_ref="grid_1point"   name="bgvolssh"    />
+	  <field field_ref="bgvole3t"     grid_ref="grid_1point"   name="bgvole3t"    />
+
+	  <!-- global surface forcings  -->
+	  <field field_ref="bgfrcvol"     grid_ref="grid_1point"   name="bgfrcvol"    />
+	  <field field_ref="bgfrctem"     grid_ref="grid_1point"   name="bgfrctem"    />
+	  <field field_ref="bgfrchfx"     grid_ref="grid_1point"   name="bgfrchfx"    />
+	  <field field_ref="bgfrcsal"     grid_ref="grid_1point"   name="bgfrcsal"    />
+
+        </file>
+
+        <file id="file6" name_suffix="_SBC_scalar" description="scalar variables">
+	  <!-- Surface -->
+	  <!-- global contents -->
+          <field field_ref="ibgvol_tot"     grid_ref="grid_1point"  name="ibgvol_tot"   />
+          <field field_ref="sbgvol_tot"     grid_ref="grid_1point"  name="sbgvol_tot"   />
+          <field field_ref="ibgarea_tot"    grid_ref="grid_1point"  name="ibgarea_tot"  />
+          <field field_ref="ibgsalt_tot"    grid_ref="grid_1point"  name="ibgsalt_tot"  />
+          <field field_ref="ibgheat_tot"    grid_ref="grid_1point"  name="ibgheat_tot"  />
+          <field field_ref="sbgheat_tot"    grid_ref="grid_1point"  name="sbgheat_tot"  />
+	  
+	  <!-- global drifts (conservation checks) -->
+          <field field_ref="ibgvolume"      grid_ref="grid_1point"  name="ibgvolume"    />
+          <field field_ref="ibgsaltco"      grid_ref="grid_1point"  name="ibgsaltco"    />
+          <field field_ref="ibgheatco"      grid_ref="grid_1point"  name="ibgheatco"    />
+          <field field_ref="ibgheatfx"      grid_ref="grid_1point"  name="ibgheatfx"    />
+	  
+	  <!-- global forcings  -->
+          <field field_ref="ibgfrcvoltop"   grid_ref="grid_1point"  name="ibgfrcvoltop" />
+          <field field_ref="ibgfrcvolbot"   grid_ref="grid_1point"  name="ibgfrcvolbot" />
+          <field field_ref="ibgfrctemtop"   grid_ref="grid_1point"  name="ibgfrctemtop" />
+          <field field_ref="ibgfrctembot"   grid_ref="grid_1point"  name="ibgfrctembot" />
+          <field field_ref="ibgfrcsal"      grid_ref="grid_1point"  name="ibgfrcsal"    />
+          <field field_ref="ibgfrchfxtop"   grid_ref="grid_1point"  name="ibgfrchfxtop" />
+          <field field_ref="ibgfrchfxbot"   grid_ref="grid_1point"  name="ibgfrchfxbot" />
+	  
+        </file>
+	
+      </file_group> 
+
+      <file_group id="5d_opa" output_freq="5d"  output_level="10" enabled=".FALSE.">  <!-- 5d files -->   
+	
+	<file id="file7" name_suffix="_grid_T" description="ocean T grid variables" >
+          <field field_ref="e3t"  />
+          <field field_ref="toce"         name="thetao"   long_name="sea_water_potential_temperature"      operation="average" freq_op="5d" > @toce_e3t / @e3t </field>
+          <field field_ref="soce"         name="so"       long_name="sea_water_salinity"                   operation="average" freq_op="5d" > @soce_e3t / @e3t </field>
+          <field field_ref="hdiv"         name="hdivtr"   long_name="horizontal divergence transport"      operation="average" freq_op="5d" > @hdiv * @e3t </field>
+          <field field_ref="mldr10_1"     name="mldr10_1"/>
+          <field field_ref="ssh"          name="zos"      long_name="sea_surface_height_above_geoid"                />
+          <field field_ref="qsr"          name="rsntds"      long_name="surface_net_downward_shortwave_flux" />
+          <field field_ref="wspd"         name="windsp"  />
+          <field field_ref="empmr"        name="wfo"      long_name="water_flux_into_sea_water"                     />
+          <field field_ref="empbmr"       name="wfob"     long_name="water_flux_into_sea_water at prev time-step"    />
+         <field field_ref="runoffs"      name="friver"   long_name="water_flux_into_sea_water_from_rivers"                   level="1" />
+          <field field_ref="fmmflx"       name="fmmflx"  />
+          <field field_ref="iceconc"      name="siconc"  />
+	</file>
+
+        <file id="file8" name_suffix="_SBC" description="surface fluxes variables" > <!-- time step automaticaly defined based on nn_fsbc -->
+          <field field_ref="qsr_oce"       name="qsr_oce"  long_name="downward shortwave flux at ocean surface"           />
+          <field field_ref="qns_oce"       name="qns_oce"  long_name="downward non solar flux at ocean surface"           />
+          <field field_ref="qsr_ice"       name="qsr_ice"  long_name="downward shortwave flux at ice surface"           />
+          <field field_ref="qns_ice"       name="qns_ice"  long_name="downward non solar flux at ice surface"           />
+          <field field_ref="qtr_ice"       name="qtr_ice"  long_name="shortwave flux transmitted thru the ice"           />
+          <field field_ref="taum"          name="taum" />
+          <field field_ref="wspd"          name="windsp"  />
+          <field field_ref="precip"        name="precip" />
+          <!-- For heat conservation checking -->
+          <field field_ref="qt_oce"        name="qt_oce"   long_name="downward total flux at ocean surface"           />
+          <field field_ref="qemp_oce"      name="qemp_oce" long_name="Downward Heat Flux from E-P over open ocean"           />
+          <field field_ref="qt_ice"        name="qt_ice"   long_name="downward total flux at ice surface"           />
+          <field field_ref="qemp_ice"      name="qemp_ice" long_name="Downward Heat Flux from E-P over ice"           />
+          <field field_ref="hflx_rain_cea" name="hflx_rain_cea"      />
+          <field field_ref="hflx_evap_cea" name="hflx_evap_cea"      />
+          <field field_ref="hflx_snow_cea" name="hflx_snow_cea"      />
+          <field field_ref="hflx_cal_cea"  name="hflx_cal_cea"      />
+          <!-- For freshwater conservation checking -->
+          <field field_ref="empmr"         name="wfo"      long_name="water_flux_into_sea_water"                     />
+          <field field_ref="emp_oce"       name="emp_oce"                      />
+          <field field_ref="emp_ice"       name="emp_ice"                      />
+          <field field_ref="runoffs"       name="friver"   long_name="water_flux_into_sea_water_from_rivers"                   level="1" />
+          <field field_ref="calving_cea"   name="calving" />
+      <field field_ref="iceberg_cea"   name="iceberg" />
+      <field field_ref="iceshelf_cea"  name="iceshelf" />
+          <field field_ref="vfxice"        name="vfxice" />
+          <field field_ref="vfxsnw"        name="vfxsnw" />
+          <field field_ref="vfxsub"        name="vfxsub" />
+          <field field_ref="vfxspr"        name="vfxspr" />
+          <field field_ref="rain"          name="rain"      />
+          <field field_ref="snow_ao_cea"   name="snow_ao_cea"      />
+          <field field_ref="snow_ai_cea"   name="snow_ai_cea"      />
+          <field field_ref="evap_ao_cea"   name="evap_ao_cea"      />
+          <field field_ref="subl_ai_cea"   name="subl_ai_cea"      />
+          <field field_ref="fmmflx"        name="fmmflx"  />
+          <field field_ref="fwfisf"        name="fwfisf"  />
+          <field field_ref="hflx_snow_ai_cea" name="hflx_snow_ai"  />
+          <field field_ref="hflx_snow_ao_cea" name="hflx_snow_ao"  />
+          <field field_ref="hflx_ice_cea"     name="hflx_ice"      />
+          <field field_ref="hflx_rnf_cea"     name="hflx_rnf"      />
+          <!-- For salt conservation checking -->
+          <field field_ref="saltflx"      name="sosflxdo"  />
+          <!-- ice and snow -->
+          <field field_ref="snowpre"      />
+          <field field_ref="utau_ice"         name="utau_ice" />
+          <field field_ref="vtau_ice"         name="vtau_ice" />
+        </file>
+
+	<file id="file9" name_suffix="_grid_U" description="ocean U grid variables" >
+	  <field field_ref="e3u"  />
+          <field field_ref="uocetr_eff"   name="uocetr_eff"  />
+	  <field field_ref="ahu_bbl"       />
+	</file>
+	
+	<file id="file10" name_suffix="_grid_V" description="ocean V grid variables" >
+	  <field field_ref="e3v"  />
+          <field field_ref="vocetr_eff"   name="vocetr_eff"  />
+	  <field field_ref="ahv_bbl"       />
+	</file>
+	
+	<file id="file11" name_suffix="_grid_W" description="ocean W grid variables" >
+          <field field_ref="e3w"  />
+          <field field_ref="woce"         name="wo"     />
+          <field field_ref="wocetr_eff"   name="wocetr_eff"  />
+          <field field_ref="avs"          name="difvso"  long_name="ocean_vertical_salt_diffusivity" />
+          <field field_ref="logavs"       name="difvsolog"  long_name="ocean_vertical_salt_diffusivity" operation="average" freq_op="5d" > exp( @logavs ) </field>
+          <field field_ref="aht2d"        name="ahtt"   />
+          <field field_ref="aht2d_eiv"    name="aeiv"   />
+	</file>
+
+
+        <file id="file12" name_suffix="_trdtra" description="ocean trends variables" >
+          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_eivad_e3t"  name="ttrdtr_eivad" long_name="Tendency_of_heat_content_from_parameterized_eddy_advection"     unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" > this * $rau0 </field>
+          <field field_ref="strd_eivad_e3t"  name="strdtr_eivad" long_name="Tendency_of_salt_content_from_parameterized_eddy_advection"     unit="kg m-2 s-1" > this * $rau0 </field>
+          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" > this * $rau0 </field>
+          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" > this * $rau0  </field>
+          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" > this * $rau0  </field>
+        </file>
+
+
+      </file_group> 
+
+
+      <file_group id="1m_opa" output_freq="1mo" output_level="10" enabled=".TRUE."> <!-- real monthly files -->
+
+        <file id="file13" name_suffix="_grid_T" >
+	  <field field_ref="e3t" long_name="T-cell thickness" />
+          <field field_ref="botpres"      name="pbo"      long_name="Pressure_at_sea_floor"                                          />
+          <!-- pso : sea_water_pressure_at_sea_water_surface = 0 -->
+          <field field_ref="ssh"          name="zos"      long_name="sea_surface_height_above_geoid"                                 />
+          <field field_ref="ssh2"         name="zossq"    long_name="square_of_sea_surface_height_above_geoid"             level="2" />
+
+          <field field_ref="toce"         name="thetao"   long_name="sea_water_potential_temperature"   operation="average" freq_op="1mo" > @toce_e3t / @e3t </field>      
+          <field field_ref="sst"          name="tos"      long_name="sea_surface_temperature"                              level="1" />
+          <field field_ref="sst2"         name="tossq"    long_name="square_of_sea_surface_temperature"                    level="2" />
+          <field field_ref="soce"         name="so"       long_name="sea_water_salinity"                operation="average" freq_op="1mo" > @soce_e3t / @e3t </field>       
+          <field field_ref="sss"          name="sos"      long_name="sea_surface_salinity"                                 level="1" />
+          
+          <field field_ref="rhop"         name="rhopoto"  long_name="sea_water_potential_density"                          level="2" />
+          <!-- no agessc : sea_water_age_since_surface_contact -->
+          <!-- no cfc11  : moles_per_unit_mass_of_cfc11_in_sea_water -->
+          <!-- msftbarot : ocean_barotropic_mass_streamfunction : offline -->
+          <!-- mlotst    :           ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
+          <!-- mlotstsq  : square_of_ocean_mixed_layer_thickness_defined_by_sigma_t : must be done offline -->
+          <field field_ref="mldr10_1"     name="mlotst"   long_name="ocean_mixed_layer_thickness_defined_by_sigma_t" operation="average" freq_op="1mo" > @mldr10_1 </field>
+
+        </file>
+
+	<file id="file14" name_suffix="_grid_U" description="ocean U grid variables" >
+	  <field field_ref="uoce"         name="uo"      long_name="sea_water_x_velocity" operation="average" freq_op="1mo" > @uoce_e3u / @e3u </field>
+          <field field_ref="uoce2"        name="u2o"     long_name="square_of_sea_water_x_velocity"/>
+          <field field_ref="utau"         name="tauuo"   long_name="surface_downward_x_stress" />
+          <field field_ref="u_masstr"     name="umo"     long_name="ocean_mass_x_transport"/>
+	</file>
+	
+	<file id="file15" name_suffix="_grid_V" description="ocean V grid variables" >
+          <field field_ref="voce"         name="vo"      long_name="sea_water_y_velocity" operation="average" freq_op="1mo" > @voce_e3v / @e3v </field>
+          <field field_ref="voce2"        name="v2o"     long_name="square_of_sea_water_y_velocity"/>
+          <field field_ref="vtau"         name="tauvo"   long_name="surface_downward_y_stress" />
+          <field field_ref="v_masstr"     name="vmo" long_name="ocean_mass_y_transport"/>
+	</file>
+	
+	<file id="file16" name_suffix="_grid_W" description="ocean W grid variables" >
+          <field field_ref="woce"         name="wo"     />
+          <field field_ref="avt"          name="difvho"  long_name="ocean_vertical_heat_diffusivity" />
+          <field field_ref="w_masstr"     name="wmo"     long_name="vertical mass transport"/>
+	</file>
+	
+	<file id="file17" name_suffix="_SBC" description="surface fluxes variables" > <!-- time step automaticaly defined based on nn_fsbc -->
+          <field field_ref="empmr"        name="wfo"      long_name="water_flux_into_sea_water"                     />
+          <!-- TODO check which variable to use for rsntds, qsr or qsr_oce? -->
+          <field field_ref="qsr"          name="qsr"      long_name="surface_net_downward_shortwave_flux"                                         level="1" />
+          <field field_ref="qsr_oce"      name="qsr_oce"  long_name="downward shortwave flux at ocean surface"           />
+<!--      <field field_ref="qsr_oce"      name="rsntds"   long_name="net_downward_shortwave_flux_at_sea_water_surface"/> -->
+          <field field_ref="qsr3d"        name="qsr3d"    long_name="downwelling_shortwave_flux_in_sea_water"                                     level="1" />
+<!--      <field field_ref="qsr3d"        name="rsdo"     long_name="downwelling_shortwave_flux_in_sea_water"                                     level="1" /> -->
+          <field field_ref="qns_oce"      name="qns_oce"  long_name="downward non solar flux at ocean surface"           />
+          <field field_ref="qt_oce"       name="qt_oce"   long_name="downward total flux at ocean surface"           />
+<!--      <field field_ref="qt_oce"       name="hfds"     long_name="surface_downward_heat_flux_in_sea_water"/> -->
+          <field field_ref="qsr_ice"      name="qsr_ice"  long_name="downward shortwave flux at ice surface"           />
+          <field field_ref="qns_ice"      name="qns_ice"  long_name="downward non solar flux at ice surface"           />
+          <field field_ref="qtr_ice"      name="qtr_ice"  long_name="shortwave flux transmitted thru the ice"           />
+          <field field_ref="qt_ice"       name="qt_ice"   long_name="downward total flux at ice surface"           />
+          <field field_ref="qemp_ice"       name="qemp_ice"   long_name="Downward Heat Flux from E-P over ice"           />
+          <field field_ref="qemp_oce"       name="qemp_oce"   long_name="Downward Heat Flux from E-P over open ocean"     />
+          <field field_ref="hflx_rnf_cea"       name="hflx_rnf_cea"   long_name="heat flux due to runoff"     />
+          <field field_ref="hflx_rain_cea"       name="hflx_rain_cea"   long_name="heat flux due to rainfall"     />
+          <field field_ref="hflx_snow_cea"       name="hflx_snow_cea"   long_name="heat flux due to snow falling"     />
+          <field field_ref="hflx_cal_cea"       name="hflx_cal_cea"   long_name="heat flux due to calving"     />
+          <field field_ref="saltflx"      name="sfx"  />
+          <field field_ref="fmmflx"       name="fmmflx"  />
+          <field field_ref="taum"         name="taum" />
+          <field field_ref="wspd"         name="windsp"  />
+          <field field_ref="precip"       name="precip" />
+          <field field_ref="rain"         name="rain" />
+          <!-- TODO check if sipr should use NEMO var rain or precip, they are not identical -->
+<!--      <field field_ref="rain"         name="sipr"    long_name="rainfall_flux"/> -->
+          <field field_ref="runoffs"      name="runoffs" />
+<!--      <field field_ref="runoffs"      name="friver"   long_name="water_flux_into_sea_water_from_rivers"                   level="1" /> -->
+          <field field_ref="calving_cea"  name="calving" />
+<!--      <field field_ref="calving_cea"  name="ficeberg2d" long_name="water_flux_into_sea_water_from_icebergs"               level="1" /> -->
+          <field field_ref="evap_ao_cea"  name="evap_ao_cea" />
+          <field field_ref="subl_ai_cea"  name="subl_ai_cea" />
+          <field field_ref="snowpre"      />
+	</file>
+
+	<file id="file18" name_suffix="_scalar" description="scalar variables"  >
+          <field field_ref="masstot"    name="masso"     long_name="sea_water_mass"/>
+          <field field_ref="temptot"    name="thetaoga"  long_name="sea_water_potential_temperature"/>
+          <field field_ref="saltot"     name="soga"      long_name="sea_water_salinity"/>
+          <field field_ref="voltot"     name="volo"      long_name="sea_water_volume"/>
+        </file>
+
+	<file id="file19" name_suffix="_diaptr" description="diaptr variables" >
+          <field field_ref="zomsfglo"          name="zomsfglo"  grid_ref="grid_ptr_W_3D" />
+          <field field_ref="zomsfatl"          name="zomsfatl"  grid_ref="grid_ptr_W_3D" />
+          <field field_ref="zomsfpac"          name="zomsfpac"  grid_ref="grid_ptr_W_3D" />
+          <field field_ref="zomsfind"          name="zomsfind"  grid_ref="grid_ptr_W_3D" />
+          <field field_ref="zomsfipc"          name="zomsfipc"  grid_ref="grid_ptr_W_3D" />
+        </file>
+
+      </file_group>
+
+      <file_group id="2m_opa" output_freq="2mo" output_level="10" enabled=".TRUE."/> <!-- real 2m files -->
+      <file_group id="3m_opa" output_freq="3mo" output_level="10" enabled=".TRUE."/> <!-- real 3m files -->
+      <file_group id="4m_opa" output_freq="4mo" output_level="10" enabled=".TRUE."/> <!-- real 4m files -->
+      <file_group id="6m_opa" output_freq="6mo" output_level="10" enabled=".TRUE."/> <!-- real 6m files -->
+
+ 
+      <file_group id="1y_opa"  output_freq="1y" output_level="10" enabled=".FALSE."> <!-- real yearly files -->
+
+
+	<file id="file20" name_suffix="_grid_T" description="ocean T grid variables" >
+	  <field field_ref="e3t"  />
+	  <field field_ref="sst"          name="tos"      long_name="sea_surface_temperature"                       />
+	  <field field_ref="sss"          name="sos"      long_name="sea_surface_salinity"                          />
+	  <field field_ref="ssh"          name="zos"      long_name="sea_surface_height_above_geoid"                />
+	  <field field_ref="toce"         name="thetao"   long_name="sea_water_potential_temperature"      operation="average" freq_op="1y" > @toce_e3t / @e3t </field>        
+	  <field field_ref="soce"         name="so"       long_name="sea_water_salinity"                   operation="average" freq_op="1y" > @soce_e3t / @e3t </field>         
+	  <field field_ref="sst2"         name="tossq"    long_name="square_of_sea_surface_temperature"             />
+	  <field field_ref="ssh2"         name="zossq"    long_name="square_of_sea_surface_height_above_geoid"      />
+	  <field field_ref="mldr10_1"     />
+	  <field field_ref="mldkz5"       name="omlmax"   long_name="ocean_mixed_layer_thickness_defined_by_mixing_scheme" level="2" operation="maximum" />
+	  <field field_ref="erp"          name="wfcorr"   long_name="water_flux_correction"                                   level="1" /> <!-- usually = 0 -->
+	  <field field_ref="qns"          name="nshfls"      long_name="surface_net_downward_non_solar_flux"                                         level="1" />
+	  <field field_ref="qsr"          name="rsntds"      long_name="surface_net_downward_shortwave_flux"                                         level="1" />
+	  <field field_ref="qsr3d"        name="rsds"        long_name="downwelling_shortwave_flux_in_sea_water"                                     level="1" />
+	  <field field_ref="qt"           name="tohfls"   long_name="surface_net_downward_total_heat_flux"          />
+	  <field field_ref="taum"         name="taum" />
+	  <field field_ref="wspd"         name="sowindsp"  />
+	  <field field_ref="precip"       name="soprecip" />
+	  <!-- available with ln_blk_clio or ln_blk_core -->
+	  <field field_ref="qns_oce"      name="sonshdoo"  />
+	  <field field_ref="qlw_oce"      name="solwhdoo"  />
+	  <field field_ref="qsb_oce"      name="sosehdoo"  />
+	  <field field_ref="qla_oce"      name="solahdoo"  />
+	  <field field_ref="taum_oce"     name="sowndsto"  />
+	  <!-- ice and snow -->
+	  <field field_ref="snowpre"      name="isnowpre"/>
+	  <field field_ref="utau_ice"     name="iicestru" />
+	  <field field_ref="vtau_ice"     name="iicestrv" />
+	  <!-- For heat conservation checking -->
+	  <field field_ref="qt_oce"        name="qt_oce"   long_name="downward total flux at ocean surface"           />
+	  <field field_ref="qemp_oce"      name="qemp_oce" long_name="Downward Heat Flux from E-P over open ocean"           />
+	  <field field_ref="qt_ice"        name="qt_ice"   long_name="downward total flux at ice surface"           />
+	  <field field_ref="qemp_ice"      name="qemp_ice" long_name="Downward Heat Flux from E-P over ice"           />
+	  <field field_ref="hflx_rain_cea" name="hflx_rain_cea"      />
+	  <field field_ref="hflx_evap_cea" name="hflx_evap_cea"      />
+	  <field field_ref="hflx_snow_cea" name="hflx_snow_cea"      />
+	  <field field_ref="hflx_cal_cea"  name="hflx_cal_cea"      />
+	  <!-- For freshwater conservation checking -->
+	  <field field_ref="empmr"         name="wfo"      long_name="water_flux_into_sea_water"                     />
+	  <field field_ref="emp_oce"       name="emp_oce"                      />
+	  <field field_ref="emp_ice"       name="emp_ice"                      />
+          <field field_ref="runoffs"       name="friver"   long_name="water_flux_into_sea_water_from_rivers"                   level="1" />
+	  <field field_ref="calving_cea"   name="calving" />
+      <field field_ref="iceberg_cea"   name="iceberg" />
+      <field field_ref="iceshelf_cea"  name="iceshelf" />
+	  <field field_ref="vfxice"        name="vfxice" />
+	  <field field_ref="vfxsnw"        name="vfxsnw" />
+	  <field field_ref="vfxsub"        name="vfxsub" />
+	  <field field_ref="vfxspr"        name="vfxspr" />
+	  <field field_ref="rain"          name="rain"      />
+	  <field field_ref="snow_ao_cea"   name="snow_ao_cea"      />
+	  <field field_ref="snow_ai_cea"   name="snow_ai_cea"      />
+	  <field field_ref="evap_ao_cea"   name="evap_ao_cea"      />
+	  <field field_ref="subl_ai_cea"   name="subl_ai_cea"      />
+	  <!-- For salt conservation checking -->
+          <field field_ref="saltflx"      name="sosflxdo"  />
+         <field field_ref="dispkevfo"  name="dispkevfo" />
+	</file>
+	
+	<file id="file21" name_suffix="_grid_U" description="ocean U grid variables" >
+	  <field field_ref="e3u"  />
+	  <field field_ref="ssu"          name="uos"     long_name="sea_surface_x_velocity"    />
+	  <field field_ref="uoce"         name="uo"      long_name="sea_water_x_velocity"      operation="average" freq_op="1y" > @uoce_e3u / @e3u </field> 
+	  <field field_ref="utau"         name="tauuo"   long_name="surface_downward_x_stress" />
+	  <field field_ref="uocetr_eff"   name="uocetr_eff"  />
+      <field field_ref="uadv_heattr"   name="uadv_heattr" />
+      <field field_ref="udiff_heattr"  name="udiff_heattr" />
+      <field field_ref="uadv_heattr"   name="hfx" > this + udiff_heattr </field>
+	</file>
+	
+	<file id="file22" name_suffix="_grid_V" description="ocean V grid variables" >
+	  <field field_ref="e3v"  />
+	  <field field_ref="ssv"          name="vos"     long_name="sea_surface_y_velocity"    />
+	  <field field_ref="voce"         name="vo"      long_name="sea_water_y_velocity"     operation="average" freq_op="1y" > @voce_e3v / @e3v </field>
+	  <field field_ref="vtau"         name="tauvo"   long_name="surface_downward_y_stress" />
+	  <field field_ref="vocetr_eff"   name="vocetr_eff"  />
+      <field field_ref="vadv_heattr"   name="vadv_heattr" />
+      <field field_ref="vdiff_heattr"  name="vdiff_heattr" />
+      <field field_ref="vadv_heattr"   name="hfy" > this + vdiff_heattr </field>
+	</file>
+	
+	<file id="file23" name_suffix="_grid_W" description="ocean W grid variables" >
+	  <field field_ref="e3w"  />
+	  <field field_ref="woce"         name="wo"      long_name="ocean vertical velocity"         />
+	  <field field_ref="avt"          name="difvho"  long_name="ocean_vertical_heat_diffusivity" />
+	  <field field_ref="wocetr_eff"   name="wocetr_eff"  />
+	  <field field_ref="avt_evd"      name="avt_evd"    />
+	  <field field_ref="av_wave"      name="av_wave"    />
+	  <field field_ref="bn2"          name="bn2"        />
+	  <field field_ref="bflx_tmx"     name="bflx_tmx"   />
+	  <field field_ref="pcmap_tmx"    name="pcmap_tmx"  />
+	  <field field_ref="emix_tmx"     name="emix_tmx"   />
+	  <field field_ref="av_ratio"     name="av_ratio"   />
+	</file>
+	
+	<file id="file24" name_suffix="_diaptr" description="diaptr variables" >
+      <field field_ref="zomsf_3bsn"     name="msftyyz" > this * 1e6 * $rau0   </field>
+      <field field_ref="sophtove_3bsn"  name="htovgyre" > sopht_vt_3bsn * 1e15 - this * 1e15  </field>
+      <field field_ref="sophtove_3bsn"  name="htovovrt" > this * 1e15  </field>
+      <field field_ref="sopht_vt_3bsn"  name="hfbasin" > this * 1e15  </field>
+      <field field_ref="sophteiv_3bsn"  name="hfbasinpmadv" > this * 1e15  </field>
+	</file>   
+
+
+        <file id="file25" name_suffix="_trdtra" description="ocean trends variables" >
+          <field field_ref="ttrd_zdfp_e3t"   name="ttrdtr_zdfp"  long_name="Tendency_of_heat_content_from_parameterized_dianeutral_mixing"  unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_eivad_e3t"  name="ttrdtr_eivad" long_name="Tendency_of_heat_content_from_parameterized_eddy_advection"     unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_iso_e3t"    name="ttrdtr_iso"   long_name="Tendency_of_heat_content_from_parameterized_eddy_diffusion"     unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_totad_e3t"  name="ttrdtr_totad" long_name="Tendency_of_heat_content_from_residual_mean_advection"          unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="ttrd_tot_e3t"    name="ttrdtr_tot"   long_name="Tendency_of_heat_content_from_all_processes"                    unit="W m-2"      > this * $cpocean * $rau0  </field>
+          <field field_ref="strd_zdfp_e3t"   name="strdtr_zdfp"  long_name="Tendency_of_salt_content_from_parameterized_dianeutral_mixing"  unit="kg m-2 s-1" > this * $rau0 </field>
+          <field field_ref="strd_eivad_e3t"  name="strdtr_eivad" long_name="Tendency_of_salt_content_from_parameterized_eddy_advection"     unit="kg m-2 s-1" > this * $rau0 </field>
+          <field field_ref="strd_iso_e3t"    name="strdtr_iso"   long_name="Tendency_of_salt_content_from_parameterized_eddy_diffusion"     unit="kg m-2 s-1" > this * $rau0 </field>
+          <field field_ref="strd_totad_e3t"  name="strdtr_totad" long_name="Tendency_of_salt_content_from_residual_mean_advection"          unit="kg m-2 s-1" > this * $rau0  </field>
+          <field field_ref="strd_tot_e3t"    name="strdtr_tot"   long_name="Tendency_of_salt_content_from_all_processes"                    unit="kg m-2 s-1" > this * $rau0  </field>
+        </file>
+
+
+      </file_group>
+
+      <file_group id="2y_opa"  output_freq="2y" output_level="10" enabled=".TRUE."/> <!-- real 2y files -->
+      <file_group id="5y_opa"  output_freq="5y" output_level="10" enabled=".TRUE."/> <!-- real 5y files -->
+      <file_group id="10y_opa" output_freq="10y" output_level="10" enabled=".TRUE."/> <!-- real 10y files -->
+
+    </file_definition>
+    
+
+
+

+ 1902 - 0
3.3.3.2/runtime/classic/ece-esm.sh.tmpl

@@ -0,0 +1,1902 @@
+
+# librunscript defines some helper functions
+. ${start_dir}/librunscript.sh
+
+# =============================================================================
+# *** BEGIN User configuration
+# =============================================================================
+
+# -----------------------------------------------------------------------------
+# *** General configuration
+# -----------------------------------------------------------------------------
+# Component configuration (for syntax of the $config variable, see librunscript.sh)
+#
+# Currently maintained:
+#     config="ifs amip oasis"                            # "GCM forced-SST" : IFS + AMIP
+#     config="ifs amip oasis lpjg:fdbck"                 # "Veg"            : forced-GCM + LPJ-Guess
+#     config="ifs amip oasis tm5:chem,o3fb,ch4fb,aerfb"  # "AerChem"        : forced-GCM + TM5
+#
+#     config="ifs nemo lim3 rnfmapper xios:detached oasis"                                 # "GCM"     : IFS+NEMO
+#     config="ifs nemo lim3 rnfmapper xios:detached oasis lpjg:fdbck"                      # "Veg"     : GCM+LPJ-Guess
+#     config="ifs nemo lim3 rnfmapper xios:detached oasis pisces lpjg:fdbck tm5:co2,co2fb" # "C-cycle" : GCM+LPJG+TM5
+#     config="ifs nemo lim3 rnfmapper xios:detached oasis tm5:chem,o3fb,ch4fb,aerfb"       # "AerChem" : GCM+TM5
+#
+#     config="ifs nemo pisces lim3 rnfmapper xios:detached oasis"     # "GCM"     : IFS+NEMO+PISCES
+#
+
+config="ifs nemo lim3 rnfmapper xios:detached oasis"
+
+# minimum sanity
+has_config amip nemo && error "Cannot have both nemo and amip in config!!"
+! has_config ifs && error "The ESM script requires ifs in config"
+
+# Experiment name (exactly 4 letters!)
+export exp_name=[[[MOD:GENERAL:EXP_NAME]]]
+
+# Simulation start and end date. Use any (reasonable) syntax you want.
+run_start_date="[[[MOD:GENERAL:RUN_START_DATE]]]"
+run_end_date="[[[MOD:GENERAL:RUN_END_DATE]]]"
+
+# Set $force_run_from_scratch to 'true' if you want to force this run to start
+# from scratch, possibly ignoring any restart files present in the run
+# directory. Leave set to 'false' otherwise.
+# NOTE: If set to 'true' the run directory $run_dir is cleaned!
+force_run_from_scratch=[[[MOD:GENERAL:FORCE_RUN_FROM_SCRATCH]]]
+special_restart=false
+special_restart_from=ECE3
+special_restart_date="1995-01-01"
+
+# Resolution (TM5 resolution is set at compilation)
+ifs_grid=[[[MOD:IFS:GRID]]]
+nem_grid=[[[MOD:NEM:GRID]]]
+
+# Restart frequency. Use any (reasonable) number and time unit you want.
+# For runs without restart, leave this variable empty
+rst_freq="[[[MOD:GENERAL:RST_FREQ]]]"
+
+# Number of restart legs to be run in one go
+run_num_legs=[[[MOD:GENERAL:RUN_NUM_LEGS]]]
+
+# Coupling frequencies
+has_config ifs tm5  && cpl_freq_atm_ctm_hrs=[[[MOD:OASIS:CPL_FREQ_ATM_CHE_HRS]]]
+has_config ifs lpjg && cpl_freq_atm_lpjg_hrs=[[[MOD:OASIS:CPL_FREQ_ATM_LPJG_HRS]]]
+
+# Don't change the coupling frequency because UPDCLIE (where SST and SIC
+# are updated) is called every 24 hours (hardcoded in ifs-36r4/src/ifs/utility/updtim.F90)
+has_config amip && cpl_freq_amip_sec=86400
+
+# Directories
+#start_dir=${PWD}
+ctrl_file_dir=${start_dir}/ctrl
+output_control_files_dir=${start_dir}/[[[MOD:GENERAL:OUTPUT_CONTROL_FILES_DIR]]]
+
+# Architecture
+build_arch=[[[PLT:ACTIVE:BUILD_ARCH]]]
+use_machinefile=[[[PLT:ACTIVE:USE_MACHINEFILE]]]
+
+# This file is used to store information about restarts
+ece_info_file="ece.info"
+
+# -----------------------------------------------------------------------------
+# *** Read platform dependent configuration
+# -----------------------------------------------------------------------------
+. ${start_dir}/ecconf.cfg
+
+configure
+
+# -----------------------------------------------------------------------------
+# *** Time step settings
+# -----------------------------------------------------------------------------
+if has_config ifs
+then
+    case "${ifs_grid}" in
+
+        T159L*) ifs_time_step_sec=3600 ;;
+        T255L*) ifs_time_step_sec=2700 ;;
+        T511L*) ifs_time_step_sec=900  ;;
+
+        *)  error "Can't set time steps for unknown horizontal grid: ${ifs_grid}"
+            ;;
+    esac
+fi
+
+if has_config nemo
+then
+    case "${nem_grid}" in
+
+        ORCA1L*)   nem_time_step_sec=2700; lim_time_step_sec=2700 ;;
+        ORCA025L*) nem_time_step_sec=900 ; lim_time_step_sec=900  ;;
+
+        *)  error "Can't set time steps for unknown horizontal grid: ${nem_grid}"
+            ;;
+    esac
+fi
+
+if has_config ifs nemo
+then
+    case "${ifs_grid}--${nem_grid}" in
+
+        T159L*--ORCA1L*)
+            ifs_time_step_sec=3600; nem_time_step_sec=2700; lim_time_step_sec=2700; cpl_freq_atm_oce_sec=10800
+            ;;
+        T255L*--ORCA1L*)
+            ifs_time_step_sec=2700; nem_time_step_sec=2700; lim_time_step_sec=2700; cpl_freq_atm_oce_sec=2700
+            ;;
+        T511L*--ORCA025L*)
+            ifs_time_step_sec=900 ; nem_time_step_sec=900 ; lim_time_step_sec=900 ; cpl_freq_atm_oce_sec=2700
+            ;;
+
+        *)  error "Can't set time steps for unknown combination of horizontal grids: ${ifs_grid}-${nem_grid}"
+            ;;
+    esac
+fi
+
+# -----------------------------------------------------------------------------
+# *** IFS configuration
+# -----------------------------------------------------------------------------
+
+ifs_version=36r4
+
+ifs_di_freq=$(( 24 * 3600 / ifs_time_step_sec ))
+ifs_ddh_freq=$(( 120 * 3600 / ifs_time_step_sec ))
+
+export ifs_res_hor=$(echo ${ifs_grid} | sed 's:T\([0-9]\+\)L\([0-9]\+\):\1:')
+ifs_res_ver=$(echo ${ifs_grid} | sed 's:T\([0-9]\+\)L\([0-9]\+\):\2:')
+
+ifs_numproc=[[[MOD:IFS:NUMPROC]]]
+
+ifs_exe_file=${ecearth_src_dir}/ifs-${ifs_version}/bin/ifsmaster-${build_arch}
+
+ifs_lastout=false
+
+ifs_cmip5=[[[MOD:IFS:CMIP5]]]
+ifs_cmip5_rcp=[[[MOD:IFS:CMIP5_RCP]]]
+export ifs_cmip_fixyear=[[[MOD:IFS:CMIP_FIXYEAR]]]
+export ifs_cmip_fixyear_ch4=[[[MOD:IFS:CMIP_FIXYEAR_CH4]]]
+
+# Repeat trap from ifs/suecrad.F90 for early catch
+if ! has_config tm5:ch4fb && (( $ifs_cmip_fixyear != $ifs_cmip_fixyear_ch4 ))
+then
+    error 'CH4 in IFS is not provided by TM5, NCMIPFIXYR_CH4 should be set equal to NCMIPFIXYR'
+fi
+
+ifs_cmip6=[[[MOD:IFS:CMIP6]]]
+ifs_mac2sp=[[[MOD:IFS:CMIP6]]]
+ifs_cmip6piaer=[[[MOD:IFS:CMIP6]]]
+ifs_cmip6_scenario=[[[MOD:IFS:CMIP6_SCENARIO]]]
+
+# Enable optional COVID-19 scenarios, will enforce ifs_cmip6_scenario=SSP2-4.5
+ifs_covid19=FALSE
+# Choose one scenario : Base TwoYearBlip ModerateGreen StrongGreen FossilFuel
+ifs_covid19scen=Base
+# Basic sanity checks
+if [ ${ifs_covid19} == TRUE ] ; then
+    [ ${ifs_cmip6_scenario} != SSP2-4.5 ] && echo "*WARNING* with ifs_covid19=TRUE IFS uses ifs_cmip6_scenario=SSP2-4.5 not ${ifs_cmip6_scenario}"
+    has_config any lpjg pisces tm5 && error "ifs_covid19=TRUE is not supported with LPJ-GUESS, PISCES nor TM5"
+fi
+
+lcmip6_strataer_simp=FALSE
+lcmip6_strataer_full=[[[MOD:IFS:CMIP6]]]
+lcmip6_strataer_bckgd=FALSE
+
+export ifs_A4xCO2=[[[MOD:IFS:CMIP6_A4xCO2]]]
+export ifs_1PCTCO2=[[[MOD:IFS:CMIP6_1PCTCO2]]]
+export bgc_1PCTCO2=[[[MOD:IFS:CMIP6_1PCTCO2_BGC]]]
+
+# Time-varying orbital forcing (Qiong Zhang, SU-2013-09)
+# https://dev.ec-earth.org/projects/ecearth3/wiki/Orbital_forcing_in_EC-Earth_3
+#
+#   ifs_orb_switch=false, no orbital calculations applied
+#   ifs_orb_switch=true, use orbital calculations according to ifs_orb_mode
+#   ifs_orb_mode="fixed_year", or "variable_year", or "fixed_parameters"
+#     fixed_year: calculate the orbital parameters at ifs_orb_iyear, e.g.,1850
+#     variable_year: calculate orbital parameters annually start from ifs_orb_iyear
+#     fixed_parameters: prescribe orbital parameters for given year
+case "${ifs_grid}" in
+    T159*) ifs_orb_switch=true ;;
+    *)     ifs_orb_switch=false ;;
+esac
+ifs_orb_mode="variable_year"
+ifs_orb_iyear=$(date -u -d "${run_start_date}" +%Y)
+
+# Relaxation of soil moisture (Wilhelm May, LU; October 2017)
+#  
+# LRXSM: Parameter indicating the levels to be nudged 
+#
+#   LRXSM =  0: no nudging 
+#   LRXSM = 12: 4xdaily data and 3 levels (excluding level 1)      
+#   LRXSM = 13: 4xdaily data and 4 levels
+#
+# LRXSMTx: time scale of the relaxation for level X (in hours)
+#  
+#   LRXSMTx =   0: actual values relpaced by external ones 
+#   LRXSMTx =  24: 1 day
+#   LRXSMTx = 120: 5 days
+#
+# LRXSMS: indicates when the relaxation is done 
+#
+#   LRXSMS = 0: before the time step
+#   LRXSMS = 1:  after the time step
+#
+has_config soilnudg && ifs_lrxsm=13 || ifs_lrxsm=0
+ifs_lrxsmt1=96
+ifs_lrxsmt2=72
+ifs_lrxsmt3=48
+ifs_lrxsmt4=24
+ifs_lrxsms=1
+
+# IFS tuning parameters
+variant=
+has_config tm5:chem && variant=-AerChem
+ifs_tuning_parameter_file=${ctrl_file_dir}/ifs-tuning-parameters-${ifs_grid}${variant}.sh
+if [ -f ${ifs_tuning_parameter_file} ]
+then
+    source ${ifs_tuning_parameter_file}
+else
+    error "Sorry, ${ifs_tuning_parameter_file} not found, exiting."
+fi
+
+
+# Select source of vegetation data:
+#  ifs       climatology from IFS
+#  era20c    vegetation from an off-line LPJ-Guess run forced with ERA20C
+#            (currently available only for T255 and T159)
+#  cmip6     vegetation from an EC-Earth3-Veg (interactive LPJ-Guess) run 
+#            (currently available only for T255)
+#  custom_exp vegetation from any EC-Earth3-Veg run exp
+#            (must contain same variables as era20c & cmip6 and located in icmcl_exp folder)
+#  none      don't create an ICMCL file with vegetation data (this is set
+#            automatically if LPJG is used with feedback)
+#
+ifs_veg_source="cmip6"
+
+has_config lpjg:fdbck && ifs_veg_source="none"
+
+case ${ifs_veg_source} in
+"ifs" )
+    # Use Lambert-Beer to compute effective vegetation cover
+    n_compute_eff_veg_fraction=2
+    ;;
+"era20c" )
+    # LPJG vegetation is provided as effective cover
+    # Don't use Lambert-Beer
+    n_compute_eff_veg_fraction=0
+
+    case "${ifs_grid}" in
+        T159L*) veg_version=v29 ;;
+        T255L*) veg_version=v16 ;;
+        *)  error "Vegetation from off-line LPJ-Guess not available for ${ifs_grid}" ;;
+    esac    
+    ;;
+"cmip6" )
+    # LPJG vegetation is provided as effective cover
+    # Don't use Lambert-Beer
+    n_compute_eff_veg_fraction=0
+
+    case "${ifs_grid}" in
+        T255L*) veg_version=v32 ;;
+        *)  error "Vegetation from CMIP6 EC-Earth3-Veg not available for ${ifs_grid}" ;;
+    esac    
+    ;;
+"custom_"* )
+    # LPJG vegetation is provided as effective cover
+    # Don't use Lambert-Beer
+    n_compute_eff_veg_fraction=0
+
+    veg_version=${ifs_veg_source:7}
+    if [ ! -d ${ini_data_dir}/ifs/${ifs_grid}/icmcl_${veg_version} ]
+    then
+        error "requested IFS_VEG_SOURCE = ${ifs_veg_source} but not found in ${ini_data_dir}/ifs/${ifs_grid}/icmcl_${veg_version}"
+    fi
+    ;;
+"none" )
+    # LPJG with feedback
+    n_compute_eff_veg_fraction=0
+    ! has_config lpjg:fdbck && error "IFS requires an offline source of vegetation"
+    ;;
+* )
+    error "Vegetation from ${ifs_veg_source} not implemented"
+    ;;
+esac
+
+# use DMI land ice physics and varying snow albedo
+case "${ifs_grid}" in
+    T159*) ifs_landice=true ;;
+    *)     ifs_landice=false ;;
+esac
+
+# -----------------------------------------------------------------------------
+# *** NEMO/LIM configuration
+# -----------------------------------------------------------------------------
+
+# This is only needed if the experiment is started from an existing set of NEMO
+# restart files
+nem_restart_file_path=${start_dir}/nemo-rst
+
+nem_restart_offset=0
+
+nem_res_hor=$(echo ${nem_grid} | sed 's:ORCA\([0-9]\+\)L[0-9]\+:\1:')
+
+nem_config=${nem_grid}
+has_config lim3           && nem_config=${nem_config}_LIM3
+
+if has_config pisces tm5:co2
+then
+    nem_config=${nem_config}_CarbonCycle
+elif has_config pisces
+then
+    nem_config=${nem_config}_PISCES
+fi
+
+# TODO - nemo standalone configs are not accounted for in this script, but this would set the required nem_config
+! has_config ifs && nem_config=${nem_config}_standalone
+
+nem_exe_file=${ecearth_src_dir}/nemo-3.6/CONFIG/${nem_config}/BLD/bin/nemo.exe
+
+nem_numproc=[[[MOD:NEM:NUMPROC]]]
+
+# Thermal conductivity of snow, see comment in ctrl/namelist.lim3.ref.sh
+case "${ifs_grid}" in
+    T159L* ) nem_rn_cdsn=0.25 ;;
+    * )      nem_rn_cdsn=0.27 ;;
+esac
+
+# -----------------------------------------------------------------------------
+# *** Runoff mapper configuration
+# -----------------------------------------------------------------------------
+
+rnf_exe_file=${ecearth_src_dir}/runoff-mapper/bin/runoff-mapper.exe
+rnf_numproc=1
+
+# -----------------------------------------------------------------------------
+# *** LPJ-GUESS configuration
+# -----------------------------------------------------------------------------
+
+lpjg_time_step_sec=[[[MOD:LPJG:TIME_STEP_SEC]]]
+lpjg_numproc=[[[MOD:LPJG:NUMPROC]]]
+
+has_config lpjg       && lpjg_on=1
+has_config lpjg:fdbck && lpjg_fdbck=1
+has_config tm5:co2    && lpjg_fdbck_tm5=1 || lpjg_fdbck_tm5=0
+
+export lpjg_fixNdepafter=[[[MOD:LPJG:LPJG_FIXNDEPAFTER]]]
+export lpjg_fixLUafter=[[[MOD:LPJG:LPJG_FIXLUAFTER]]]
+
+info '!!!! CMIP FIX YEAR SETTINGS:'
+info "ifs_cmip_fixyear:  $ifs_cmip_fixyear"
+info "lpjg_fixNDepAfter: $lpjg_fixNdepafter"
+info "lpjg_fixLUAfter:   $lpjg_fixLUafter"
+info '!!!!'  
+
+lpjg_res=T${ifs_res_hor}
+lpjg_exe_file=${ecearth_src_dir}/lpjg/build/guess_${lpjg_res}
+
+# -----------------------------------------------------------------------------
+# *** AMIP-reader configuration
+# -----------------------------------------------------------------------------
+
+amip_exe_file=${ecearth_src_dir}/amip-forcing/bin/amip-forcing.exe
+amip_numproc=1
+
+# -----------------------------------------------------------------------------
+# *** TM5 configuration
+# -----------------------------------------------------------------------------
+
+if $(has_config tm5)
+then
+    # With TM5, NPRTRV is set to 1 in the namelist. To avoid some out-of-bound
+    # arrays in IFS, we must limit the number of cores for IFS
+    if (( ifs_numproc > (ifs_res_hor+1) ))
+    then
+        error "too much cores requested for IFS, max is $((ifs_res_hor+1))"
+    fi
+
+    # TM5 settings
+    has_config tm5:co2 && tmversion="co2" || tmversion="cb05"
+    has_config tm5:co2 && export tm5_co2=1 || export tm5_co2=0
+    export tm5_exch_nlevs=[[[MOD:TM5:NLEVS]]]
+    tm5_time_step_sec=[[[MOD:TM5:TIME_STEP_SEC]]]
+    export tm5_numproc_x=[[[MOD:TM5:NUMPROC_X]]]
+    export tm5_numproc_y=[[[MOD:TM5:NUMPROC_Y]]]
+    tm5_numproc=$(( tm5_numproc_x * tm5_numproc_y ))
+    export tm5_emiss_fixyear=[[[MOD:TM5:EMISS_FIXYEAR]]]
+
+    # limited number of levels for feedback (aerosols, currently set to lmax_conv in TM5)
+    case ${tm5_exch_nlevs} in
+        34) export tm5_exch_nlevs_cutoff=23 ;;
+        10) export tm5_exch_nlevs_cutoff=10 ;;
+         4) export tm5_exch_nlevs_cutoff=4  ;;
+         *) error "not supported number of levels for TM5"
+    esac
+
+    # executable
+    tm5_exe_file=${ecearth_src_dir}/tm5mp/build-${tmversion}-ml${tm5_exch_nlevs}/appl-tm5-${tmversion}.x
+
+    # path to initial conditions, modify as needed
+    tm5_restart_file_path=${ini_data_dir}/tm5/restart/${tmversion}-ml${tm5_exch_nlevs}
+
+    # fields sent back to IFS
+    has_config tm5:o3fb   && tm5_to_ifs=O3 || tm5_to_ifs=
+    has_config tm5:ch4fb  && tm5_to_ifs=${tm5_to_ifs},CH4
+    has_config tm5:aerfb && tm5_to_ifs=${tm5_to_ifs},"\
+N2,SU2,BC2,OC2,N3,SU3,BC3,OC3,SS3,DU3,\
+N4,SU4,BC4,OC4,SS4,DU4,N5,BC5,OC5,N6,DU6,N7,DU7,\
+NO3,MSA,\
+AOD_01,AOD_02,AOD_03,AOD_04,AOD_05,AOD_06,AOD_07,AOD_08,AOD_09,AOD_10,AOD_11,AOD_12,AOD_13,AOD_14,\
+SSA_01,SSA_02,SSA_03,SSA_04,SSA_05,SSA_06,SSA_07,SSA_08,SSA_09,SSA_10,SSA_11,SSA_12,SSA_13,SSA_14,\
+ASF_01,ASF_02,ASF_03,ASF_04,ASF_05,ASF_06,ASF_07,ASF_08,ASF_09,ASF_10,ASF_11,ASF_12,ASF_13,ASF_14"
+    has_config tm5:co2fb && tm5_to_ifs=${tm5_to_ifs},CO2
+
+    export tm5_to_ifs=$(echo ${tm5_to_ifs} | sed "s/^,//")
+
+    # coupled to LPJ-Guess and/or PISCES?
+    has_config tm5:co2 lpjg   && export cpl_tm_guess=T  || export cpl_tm_guess=F
+    has_config tm5:co2 pisces && export cpl_tm_pisces=T || export cpl_tm_pisces=F
+fi
+
+# -----------------------------------------------------------------------------
+# *** OASIS configuration
+# -----------------------------------------------------------------------------
+
+# Restart files for the coupling fields (note 8 character limit in OASIS)
+#   rstas.nc : atmosphere single-category fields
+#   rstam.nc : atmosphere multi-category fields
+#   rstos.nc : ocean single-category fields
+#   rstom.nc : ocean multi-category fields
+oas_rst_ifs_nemo="rstas.nc rstos.nc"
+
+oas_rst_ifs_lpjg="vegin.nc lpjgv.nc"
+
+# Met fields from IFS to TM (always required)
+oas_rst_ifs_tm5="r_hum.nc r_g2d.nc r_udr.nc r_div.nc r_vor.nc \
+                 r_ddr.nc r_tmp.nc r_dmf.nc r_s2d.nc r_umf.nc"
+
+has_config tm5:chem && \
+    oas_rst_ifs_tm5=${oas_rst_ifs_tm5}' r_cc_.nc r_clw.nc r_cco.nc r_ciw.nc r_ccu.nc'
+
+has_config tm5:o3fb || has_config tm5:ch4fb && oas_rst_ifs_tm5=$oas_rst_ifs_tm5' o3ch4.nc'
+has_config tm5:aerfb && oas_rst_ifs_tm5=$oas_rst_ifs_tm5' C???????'
+
+# C-cycle configuration
+has_config tm5:co2 lpjg   && oas_rst_ifs_tm5=$oas_rst_ifs_tm5' l_co2.nc rlpjg.nc'
+has_config tm5:co2 pisces && oas_rst_ifs_tm5=$oas_rst_ifs_tm5' o_co2.nc pisce.nc'
+has_config tm5:co2fb      && oas_rst_ifs_tm5=$oas_rst_ifs_tm5' co2mx.nc'
+
+# final list of files depends on the activated components - this is used in save_ic as well
+#oas_rst_files="${oas_rst_ifs_nemo} ${oas_rst_ifs_tm5} vegin.nc lpjgv.nc"
+oas_rst_files=""
+has_config ifs nemo && oas_rst_files+=" ${oas_rst_ifs_nemo}"
+has_config ifs lpjg && oas_rst_files+=" ${oas_rst_ifs_lpjg}"
+has_config ifs tm5 && oas_rst_files+=" ${oas_rst_ifs_tm5}"
+
+# Decide whether the OASIS weight files for interpolation should be linked from
+# the setup directory (true) or not (false). In the latter case, the weights
+# are re-computed at the start of the run.
+oas_link_weights=true
+
+# Flux correction for runoff (not calving) sent from Oasis to ocean.
+# 1.07945 is computed to compensate for a P-E=-0.016 mm/day (valid for std res)
+case "${ifs_grid}" in
+    T159L* ) has_config nemo && oas_mb_fluxcorr=1.08652 ;;
+    * ) has_config nemo && oas_mb_fluxcorr=1.07945 ;;
+esac
+
+# -----------------------------------------------------------------------------
+# *** XIOS configuration
+# -----------------------------------------------------------------------------
+
+xio_exe_file=${ecearth_src_dir}/xios-2.5/bin/xios_server.exe
+
+xio_numproc=[[[MOD:XIO:NUMPROC]]]
+
+# -----------------------------------------------------------------------------
+# *** Extra initial conditions saved during the run
+# -----------------------------------------------------------------------------
+if has_config save_ic
+then
+    source ./libsave_ic.sh
+    declare -a save_ic_date save_ic_date1 save_ic_sec save_ic_day save_ic_ppt_file save_ic_nemo_ts
+    oas_rst_files="${oas_rst_ifs_nemo} ${oas_rst_ifs_tm5} vegin.nc lpjgv.nc"
+fi
+
+# -----------------------------------------------------------------------------
+# *** Carbon cycle configuration
+# -----------------------------------------------------------------------------
+# set to true to write co2 fluxes sent to TM5
+ccycle_debug_fluxes=true
+
+# =============================================================================
+# *** END of User configuration
+# =============================================================================
+
+# =============================================================================
+# *** This is where the code begins ...
+# =============================================================================
+
+# -----------------------------------------------------------------------------
+# *** Create the run dir if necessary and go there
+#     Everything is done from here.
+# -----------------------------------------------------------------------------
+if [ ! -d ${run_dir} ]
+then
+    mkdir -p ${run_dir}
+    if $special_restart
+    then
+        force_run_from_scratch=false
+        rsync -av --delete ${run_dir}/../${special_restart_from}/ --exclude log --exclude output --exclude restart --exclude="${special_restart_from}_*" --exclude="srf*" --exclude="restart_*" --exclude="debug.*" --exclude="output.*" ${run_dir}
+        cp -f ${nem_exe_file} ${run_dir}
+        cp -f ${ifs_exe_file} ${run_dir}
+        cp -f ${rnf_exe_file} ${run_dir}
+        cp -f ${xio_exe_file} ${run_dir}
+        special_year=${special_restart_date:0:4}
+        sed -i "/$special_year/q" ${run_dir}/ece.info
+        . ${run_dir}/ece.info
+        special_restart_leg=$(printf %03d $((leg_number+1)))
+        special_restart_leg_oasis=$(printf %03d $((leg_number+2)))
+        # PUT HERE THE INSTRUCTIONS TO COPY THE restart files
+        rsync -av ${run_dir}/../../archive/${special_restart_from}/restart/ifs/${special_restart_leg}/ ${run_dir}
+        rsync -av ${run_dir}/../../archive/${special_restart_from}/restart/oasis/${special_restart_leg_oasis}/ ${run_dir}
+        cd ${run_dir}/../../archive/${special_restart_from}/restart/nemo/${special_restart_leg}
+        for f in *.nc; do
+            nf=${exp_name}${f:4}
+            cp $f ${run_dir}/$nf
+        done
+        cd -
+        cd ${run_dir}
+        for f in ${exp_name}_????????_restart_???_????.nc; do
+            nf=${f:14}
+            ln -s $f $nf
+        done
+        cd -
+        rm -f ${run_dir}/ICMCL${special_restart_from}INIT
+        mv ${run_dir}/ICMGG${special_restart_from}INIUA ${run_dir}/ICMGG${exp_name}INIUA
+        mv ${run_dir}/ICMGG${special_restart_from}INIT ${run_dir}/ICMGG${exp_name}INIT
+        mv ${run_dir}/ICMSH${special_restart_from}INIT ${run_dir}/ICMSH${exp_name}INIT
+    fi
+else
+    force_run_from_scratch=false
+    special_restart=false
+fi
+cd ${run_dir}
+
+# -----------------------------------------------------------------------------
+# *** Determine the time span of this run and whether it's a restart leg
+# -----------------------------------------------------------------------------
+
+# Regularise the format of the start and end date of the simulation
+run_start_date=$(date -uR -d "${run_start_date}")
+run_end_date=$(date -uR -d "${run_end_date}")
+
+
+# -----------------------------------------------------------------------------
+# *** Set path to grib_set
+# -----------------------------------------------------------------------------
+
+grib_set=${GRIB_BIN_PATH}${GRIB_BIN_PATH:+/}grib_set
+
+# Loop over the number of legs
+for (( ; run_num_legs>0 ; run_num_legs-- ))
+do
+
+    # Check for restart information file and set the current leg start date
+    #   Ignore restart information file if force_run_from_scratch is true
+    if ${force_run_from_scratch} || ! [ -r ${ece_info_file} ]
+    then
+        leg_is_restart=false
+        leg_start_date=${run_start_date}
+        leg_number=1
+    else
+        leg_is_restart=true
+        . ./${ece_info_file}
+        leg_start_date=${leg_end_date}
+        leg_number=$((leg_number+1))
+    fi
+
+    # Compute the end date of the current leg
+    if [ -n "${rst_freq}" ]
+    then
+        leg_end_date=$(date -uR -d "${leg_start_date} + ${rst_freq}")
+    else
+        leg_end_date=${run_end_date}
+    fi
+
+    # Check if legs are integer multiples of full years if LPJG is used
+    if has_config lpjg
+    then
+        
+        if [[ $(date +%m%d%T -u -d "${leg_start_date}") != "010100:00:00" || \
+            $(date +%m%d%T -u -d "${leg_start_date} + ${rst_freq}") != "010100:00:00" ]]
+        then
+            error "LPJ-GUESS runs must start on Jan 1 and end on Dec 31. Multi-year legs are allowed."
+        fi
+    fi              
+
+    if [ $(date -u -d "${leg_end_date}" +%s) -ge $(date -u -d "${run_end_date}" +%s) ]
+    then
+        leg_end_date=${run_end_date}
+        ifs_lastout=true
+    fi
+
+    # Some time variables needed later
+    leg_length_sec=$(( $(date -u -d "${leg_end_date}" +%s) - $(date -u -d "${leg_start_date}" +%s) ))
+    leg_start_sec=$(( $(date -u -d "${leg_start_date}" +%s) - $(date -u -d "${run_start_date}" +%s) ))
+    leg_end_sec=$(( $(date -u -d "${leg_end_date}" +%s) - $(date -u -d "${run_start_date}" +%s) ))
+    leg_start_date_yyyymmdd=$(date -u -d "${leg_start_date}" +%Y%m%d)
+    leg_start_date_yyyy=$(date -u -d "${leg_start_date}" +%Y)
+    leg_end_date_yyyy=$(date -u -d "${leg_end_date}" +%Y)
+
+    # Check whether there's actually time left to simulate - exit otherwise
+    if [ ${leg_length_sec} -le 0 ]
+    then
+        info "Leg start date equal to or after end of simulation."
+        info "Nothing left to do. Exiting."
+        exit 0
+    fi
+
+    # Initial conditions saved during the run
+    do_save_ic=false
+    has_config save_ic && save_ic_get_config
+    # if you do not use an option with save_ic, you must define 'do_save_ic' and
+    # 'save_ic_date_offset' here or in ../libsave_ic.sh/save_ic_get_config()
+    ${do_save_ic} && save_ic_define_vars
+
+    # -------------------------------------------------------------------------
+    # *** Prepare the run directory for a run from scratch
+    # -------------------------------------------------------------------------
+    if ! $leg_is_restart
+    then
+        # ---------------------------------------------------------------------
+        # *** Check if run dir is empty. If not, and if we are allowed to do so
+        #     by ${force_run_from_scratch}, remove everything
+        # ---------------------------------------------------------------------
+        if $(ls * >& /dev/null)
+        then
+            if ${force_run_from_scratch}
+            then
+                rm -fr ${run_dir}/*
+            else
+                error "Run directory not empty and \$force_run_from_scratch not set."
+            fi
+        fi
+
+        # ---------------------------------------------------------------------
+        # *** Copy executables of model components
+        # *** Additionally, create symlinks to the original place for reference
+        # ---------------------------------------------------------------------
+        cp    ${ifs_exe_file} .
+        ln -s ${ifs_exe_file} $(basename ${ifs_exe_file}).lnk
+
+        if $(has_config amip)
+        then
+            cp    ${amip_exe_file} .
+            ln -s ${amip_exe_file} $(basename ${amip_exe_file}).lnk
+        fi
+
+        if $(has_config nemo)
+        then
+            cp    ${nem_exe_file} .
+            ln -s ${nem_exe_file} $(basename ${nem_exe_file}).lnk
+
+            cp    ${rnf_exe_file} .
+            ln -s ${rnf_exe_file} $(basename ${rnf_exe_file}).lnk
+
+            cp    ${xio_exe_file} .
+            ln -s ${xio_exe_file} $(basename ${xio_exe_file}).lnk
+        fi
+
+        if $(has_config lpjg)
+        then
+            cp    ${lpjg_exe_file} .
+            ln -s ${lpjg_exe_file} $(basename ${lpjg_exe_file}).lnk
+        fi
+
+        if $(has_config tm5)
+        then
+            cp    ${tm5_exe_file} .
+            ln -s ${tm5_exe_file} $(basename ${tm5_exe_file}).lnk
+        fi
+
+        # ---------------------------------------------------------------------
+        # *** Files needed for IFS (linked)
+        # ---------------------------------------------------------------------
+
+        # Initial data
+        ln -s \
+        ${ini_data_dir}/ifs/${ifs_grid}/${leg_start_date_yyyymmdd}/ICMGGECE3INIUA \
+                                                            ICMGG${exp_name}INIUA
+        ln -s \
+        ${ini_data_dir}/ifs/${ifs_grid}/${leg_start_date_yyyymmdd}/ICMSHECE3INIT \
+                                                            ICMSH${exp_name}INIT
+        rm -f ICMGG${exp_name}INIT
+        cp ${ini_data_dir}/ifs/${ifs_grid}/${leg_start_date_yyyymmdd}/ICMGGECE3INIT \
+                                                            ICMGG${exp_name}INIT
+
+        # add bare_soil_albedo to ICMGG*INIT
+        tempfile=tmp.$$
+        ${grib_set} -s dataDate=$(date -u -d "$run_start_date" +%Y%m%d) \
+            ${ini_data_dir}/ifs/${ifs_grid}/climate/bare_soil_albedos.grb \
+            ${tempfile}
+
+        cat ${tempfile} >> ICMGG${exp_name}INIT
+        rm -f ${tempfile}
+
+        # add land ice mask if needed
+        if ${ifs_landice}
+        then
+            tempfile=tmp.$$
+            cdo divc,10 -setcode,82 -selcode,141 ICMGG${exp_name}INIT ${tempfile}
+            ${grib_set} -s gridType=reduced_gg ${tempfile} ${tempfile}
+            cat ${tempfile} >> ICMGG${exp_name}INIT
+            rm -f ${tempfile}
+        fi
+
+        # Other stuff
+        ln -s ${ini_data_dir}/ifs/rtables/* .
+
+        # Output control (ppt files)
+        if [ ! -f ${output_control_files_dir}/pptdddddd0600 ] &&  [ ! -f ${output_control_files_dir}/pptdddddd0300 ];then
+           echo "Error from ece-esm.sh: Neither the file pptdddddd0600 or pptdddddd0300 exists in the directory:"
+           echo " " ${output_control_files_dir}
+           exit -1
+        fi
+        mkdir postins
+        cp ${output_control_files_dir}/ppt* postins/
+        if [ -f postins/pptdddddd0600 ];then
+           ln -s pptdddddd0600 postins/pptdddddd0000
+           ln -s pptdddddd0600 postins/pptdddddd1200
+           ln -s pptdddddd0600 postins/pptdddddd1800
+        fi
+        if [ -f postins/pptdddddd0300 ];then
+           ln -s pptdddddd0300 postins/pptdddddd0900
+           ln -s pptdddddd0300 postins/pptdddddd1500
+           ln -s pptdddddd0300 postins/pptdddddd2100
+           if [ ! -f postins/pptdddddd0600 ];then
+               ln -s pptdddddd0300 postins/pptdddddd0000
+               ln -s pptdddddd0300 postins/pptdddddd0600
+               ln -s pptdddddd0300 postins/pptdddddd1200
+               ln -s pptdddddd0300 postins/pptdddddd1800
+           fi
+        fi
+        /bin/ls -1 postins/* > dirlist
+
+        # ---------------------------------------------------------------------
+        # *** Files needed for LPJ-GUESS
+        # ---------------------------------------------------------------------
+        if $(has_config lpjg)
+        then
+            # Check for valid grid
+            if [ $lpjg_res != "T255" -a $lpjg_res != "T159" ]
+            then
+                error "LPJG-gridlist doesn't exist for ifs-grid: ${ifs_grid}" 
+            fi
+            # Initial data - saved state for LPJ-GUESS (.bin format)
+            lpjgstartdir=$(printf "lpjg_state_%04d" $leg_start_date_yyyy)
+            ln -sf ${ini_data_dir}/lpjg/ini_state/${lpjg_res}/${lpjgstartdir} ${run_dir}/${lpjgstartdir}
+
+            # Control files (i.e. .ins, landuse, N deposition, soil type files etc.)
+            cp  -f ${ecearth_src_dir}/lpjg/data/ins/*.ins .
+            # activate the new litterfall scheme for C4MIP - for the coupled model this is done when both pisces and lpjg are activated
+            has_config pisces lpjg && echo -e "!override for EC-Earth-CC in runscript\nifpftlitterfall 1\ncalc_phen_after_restart 0" >> global.ins
+            mkdir -p ${run_dir}/landuse
+
+        fi
+
+        # ---------------------------------------------------------------------
+        # *** Files needed for NEMO (linked)
+        # ---------------------------------------------------------------------
+        if $(has_config nemo)
+        then
+            # Link initialisation files for matching ORCA grid
+            for f in \
+                bathy_meter.nc coordinates.nc \
+                ahmcoef.nc \
+                K1rowdrg.nc M2rowdrg.nc mask_itf.nc \
+                decay_scale_bot.nc decay_scale_cri.nc \
+                mixing_power_bot.nc mixing_power_cri.nc mixing_power_pyc.nc \
+                runoff_depth.nc subbasins.nc
+            do
+                [ -f ${ini_data_dir}/nemo/initial/${nem_grid}/$f ] && ln -s ${ini_data_dir}/nemo/initial/${nem_grid}/$f
+            done
+
+            # Copying the time independent NEMO files for the matching ORCA grid in order to facilitate cmorisation:
+            for f in \
+                bathy_meter.nc subbasins.nc
+            do
+                mkdir -p output/nemo/ofx-data
+                [ -f ${ini_data_dir}/nemo/initial/${nem_grid}/$f ] && cp -f ${ini_data_dir}/nemo/initial/${nem_grid}/$f output/nemo/ofx-data/
+            done
+
+            # Link geothermal heating file (independent of grid) and matching weight file
+            ln -s ${ini_data_dir}/nemo/initial/Goutorbe_ghflux.nc
+            ln -s ${ini_data_dir}/nemo/initial/weights_Goutorbe1_2_orca${nem_res_hor}_bilinear.nc
+
+            # Link the salinity climatology file (needed for diagnostics)
+            ln -s ${ini_data_dir}/nemo/climatology/${nem_grid}/sali_ref_clim_monthly.nc
+
+            # Link either restart files or climatology files for the initial state
+            if $(has_config nemo:start_from_restart)
+            then
+                # When linking restart files, we accept three options:
+                # (1) Merged files for ocean and ice, i.e.
+                #     restart_oce.nc and restart_ice.nc
+                # (2) One-file-per-MPI-rank, i.e.
+                #     restart_oce_????.nc and restart_ice_????.nc
+                #     No check is done whether the number of restart files agrees
+                #     with the number of MPI ranks for NEMO!
+                # (3) One-file-per-MPI-rank with a prefix, i.e.
+                #     <exp_name>_<time_step>_restart_oce_????.nc (similar for the ice)
+                #     The prefix is ignored.
+                # The code assumes that one of the options can be applied! If more
+                # options are applicable, the first is chosen. If none of the
+                # options apply, NEMO will crash with missing restart file.
+                if   ls -U ${nem_restart_file_path}/restart_[oi]ce.nc > /dev/null 2>&1
+                then
+                    ln -s ${nem_restart_file_path}/restart_[oi]ce.nc ./
+
+                elif ls -U ${nem_restart_file_path}/restart_[oi]ce_????.nc > /dev/null 2>&1
+                then
+                    ln -s ${nem_restart_file_path}/restart_[oi]ce_????.nc ./
+
+                else
+                    for f in ${nem_restart_file_path}/????_????????_restart_[oi]ce_????.nc
+                    do
+                        ln -s $f $(echo $f | sed 's/.*_\(restart_[oi]ce_....\.nc\)/\1/')
+                    done
+                fi
+            else
+
+                # Temperature and salinity files for initialisation
+                ln -s ${ini_data_dir}/nemo/climatology/absolute_salinity_WOA13_decav_Reg1L75_clim.nc
+                ln -s ${ini_data_dir}/nemo/climatology/conservative_temperature_WOA13_decav_Reg1L75_clim.nc
+                ln -s ${ini_data_dir}/nemo/climatology/weights_WOA13d1_2_orca${nem_res_hor}_bilinear.nc
+
+                # Grid dependent runoff files
+                case ${nem_grid} in
+                    ORCA1*)   ln -s ${ini_data_dir}/nemo/climatology/runoff-icb_DaiTrenberth_Depoorter_ORCA1_JD.nc ;;
+                    ORCA025*) ln -s ${ini_data_dir}/nemo/climatology/ORCA_R025_runoff_v1.1.nc ;;
+                esac
+            fi
+
+            # for ocean_nudging
+            if $(has_config nemo:ocenudg) ; then
+                ln -s ${ini_data_dir}/nemo/oce_nudg/resto.nc
+            fi
+
+            # XIOS files
+            . ${ctrl_file_dir}/iodef.xml.sh > iodef.xml
+            ln -s ${ctrl_file_dir}/context_nemo.xml
+            ln -s ${ctrl_file_dir}/domain_def_nemo.xml
+            ln -s ${ctrl_file_dir}/axis_def_nemo.xml
+            ln -s ${ctrl_file_dir}/grids_def_nemo.xml
+            ln -s ${ctrl_file_dir}/field_def_nemo-lim.xml
+            ln -s ${ctrl_file_dir}/field_def_nemo-opa.xml
+            ln -s ${ctrl_file_dir}/field_def_nemo-pisces.xml
+            ln -s ${ctrl_file_dir}/field_def_nemo-inerttrc.xml
+            ln -s ${output_control_files_dir}/file_def_nemo-lim3.xml file_def_nemo-lim.xml
+            ln -s ${output_control_files_dir}/file_def_nemo-opa.xml
+            ln -s ${output_control_files_dir}/file_def_nemo-pisces.xml
+
+            if [ -f ${ini_data_dir}/xios/ORCA${nem_res_hor}/coordinates_xios.nc ]
+            then
+                cp ${ini_data_dir}/xios/ORCA${nem_res_hor}/coordinates_xios.nc ./
+            else
+                info "File 'coordinates_xios.nc' not found. NEMO can not be run with land domain removal!"
+            fi
+
+            # Files needed for TOP/PISCES
+            if $(has_config pisces)
+            then
+                ln -fs ${ini_data_dir}/nemo/pisces/dust_INCA_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/ndeposition_Duce_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/pmarge_etopo_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/river_global_news_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/Solubility_T62_Mahowald_ORCA_R1.nc
+
+                ln -fs ${ini_data_dir}/nemo/pisces/par_fraction_gewex_clim90s00s_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/DIC_GLODAP_annual_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/Alkalini_GLODAP_annual_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/O2_WOA2009_monthly_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/PO4_WOA2009_monthly_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/Si_WOA2009_monthly_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/DOC_PISCES_monthly_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/Fer_PISCES_monthly_ORCA_R1.nc
+                ln -fs ${ini_data_dir}/nemo/pisces/NO3_WOA2009_monthly_ORCA_R1.nc
+
+                # create co2 concentration file atcco2.txt if required
+                if { [ $ifs_cmip_fixyear -gt 0 ] || [[ "${ifs_A4xCO2}" = "TRUE" ]]; } && [[ "${bgc_1PCTCO2}" = "FALSE" ]]
+                then
+                    rm -f atcco2.txt
+                elif [[ "${bgc_1PCTCO2}" = "TRUE" ]]
+                then
+                    cp -f ${ini_data_dir}/nemo/pisces/mole-fraction-of-carbon-dioxide-in-air_1pctCO2_1849-2016.txt atcco2.txt
+                else
+                    # determine scenario-name and co2-file middle-fix
+                    case $(echo ${ifs_cmip6_scenario} | tr '[:upper:]' '[:lower:]') in
+                        hist*)     pis_scen="ssp585"; pis_sco2_mfix="REMIND-MAGPIE-ssp585-1-2-1";;
+                        ssp2-4.5*) pis_scen="ssp245"; pis_sco2_mfix="MESSAGE-GLOBIOM-ssp245-1-2-1";;
+                        ssp5-3.4*) pis_scen="ssp534os"; pis_sco2_mfix="REMIND-MAGPIE-ssp534-over-1-2-1";;
+                        ssp5-8.5*) pis_scen="ssp585"; pis_sco2_mfix="REMIND-MAGPIE-ssp585-1-2-1";;
+                        *)  error "Scenario ${ifs_cmip6_scenario} not defined for PISCES" ;;
+                    esac
+
+                    # concatenate historic and scenario (2015+) co2 concentration file
+                    pis_sco2_pfix="${ini_data_dir}/nemo/pisces/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations"
+                    cat ${pis_sco2_pfix}_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_1849-2014.txt ${pis_sco2_pfix}_ScenarioMIP_UoM-${pis_sco2_mfix}_gr1-GMNHSH_2015-2500.txt > atcco2.txt
+                fi
+            fi
+
+            #linking surface boundary conditions for CFCs (even if CFCs are not included)
+            ln -fs ${ini_data_dir}/nemo/cfc/CFCs_CDIAC_extension_1637_2019.dat CFCs_CDIAC.dat
+
+            if $(has_config pisces:start_from_restart)
+            then
+            # Same three options as for nemo:start_from_restart
+                if   ls -U ${nem_restart_file_path}/restart_trc.nc > /dev/null 2>&1
+                then
+                    ln -s ${nem_restart_file_path}/restart_trc.nc ./
+
+                elif ls -U ${nem_restart_file_path}/restart_trc_????.nc > /dev/null 2>&1
+                then
+                    ln -s ${nem_restart_file_path}/restart_trc_????.nc ./
+
+                else
+                    for f in ${nem_restart_file_path}/????_????????_restart_trc_????.nc
+                    do
+                        ln -s $f $(echo $f | sed 's/.*_\(restart_trc_....\.nc\)/\1/')
+                    done
+                fi
+            fi
+
+        fi
+
+        # ---------------------------------------------------------------------
+        # *** Files needed for the Runoff mapper (linked)
+        # ---------------------------------------------------------------------
+
+        has_config rnfmapper && \
+            ln -s ${ini_data_dir}/runoff-mapper/runoff_maps.nc
+
+        # -------------------------------------------------------------------------
+        # *** File and dir needed for TM5
+        # -------------------------------------------------------------------------
+        if $(has_config tm5)
+        then
+            tm5_istart=[[[MOD:TM5:ISTART]]]
+
+            case ${tm5_istart} in
+                33|32) ln -s \
+                    ${tm5_restart_file_path}/TM5_restart_${leg_start_date_yyyymmdd}_0000_glb300x200.nc
+                    ;;
+                31) ln -s ${tm5_restart_file_path}/tm5_save.hdf
+                    ;;
+                5)  ln -s ${tm5_restart_file_path}/tm5_mmix.hdf
+                    ;;
+                2|9) 
+                    ;;
+                *)  error "Unsupported initial fields option (TM5): ${tm5_istart}"
+                    ;;
+            esac
+
+            # spectral info
+            ln -s ${ini_data_dir}/tm5/TM5_INPUT/T${ifs_res_hor}_info.txt
+
+            # Profiling dir for TM5
+            mkdir -p ${run_dir}/tm5_profile
+        fi
+
+        # ---------------------------------------------------------------------
+        # *** Files needed for OASIS (linked)
+        # ---------------------------------------------------------------------
+
+        # Name table file
+        ln -s ${ini_data_dir}/oasis/cf_name_table.txt
+
+        # -- Get grid definition and weight files for IFS/NEMO or IFS/AMIP coupling
+        has_config nemo && \
+            oas_grid_dir=${ini_data_dir}/oasis/T${ifs_res_hor}-ORCA${nem_res_hor} && \
+            mycp='cp'
+
+        has_config amip && \
+            oas_grid_dir=${ini_data_dir}/oasis/AMIP && \
+            mycp='cdo -f nc copy' # to enforce nc format, needed for 'cdo merge' to work (have nc4c with Primavera files)
+
+        # Grid definition files
+        if $(has_config tm5)
+        then
+            ${mycp} ${oas_grid_dir}/areas.nc gcm_areas.nc
+            ${mycp} ${oas_grid_dir}/grids.nc gcm_grids.nc
+            ${mycp} ${oas_grid_dir}/masks.nc gcm_masks.nc
+        else
+            ln -s ${oas_grid_dir}/areas.nc
+            ln -s ${oas_grid_dir}/grids.nc
+            ln -s ${oas_grid_dir}/masks.nc
+        fi
+
+        # Weight files
+        case ${ifs_res_hor} in
+            159)  oas_agrd=080
+                  ;;
+            255)  oas_agrd=128
+                  ;;
+            511)  oas_agrd=256
+                  ;;
+            799)  oas_agrd=400
+                  ;;
+            *)    error "Unsupported horizontal resolution (IFS): ${ifs_res_hor}"
+                  ;;
+        esac
+
+        if $(has_config nemo)
+        then
+            case ${nem_res_hor} in
+                1)  oas_ogrd=O1t0
+                    ;;
+                025)  oas_ogrd=Ot25
+                    ;;
+                *)  error "Unsupported horizontal resolution (NEMO): ${nem_res_hor}"
+                    ;;
+            esac
+        fi
+
+        if ${oas_link_weights}
+        then
+            for f in ${oas_grid_dir}/rmp_????_to_????_GAUSWGT.nc
+            do
+                ln -s $f
+            done
+        fi
+
+        if $(has_config ifs nemo)
+        then
+            for f in ${oas_rst_ifs_nemo}
+            do
+                cp ${oas_grid_dir}/rst/$f .
+            done
+        fi
+
+        # -- Get grid definition, weight and restart files for TM5 coupling
+        if $(has_config tm5)
+        then
+            oas_grid_dir=${ini_data_dir}/oasis/T${ifs_res_hor}-TM5-LPJG
+
+            cp ${oas_grid_dir}/tm5_areas.nc .
+            cp ${oas_grid_dir}/tm5_grids.nc .
+            cp ${oas_grid_dir}/tm5_masks.nc .
+
+            if ${oas_link_weights}
+            then
+                for f in ${oas_grid_dir}/rmp_????_to_????_*.nc
+                do
+                    ln -s $f
+                done
+            fi
+
+            # -- Get restart files for TM5-IFS/LPJG/PISCES 
+            for f in ${oas_rst_ifs_tm5}
+            do
+                cp ${oas_grid_dir}/rst/${tm5_exch_nlevs}-levels/$f .
+            done
+
+            # -- Merge grid definition files
+            cdo merge gcm_areas.nc tm5_areas.nc areas.nc
+            cdo merge gcm_grids.nc tm5_grids.nc grids.nc
+            cdo merge gcm_masks.nc tm5_masks.nc masks.nc
+        fi
+
+    else # i.e. $leg_is_restart == true
+
+        # ---------------------------------------------------------------------
+        # *** Remove all leftover output files from previous legs
+        # ---------------------------------------------------------------------
+
+        # IFS files
+        rm -f ICM{SH,GG}${exp_name}+??????
+
+        # NEMO files
+        rm -f ${exp_name}_??_????????_????????_{grid_U,grid_V,grid_W,grid_T,icemod,SBC,scalar,SBC_scalar,diad_T}.nc
+
+        # TM5 restart file type
+        tm5_istart=33
+
+        if [ $tm5_istart -eq 31 ] && $(has_config tm5)
+        then
+            ln -sf save_${leg_start_date_yyyymmdd}00_glb300x200.hdf tm5_save.hdf
+        fi
+
+    fi # ! $leg_is_restart
+
+    #--------------------------------------------------------------------------
+    # *** Surface restoring and ocean nudging options
+    #--------------------------------------------------------------------------
+    if $(has_config nemo:ocenudg) ; then
+        ln -fs ${ini_data_dir}/nemo/oce_nudg/temp_sal*.nc ./
+    fi
+
+    if $(has_config nemo:surfresto) ; then
+        ln -fs ${ini_data_dir}/nemo/surface_restoring/sss_restore_data*.nc  ./
+        ln -fs ${ini_data_dir}/nemo/surface_restoring/sst_restore_data*.nc  ./
+        ln -fs ${ini_data_dir}/nemo/surface_restoring/mask_restore*.nc ./
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Remove land grid-points
+    # -------------------------------------------------------------------------
+    if $(has_config nemo:elpin)
+    then
+        if [ ! -f coordinates_xios.nc ]
+        then
+            error "ELpIN requested, but file 'coordinates_xios.nc' was not found"
+        fi
+        jpns=($(${ecearth_src_dir}/util/ELPiN/ELPiNv2.cmd ${nem_numproc}))
+        info "nemo domain decompostion from ELpIN: ${jpns[@]}"
+        nem_numproc=${jpns[0]}
+        nem_jpni=${jpns[1]}
+        nem_jpnj=${jpns[2]}
+    elif has_config nemo
+    then
+        info "nemo original domain decomposition (not using ELPiN)"
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Initial conditions saved during the run
+    # -------------------------------------------------------------------------
+    ${do_save_ic} && save_ic_prepare_output
+
+    # -------------------------------------------------------------------------
+    # *** Create some control files
+    # -------------------------------------------------------------------------
+
+    # Create TM5 runtime rcfile
+    tm5_start_date=$(date -u -d "${leg_start_date}" +%F\ %T)
+    tm5_end_date=$(date -u -d "${leg_end_date}" +%F\ %T)
+
+    if $(has_config tm5)
+    then
+        cp -f ${ctrl_file_dir}/tm5-config-run.rc ${run_dir}
+        ${ecearth_src_dir}/tm5mp/setup_tm5 --no-compile \
+            --time-start="${tm5_start_date}" --time-final="${tm5_end_date}" \
+            --istart=${tm5_istart} ${run_dir}/tm5-config-run.rc
+    fi
+
+    # IFS frequency output for namelist
+    if [ -f postins/pptdddddd0300 ]
+    then
+        ifs_output_freq=$(( 3 * 3600 / ifs_time_step_sec ))
+    elif [ -f postins/pptdddddd0600 ]
+    then
+        ifs_output_freq=$(( 6 * 3600 / ifs_time_step_sec ))
+    else
+        error "IFS output frequency undefined."
+    fi
+
+    # IFS, NEMO, LIM, AMIP namelist and OASIS namcouple files
+    has_config ifs       && . ${ctrl_file_dir}/namelist.ifs.sh                          > fort.4
+    has_config nemo      && . ${ctrl_file_dir}/namelist.nemo.ref.sh                     > namelist_ref
+    has_config ifs nemo  && . ${ctrl_file_dir}/namelist.nemo-${nem_grid}-coupled.cfg.sh > namelist_cfg
+    has_config lim3      && . ${ctrl_file_dir}/namelist.lim3.ref.sh                     > namelist_ice_ref
+    has_config lim3      && . ${ctrl_file_dir}/namelist.lim3-${nem_grid}.cfg.sh         > namelist_ice_cfg
+    has_config rnfmapper && . ${ctrl_file_dir}/namelist.runoffmapper.sh                 > namelist.runoffmapper
+    has_config amip      && . ${ctrl_file_dir}/namelist.amip.sh                         > namelist.amip
+    has_config pisces    && . ${ctrl_file_dir}/namelist.nemo.top.ref.sh                 > namelist_top_ref
+    has_config pisces    && . ${ctrl_file_dir}/namelist.nemo.top.cfg.sh                 > namelist_top_cfg
+    has_config pisces    && . ${ctrl_file_dir}/namelist.nemo.pisces.ref.sh              > namelist_pisces_ref
+    has_config pisces    && . ${ctrl_file_dir}/namelist.nemo.pisces.cfg.sh              > namelist_pisces_cfg
+    has_config nemo      && . ${ctrl_file_dir}/namelist.nemo.age.ref.sh                 > namelist_age_ref
+    has_config nemo      && . ${ctrl_file_dir}/namelist.nemo.age.cfg.sh                 > namelist_age_cfg
+    #include CFCs namelist even if CFCs are not included
+    has_config nemo      && . ${ctrl_file_dir}/namelist.nemo.cfc.ref.sh                 > namelist_cfc_ref
+    has_config nemo      && . ${ctrl_file_dir}/namelist.nemo.cfc.cfg.sh                 > namelist_cfc_cfg
+    # C-cycle - overwrite coupled nemo namelist
+    has_config pisces tm5:co2  && \
+        . ${ctrl_file_dir}/namelist.nemo-${nem_grid}-carboncycle.cfg.sh > namelist_cfg
+
+    lucia=[[[MOD:OASIS:LUCIA]]]
+    . ${ctrl_file_dir}/namcouple.sh > namcouple
+
+    # -------------------------------------------------------------------------
+    # *** LPJ-GUESS initial data
+    # -------------------------------------------------------------------------
+    if $(has_config lpjg)
+    then
+        # LPJG runtime rcfile - update with leg dates
+        . ${ctrl_file_dir}/namelist.lpjg.sh > lpjg_steps.rc
+
+        # determine lpjg scenario-name and co2-file middle-fix
+        case $(echo ${ifs_cmip6_scenario} | tr '[:upper:]' '[:lower:]') in
+            hist*)     lpjg_scen="ssp370"; lu_src="AIM"    ; lpjg_sco2_mfix="AIM-ssp370-1-2-1"            ; lu_file_posfix="2018_10_08.txt";;
+            ssp1-1.9*) lpjg_scen="ssp119"; lu_src="IMAGE"  ; lpjg_sco2_mfix="IMAGE-ssp119-1-2-1"          ; lu_file_posfix="2019_03_13.txt";;
+            ssp1-2.6*) lpjg_scen="ssp126"; lu_src="IMAGE"  ; lpjg_sco2_mfix="IMAGE-ssp126-1-2-1"          ; lu_file_posfix="2018_10_08.txt";;
+            ssp2-4.5*) lpjg_scen="ssp245"; lu_src="MESSAGE"; lpjg_sco2_mfix="MESSAGE-GLOBIOM-ssp245-1-2-1"; lu_file_posfix="2018_10_08.txt";;
+            ssp3-7.0*) lpjg_scen="ssp370"; lu_src="AIM"    ; lpjg_sco2_mfix="AIM-ssp370-1-2-1"            ; lu_file_posfix="2018_10_08.txt";;
+            ssp4-3.4*) lpjg_scen="ssp434"; lu_src="GCAM"   ; lpjg_sco2_mfix="GCAM4-ssp434-1-2-1"            ; lu_file_posfix="2018_10_08.txt";;
+            ssp5-3.4*) lpjg_scen="ssp534os"; lu_src="MAGPIE"; lpjg_sco2_mfix="REMIND-MAGPIE-ssp534-over-1-2-1"            ; lu_file_posfix="2019_05_10.txt";;
+            ssp5-8.5*) lpjg_scen="ssp585"; lu_src="MAGPIE" ; lpjg_sco2_mfix="REMIND-MAGPIE-ssp585-1-2-1"  ; lu_file_posfix="2018_10_08.txt";;
+            *)  error "Scenario ${ifs_cmip6_scenario} not defined for LPJ-GUESS" ;;
+        esac
+
+        lpjg_scenario_new="historical + $lpjg_sco2_mfix"
+        lpjg_scenario_info=${run_dir}/lpjg_scenario.info
+
+        if [ -f $lpjg_scenario_info ]
+        then
+            source $lpjg_scenario_info
+            if [ "$lpjg_scenario_new" = "$lpjg_scenario" ]
+            then
+                lpjg_copy_rte=false
+            else
+                lpjg_copy_rte=true
+            fi
+        else
+            lpjg_copy_rte=true
+        fi
+
+        # copy RTE only if necessary (at beginning of a run or when scenario changes)
+        if $lpjg_copy_rte
+        then
+            # write info about installed scenarios to file
+            echo "lpjg_scenario=\"historical + $lpjg_sco2_mfix\"" > $lpjg_scenario_info
+            # set file prefixes depending on scenario
+            lu_file_prefix="1850_2100_luh2_Hist_ScenarioMIP_UofMD"
+            lu_file_midfix="2_1_f"
+
+            lu_path="${ini_data_dir}/lpjg/landuse/${lpjg_res}/${lpjg_scen}"
+
+            # copy and reference-link landuse,  gross transitions, crops, n-fertilisation
+            for inp in lu gross crop nfert
+            do
+                if [ $inp == "crop" -o $inp == "nfert" ]
+                then
+                    lu_src_file="${lu_path}/${inp}_rfirr_${lu_file_prefix}_${lu_src}_${lpjg_scen}_${lu_file_midfix}_${lpjg_res}_${lu_file_posfix}"
+                else
+                    lu_src_file="${lu_path}/${inp}_${lu_file_prefix}_${lu_src}_${lpjg_scen}_${lu_file_midfix}_${lpjg_res}_${lu_file_posfix}"
+                fi
+                cp -f $lu_src_file ${run_dir}/landuse/${inp}_luh2.txt
+                ln -fs $lu_src_file ${run_dir}/landuse/${inp}_luh2.txt.lnk
+            done
+            
+            # nitrogen deposition files
+            mkdir -p ${run_dir}/ndep
+            for inp in drynhx2 drynoy2 wetnhx2 wetnoy2
+            do
+                ndep_src_file="${ini_data_dir}/lpjg/ndep/${lpjg_res}/${lpjg_scen}/${lpjg_scen}_${lpjg_res}_${inp}.nc"
+                cp -f  $ndep_src_file ${run_dir}/ndep/${inp}.nc
+                ln -fs  $ndep_src_file ${run_dir}/ndep/${inp}.nc.lnk
+            done
+
+            # concatenate historic and scenario (2015+) co2 concentration file
+            # hist co2 file 
+            lpjg_hco2_file="${ini_data_dir}/ifs/cmip6-data/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc"
+            # scenario co2 file 
+            lpjg_sco2_file="${ini_data_dir}/ifs/cmip6-data/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_ScenarioMIP_UoM-${lpjg_sco2_mfix}_gr1-GMNHSH_2015-2500.nc"
+            # combined file
+            lpjg_co2_file="${run_dir}/mole_fraction_of_carbon_dioxide_in_air_input4MIPs_lpjg.nc"
+            rm -f $lpjg_co2_file
+            cdo mergetime $lpjg_hco2_file $lpjg_sco2_file $lpjg_co2_file
+        fi
+
+        # Populate or update LPJG run directories
+        for (( n=1; n<=${lpjg_numproc}; n++ ))
+        do
+            # if run from scratch or number of procs has been extended
+            if ! $leg_is_restart || [ ! -d ${run_dir}/run${n} ]
+            then
+                # Make output directories
+                mkdir -p ${run_dir}/run${n}/output
+
+                # Copy *.ins, lpjg_steps.rc and OASIS-MCT restart files
+                cp ${run_dir}/*.ins ${run_dir}/run${n}
+
+                # Copy output control files
+                cp ${output_control_files_dir}/lpjg_cmip6_output.ins ${run_dir}/run${n}
+                ln -s ${output_control_files_dir}/lpjg_cmip6_output.ins ${run_dir}/run${n}/lpjg_cmip6_output.ins.lnk
+
+                cp ${ini_data_dir}/lpjg/oasismct/ghg*.txt ${run_dir}/run${n}
+                cp ${ini_data_dir}/lpjg/oasismct/${lpjg_res}/ece_gridlist_${lpjg_res}.txt ${run_dir}/run${n}/ece_gridlist.txt
+                ln -s ${ini_data_dir}/lpjg/oasismct/${lpjg_res}/ece_gridlist_${lpjg_res}.txt ${run_dir}/run${n}/ece_gridlist.txt.lnk
+
+                # Data only needed by master
+                if [ $n == 1 ]
+                then
+                    cp ${ini_data_dir}/lpjg/oasismct/${lpjg_res}/*.nc ${run_dir}
+                    cp ${ini_data_dir}/lpjg/oasismct/lpjgv.txt ${run_dir}/run${n}
+                fi
+            fi
+            # Refresh output-dirs after they hav been removed at end of the last leg
+            mkdir -p ${run_dir}/run${n}/output/CMIP6
+            mkdir -p ${run_dir}/run${n}/output/CRESCENDO
+        done
+
+        if $leg_is_restart
+        then
+            lpjg_restart_dir="restart/lpjg/$(printf %03d $((leg_number-1)))"
+            lpjg_rst_state="${lpjg_restart_dir}/lpjg_state_${leg_start_date_yyyy}"
+            if [ -d "$lpjg_rst_state" ]
+            then
+                ln -sf $lpjg_rst_state
+            else
+                echo "lpjg restart dir $lpjg_rst_state not available"
+                exit -1
+            fi
+            # get oasis restart files
+            oasis_restart_dir="restart/oasis/$(printf %03d $((leg_number)))"
+            cp -f ${oasis_restart_dir}/*.nc ${run_dir}/
+
+        fi
+    fi
+
+
+    # -------------------------------------------------------------------------
+    # *** Create ICMCL file with vegetation fields
+    #     not needed if LPJG is used with feedback
+    # -------------------------------------------------------------------------
+    tempfile=tmp.$$
+
+    case ${ifs_veg_source} in
+    "ifs" )
+        # Vegetation from IFS (climatology)
+
+        icmclfile=${ini_data_dir}/ifs/${ifs_grid}/climate/ICMCL_ONLY_VEG_PD
+
+        # Create data for december, the year before the leg starts
+        ${grib_set} \
+            -s dataDate=$(printf "%04d" $((leg_start_date_yyyy-1)))1215 \
+            ${icmclfile}-12 ICMCL${exp_name}INIT
+
+        # Create data for all month in the years of the leg
+        for (( y=${leg_start_date_yyyy} ; y<=${leg_end_date_yyyy} ; y++ ))
+        do
+            yy=$(printf "%04d" $y)
+            for m in {1..12}
+            do
+                mm=$(printf "%02d" $m)
+                ${grib_set} -s dataDate=${yy}${mm}15 ${icmclfile}-${mm} ${tempfile}
+                cat ${tempfile} >> ICMCL${exp_name}INIT
+            done
+        done
+
+        # Create data for january, the year after the leg ends
+        ${grib_set} \
+            -s dataDate=$(printf "%04d" $((leg_end_date_yyyy+1)))0115 \
+            ${icmclfile}-01 ${tempfile}
+        cat ${tempfile} >> ICMCL${exp_name}INIT
+        ;;
+    "era20c"|"cmip6"|"custom_"* )
+        # Vegetation from a LPJG run (off-line or EC-Earth3-Veg)
+
+        rm -f ICMCL${exp_name}INIT
+
+        # Create data for all years of the leg, including one year
+        # before and one year after
+        for (( yr=leg_start_date_yyyy-1 ; yr<=leg_end_date_yyyy+1 ; yr+=1 ))
+        do
+
+            case ${ifs_veg_source} in
+            'era20c' )
+                # no scenario needed with era20c
+                icmcl_scenario="" ;;
+            'custom_'* )
+                # no scenario implemented yet with custom_dir
+                icmcl_scenario="" ;;
+            'cmip6' )
+                # select scenario, use SSP3-7.0 as default
+                # if not otherwise specified
+                icmcl_scenario="historical"
+                if ( [ $ifs_cmip_fixyear -le 0 ] && [ $yr -ge 2015 ] ) || \
+                     [ $ifs_cmip_fixyear -ge 2015 ]
+                then
+                    [[ ${ifs_cmip6_scenario} =~ ^SSP ]] \
+                        && icmcl_scenario=${ifs_cmip6_scenario} \
+                        || if [ ${ifs_covid19^^}  == TRUE ]
+                           then
+                               icmcl_scenario='SSP2-4.5'
+                           else
+                               icmcl_scenario='SSP3-7.0'
+                           fi
+                fi ;;
+            esac
+            
+            if [ $ifs_cmip_fixyear -le 0 ] || [[ ${ifs_veg_source} == custom_* ]]
+            then
+                cat ${ini_data_dir}/ifs/${ifs_grid}/icmcl_${veg_version}/${icmcl_scenario}/icmcl_$yr.grb >> ICMCL${exp_name}INIT
+            else
+                # Fixed year forcing, requires cdo! (only when not using ifs_veg_source=custom_exp*)
+                # If cdo is not available at runtime you need to fix proper
+                # icmcl files beforehand and use them here
+                cdo setyear,$yr ${ini_data_dir}/ifs/${ifs_grid}/icmcl_${veg_version}/${icmcl_scenario}/icmcl_${ifs_cmip_fixyear}.grb ${tempfile}
+                cat ${tempfile} >> ICMCL${exp_name}INIT
+            fi
+        done
+        ;;
+    "none" )
+        info "no ICMCL file is created"
+        ;;
+    * )
+        error "Vegetation from ${ifs_veg_source} not implemented"
+        ;;
+    esac
+
+    # Clean up
+    rm -f ${tempfile}
+
+    # -------------------------------------------------------------------------
+    # *** Link the appropriate NEMO restart files of the previous leg
+    # -------------------------------------------------------------------------
+    if $leg_is_restart && $(has_config nemo) && ! $special_restart
+    then
+        ns=$(printf %08d $(( leg_start_sec / nem_time_step_sec - nem_restart_offset )))
+        for (( n=0 ; n<nem_numproc ; n++ ))
+        do
+            np=$(printf %04d ${n})
+            ln -fs ${exp_name}_${ns}_restart_oce_${np}.nc restart_oce_${np}.nc
+            ln -fs ${exp_name}_${ns}_restart_ice_${np}.nc restart_ice_${np}.nc
+            has_config pisces && \
+                ln -fs ${exp_name}_${ns}_restart_trc_${np}.nc restart_trc_${np}.nc
+        done
+
+        # Make sure there are no global restart files
+        # If links are found, they will be removed. We are cautious and do
+        # _not_ remove real files! However, if real global restart files are
+        # present, NEMO/LIM will stop because time stamps will not match.
+        [ -h restart_oce.nc ] && rm restart_oce.nc
+        [ -h restart_ice.nc ] && rm restart_ice.nc
+        [ -h restart_trc.nc ] && rm restart_trc.nc
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Remove some OASIS files of the previous leg
+    # -------------------------------------------------------------------------
+    if $leg_is_restart
+    then
+        rm -f anaisout_*
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Remove any ccycle debug output files
+    # -------------------------------------------------------------------------
+    if ${ccycle_debug_fluxes} && $leg_is_restart && $(has_config tm5:co2)
+    then
+      if $(has_config lpjg)
+      then
+          rm -f GUE_{CNAT,CANT,CNPP}_*.nc run1/GUE_{CNAT,CANT,CNPP}_*.nc
+          rm -f TM5_Land{CNAT,CANT,CNPP}_*.nc
+      fi
+      if $(has_config pisces)
+      then
+          rm -f O_CO2FLX_*.nc
+          rm -f TM5_OceCFLX_*.nc
+      fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Check consistency of OASIS restarts and IFS rcf with ece_info_file
+    # -------------------------------------------------------------------------
+    if $leg_is_restart
+    then
+        info "Check OASIS restarts and IFS rcf before launch"
+        leg_nb_3d=$(printf %03d $((leg_number)))
+
+        for oasis_restart_file in restart/oasis/${leg_nb_3d}/*
+        do
+            [ ! -f "${oasis_restart_file}" ] && break
+
+            if ! diff -q $(basename ${oasis_restart_file}) ${oasis_restart_file} >/dev/null
+            then
+                echo "*WARNING* Overwriting OASIS restart (${oasis_restart_file})"
+                cp -f ${oasis_restart_file} .
+            fi
+        done
+
+        rcf_restart_file=restart/ifs/${leg_nb_3d}/rcf
+        if [ -f "${rcf_restart_file}" ]
+        then
+            if ! diff -q rcf ${rcf_restart_file} >/dev/null
+            then
+                echo "*WARNING* Overwriting IFS rcf file (${rcf_restart_file})"
+                cp -f ${rcf_restart_file} .
+            fi
+        fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Start the run
+    # -------------------------------------------------------------------------
+    export DR_HOOK_IGNORE_SIGNALS='-1'
+    export CPLNG='active'
+
+    # Use the launch function from the platform configuration file
+    has_config nemo && \
+        cmd="${xio_numproc} ${xio_exe_file} -- \
+             ${nem_numproc} ${nem_exe_file} -- \
+             ${ifs_numproc} ${ifs_exe_file} -v ecmwf -e ${exp_name}" || \
+        cmd="${ifs_numproc} ${ifs_exe_file} -v ecmwf -e ${exp_name}"
+
+    has_config lpjg && cmd=${cmd}" -- ${lpjg_numproc} ${lpjg_exe_file} guess.ins -parallel"
+    has_config tm5  && cmd=${cmd}" -- ${tm5_numproc}  ${tm5_exe_file} tm5-run.rc"
+    has_config amip && cmd=${cmd}" -- ${amip_numproc} ${amip_exe_file}"
+    has_config nemo && cmd=${cmd}" -- ${rnf_numproc} ${rnf_exe_file}" 
+
+    t1=$(date +%s)
+    launch $cmd
+    t2=$(date +%s)
+
+    tr=$(date -d "0 -$t1 sec + $t2 sec" +%T)
+
+    # -------------------------------------------------------------------------
+    # *** Check for signs of success
+    #     Note the tests provide no guarantee that things went fine! They are
+    #     just based on the IFS, NEMO and TM5 log files. More tests (e.g. checking
+    #     restart files) could be implemented.
+    # -------------------------------------------------------------------------
+
+    # Checking for IFS success
+    if [ -f ifs.stat ]
+    then
+        if [ "$(awk 'END{print $3}' ifs.stat)" == "CNT0" ]
+        then
+            info "Leg successfully completed according to IFS log file 'ifs.stat'."
+        else
+            error "Leg not completed according to IFS log file 'ifs.stat'."
+        fi
+    else
+        error "IFS log file 'ifs.stat' not found after run."
+    fi
+
+    # Check for NEMO success
+    if $(has_config nemo)
+    then
+        if [ -f ocean.output ]
+        then
+            if [ "$(sed -n '/New day/h; ${g;s:.*\([0-9/]\{10\}\).*:\1:;p;}' ocean.output)" == "$(date -u -d "${leg_end_date} - 1 day" +%Y/%m/%d)" ]
+            then
+                info "Leg successfully completed according to NEMO log file 'ocean.output'."
+            else
+                error "Leg not completed according to NEMO log file 'ocean.output'."
+            fi
+        else
+            error "NEMO log file 'ocean.output' not found after run."
+        fi
+    fi
+
+    # Check for TM5 success
+    if $(has_config tm5)
+    then
+        if [ -f tm5.ok ]
+        then
+            info "Leg successfully completed according to existing TM5 file 'tm5.ok'."
+        else
+            error "Leg not completed according to non-existing TM5 file 'tm5.ok'."
+        fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Post-process initial conditions saved during the run if requested
+    # -------------------------------------------------------------------------
+    ${do_save_ic} && save_ic_postproc
+
+    # -------------------------------------------------------------------------
+    # *** Move IFS output files to archive directory
+    # -------------------------------------------------------------------------
+    outdir="${archive_dir}/output/ifs/$(printf %03d $((leg_number)))"
+    mkdir -p ${outdir}
+
+    prv_leg=$(printf %03d $((leg_number-1)))
+
+    # This takes care of a special IFS feature: The output for the last time
+    # step of each leg is written at the first time step of the new leg. The
+    # following code makes sure that the output is appended to the appropriate
+    # file. Since GRIB files are just streams, its done with a simple cat
+    # command.
+    for f in ICMSH${exp_name}+?????? ICMGG${exp_name}+??????
+    do
+        if [ -f output/ifs/${prv_leg}/${f} ]
+        then
+            cat ${f} >> output/ifs/${prv_leg}/${f}
+            rm -f ${f}
+        else
+            mv ${f} ${outdir}
+        fi
+    done
+
+    # -------------------------------------------------------------------------
+    # *** Move NEMO output files to archive directory
+    # -------------------------------------------------------------------------
+    if $(has_config nemo)
+    then
+        outdir="${archive_dir}/output/nemo/$(printf %03d $((leg_number)))"
+        mkdir -p ${outdir}
+
+        for v in grid_U grid_V grid_W grid_T icemod SBC scalar SBC_scalar diad_T ptrc_T bioscalar \
+                 grid_T_2D grid_U_2D grid_V_2D grid_W_2D grid_T_3D grid_U_3D grid_V_3D grid_W_3D \
+                 grid_T_SFC grid_1point grid_T_3D_ncatice vert_sum \
+                 grid_ptr_W_3basin_3D grid_ptr_T_3basin_2D grid_ptr_T_2D \
+                 zoom_700_sum zoom_300_sum zoom_2000_sum
+        do
+            for f in ${exp_name}_*_????????_????????_*${v}.nc
+            do
+                test -f $f && mv $f $outdir/
+            done
+        done
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move LPJ-GUESS output files to archive directory
+    # -------------------------------------------------------------------------
+    if $(has_config lpjg)
+    then
+        outdir="output/lpjg/$(printf %03d $((leg_number)))"
+        if [ -d ${outdir} ]
+        then
+            rm -rf  ${outdir}
+        fi
+        mkdir -p ${outdir}
+
+        # LPJG run directories
+        # concatenate *.out (or compressed *.out.gz) files from each run* into output dir
+        flist=$(cd ${run_dir}/run1/output && find *.out.gz -type f 2>/dev/null || true)
+        if [ "$flist" = "" ]
+        then
+            lpjg_compress_output=false
+            flist=$(cd ${run_dir}/run1/output && find *.out -type f 2>/dev/null)
+        else
+            lpjg_compress_output=true
+        fi
+
+        mkdir ${outdir}/CMIP6
+
+        for (( n=1; n<=${lpjg_numproc}; n++ ))
+        do
+            for ofile in $flist
+            do
+                if $lpjg_compress_output
+                then
+                    [ $n == 1 ] && gzip -c ${run_dir}/run${n}/output/`basename ${ofile} .gz`.hdr > ${outdir}/$ofile
+                    cat ${run_dir}/run${n}/output/${ofile} >> ${outdir}/$ofile
+                else
+                    if (( n == 1 ))
+                    then
+                        cat ${run_dir}/run${n}/output/${ofile} > ${outdir}/$ofile
+                    else
+                        awk '(FNR!=1){print $0}' ${run_dir}/run${n}/output/${ofile} >> ${outdir}/$ofile
+                    fi
+                fi
+            done
+            rm -rf ${run_dir}/run${n}/output
+        done
+        
+        # move monthly file if available
+        if [ -f ${run_dir}/LPJ-GUESS_monthlyoutput.txt ]
+        then
+            mv ${run_dir}/LPJ-GUESS_monthlyoutput.txt ${outdir}
+        fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move TM5 output files to archive directory
+    # -------------------------------------------------------------------------
+    if $(has_config tm5)
+    then
+        outdir="output/tm5/$(printf %03d $((leg_number)))"
+        mkdir -p ${outdir}
+
+        set +e
+        mv budget_??????????_??????????_global.hdf      ${outdir}
+        mv j_statistics_??????????_??????????.hdf       ${outdir}
+        mv mmix_??????????_??????????_glb???x???.hdf    ${outdir}
+        mv aerocom?_TM5_*_????????_daily.nc             ${outdir}
+        mv aerocom?_TM5_*_??????_monthly.nc             ${outdir}
+        mv AOD_????_??_??.nc                            ${outdir}
+        mv -f TM5MP_${exp_name}_griddef.nc              ${outdir}
+        mv TM5MP_${exp_name}_TP_????_??_??.nc           ${outdir}
+        mv TM5MP_${exp_name}_vmr3_????_??_??.nc         ${outdir}
+        mv general_TM5_${exp_name}_??????????_hourly.nc ${outdir}
+        mv general_TM5_${exp_name}_??????_monthly.nc    ${outdir}
+        mv *EC-Earth3-*_${exp_name}_*.nc                ${outdir}
+        set -e
+
+        # move profiling files if any
+        if [ "$(ls -A ${run_dir}/tm5_profile)" ]
+        then
+            outdir="output/tm5/profile_$(printf %03d $((leg_number)))"
+            mkdir -p ${outdir}
+
+            for f in ${run_dir}/tm5_profile/*
+            do
+                test -f ${f} && mv $f ${outdir}
+            done
+        fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move IFS restart files to archive directory
+    # -------------------------------------------------------------------------
+    if $leg_is_restart
+    then
+        outdir="${archive_dir}/restart/ifs/$(printf %03d $((leg_number)))"
+        mkdir -p ${outdir}
+
+        # Figure out the time part of the restart files (cf. CTIME on rcf files)
+        # NOTE: Assuming that restarts are at full days (time=0000) only!
+        nd="$(printf %06d $((leg_start_sec/(24*3600))))0000"
+
+        mv srf${nd}.???? ${outdir}
+
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move ccycle debug output files to archive directory
+    # -------------------------------------------------------------------------
+    if ${ccycle_debug_fluxes} && $(has_config tm5:co2)
+    then
+      outdir="output/tm5/$(printf %03d $((leg_number)))"
+      mkdir -p ${outdir}
+      if $(has_config lpjg)
+      then
+          for f in CNAT CANT CNPP ; do
+              mv TM5_Land${f}_*.nc ${outdir}
+              rm -f GUE_${f}_*.nc run1/GUE_${f}_*.nc
+              #gf=`ls -1 GUE_${f}_*.nc | head -n 1`
+              #cdo mergetime ${gf} run1/${gf} ${outdir}/${gf}
+          done
+      fi
+      if $(has_config pisces)
+      then
+          mv TM5_OceCFLX_*.nc ${outdir}
+          rm -f O_CO2FLX_*.nc
+          #mv O_CO2FLX_*.nc ${outdir}
+      fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move LPJ-GUESS restart files to archive directory
+    # -------------------------------------------------------------------------
+    if $(has_config lpjg)
+    then
+        outdir="restart/lpjg/$(printf %03d $((leg_number)))"
+        if [ -d ${outdir} ]
+        then
+            rm -rf  ${outdir}
+        fi
+        mkdir -p ${outdir}
+
+        state_dir="./lpjg_state_$(printf %04d $((leg_end_date_yyyy)))"
+        mv ${state_dir} ${outdir}
+        # LPJG writes into run1 dir, so mv to main rundir
+        mv -f run1/lpjgv.nc .
+        has_config tm5:co2 lpjg && mv -f run1/rlpjg.nc .
+
+        # remove restart link
+        if $leg_is_restart
+        then
+            old_state_dir="./lpjg_state_$(printf %04d $((leg_start_date_yyyy)))"
+            if [ -L $old_state_dir ]
+            then
+                rm -f "$old_state_dir"
+            fi
+        fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move NEMO restart files to archive directory
+    # -------------------------------------------------------------------------
+    if $leg_is_restart && $(has_config nemo)
+    then
+        outdir="${archive_dir}/restart/nemo/$(printf %03d $((leg_number)))"
+        mkdir -p ${outdir}
+
+        ns=$(printf %08d $(( leg_start_sec / nem_time_step_sec - nem_restart_offset )))
+        for f in oce ice
+        do
+            mv ${exp_name}_${ns}_restart_${f}_????.nc ${outdir}
+        done
+
+        if has_config pisces
+        then
+            mv ${exp_name}_${ns}_restart_trc_????.nc ${outdir}
+        fi
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Move TM5 restart file to archive directory
+    # -------------------------------------------------------------------------
+    if $leg_is_restart && $(has_config tm5)
+    then
+        outdir="restart/tm5/$(printf %03d $((leg_number)))"
+        mkdir -p ${outdir}
+
+        case ${tm5_istart} in
+            33|32) f=TM5_restart_${leg_start_date_yyyymmdd}_0000_glb300x200.nc
+                ;;
+            31) f=save_${leg_start_date_yyyymmdd}00_glb300x200.hdf
+                ;;
+        esac
+
+        mv $f ${outdir}
+    fi
+
+    # -------------------------------------------------------------------------
+    # *** Copy OASIS restart files to archive directory
+    #     NOTE: These files are copied and not moved as they are used in the
+    #           next leg!
+    #           Note also that the OASIS restart files present at the end of
+    #           the leg correspond to the start of the next leg!
+    # -------------------------------------------------------------------------
+    outdir="${archive_dir}/restart/oasis/$(printf %03d $((leg_number+1)))"
+    mkdir -p ${outdir}
+
+    for f in ${oas_rst_files}
+    do
+        test -f ${f} && cp ${f} ${outdir}
+    done
+
+    # -------------------------------------------------------------------------
+    # *** Copy rcf files to the archive directory (of the next leg!)
+    # -------------------------------------------------------------------------
+    outdir="${archive_dir}/restart/ifs/$(printf %03d $((leg_number+1)))"
+    mkdir -p ${outdir}
+
+    for f in rcf
+    do
+        test -f ${f} && cp ${f} ${outdir}
+    done
+
+    # -------------------------------------------------------------------------
+    # *** Move log files to archive directory
+    # -------------------------------------------------------------------------
+    outdir="${archive_dir}/log/$(printf %03d $((leg_number)))"
+    mkdir -p ${outdir}
+
+    for f in \
+        ifs.log ifs.stat fort.4 ocean.output \
+        time.step solver.stat guess.log run1/guess0.log \
+        amip.log namelist.amip \
+        nout.000000 debug.root.?? \
+        ctm.tm5.log.0
+    do
+        test -f ${f} && mv ${f} ${outdir}
+    done
+    has_config pisces && cp ocean.carbon ${outdir}
+
+    for f in ctm.tm5.log.*
+    do
+        if [[ -f ${f} ]]
+        then
+            [[ -s ${f} ]] && mv ${f} ${outdir} || \rm -f ${f}
+        fi
+    done
+
+    # -------------------------------------------------------------------------
+    # *** Write the restart control file
+    # -------------------------------------------------------------------------
+
+    # Compute CPMIP performance
+    sypd="$(cpmip_sypd $leg_length_sec $(($t2 - $t1)))"
+    ncores=0
+    has_config nemo      && (( ncores+=${nem_numproc}  )) || :
+    has_config ifs       && (( ncores+=${ifs_numproc}  )) || :
+    has_config xios      && (( ncores+=${xio_numproc}  )) || :
+    has_config rnfmapper && (( ncores+=${rnf_numproc}  )) || :
+    has_config lpjg      && (( ncores+=${lpjg_numproc} )) || :
+    has_config tm5       && (( ncores+=${tm5_numproc}  )) || :
+    has_config amip      && (( ncores+=${amip_numproc} )) || :
+    chpsy="$(cpmip_chpsy  $leg_length_sec $(($t2 - $t1)) $ncores)"
+
+    echo "#"                                             | tee -a ${ece_info_file}
+    echo "# Finished leg at `date '+%F %T'` after ${tr} (hh:mm:ss)" \
+                                                         | tee -a ${ece_info_file}
+    echo "# CPMIP performance: $sypd SYPD   $chpsy CHPSY"| tee -a ${ece_info_file}
+    echo "leg_number=${leg_number}"                      | tee -a ${ece_info_file}
+    echo "leg_start_date=\"${leg_start_date}\""          | tee -a ${ece_info_file}
+    echo "leg_end_date=\"${leg_end_date}\""              | tee -a ${ece_info_file}
+
+    # Need to reset force_run_from_scratch in order to avoid destroying the next leg
+    force_run_from_scratch=false
+    special_restart=false
+
+done # loop over legs
+
+# -----------------------------------------------------------------------------
+# *** Platform dependent finalising of the run
+# -----------------------------------------------------------------------------
+finalise
+
+exit 0

+ 24 - 0
3.3.3.2/runtime/classic/lemaitre3.sh.tmpl

@@ -0,0 +1,24 @@
+#!/bin/bash
+# Submission script for Lemaitre3
+#SBATCH --job-name=ece3
+#SBATCH --time=23:50:00
+#
+#SBATCH --ntasks=144
+#SBATCH --mem-per-cpu=3072
+#
+##SBATCH --mail-user=noname@uclouvain.be
+#SBATCH --mail-type=ALL
+#SBATCH --open-mode=append
+#SBATCH --switches=1@47:50:00
+set -ueo pipefail
+
+exec > ${SLURM_SUBMIT_DIR-$PWD}/${SLURM_JOB_NAME-"local"}_${SLURM_JOB_ID-"id"}.log
+echo "------------------ Job Info --------------------"
+echo "jobid : ${SLURM_JOB_ID-"local"}"
+echo "jobname : ${SLURM_JOB_NAME-"local"}"
+echo "submit dir : ${SLURM_SUBMIT_DIR-"local"}"
+
+set -ue 
+
+# Directories
+start_dir=${SLURM_SUBMIT_DIR-$PWD}

+ 101 - 0
3.3.3.2/runtime/classic/platform/lemaitre3-intelmpi.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+    <Platform name="lemaitre3">
+        <Description>
+            HOST:        lemaitre3.cism.ucl.ac.be
+            ARCH:        linux_x86_64
+            CPU MODEL:   SkyLake
+            MAINTAINER:  Pierre-Yves Barriat [pierre-yves.barriat@uclouvain.be]
+        </Description>
+
+        <Translation name="LEMAITRE3_CFG">
+            <Description>Platform dependent configuration (lemaitre3)</Description>
+            <Template>platform/lemaitre3.cfg.tmpl</Template>
+            <Target>ecconf.cfg</Target>
+            <Properties></Properties>
+        </Translation>
+
+        <Parameter name="BUILD_ARCH">
+            <Description>Architecture used when building EC-Earth</Description>
+            <Type>STRING</Type>
+            <Value>ecconf</Value>
+        </Parameter>
+
+        <Parameter name="ECEARTH_SRC_DIR">
+            <Description>Base directory for EC-Earth sources</Description>
+            <Type>PATH</Type>
+            <Value>${HOME}/modeles/ecearth/ecearth_3.3.0/sources</Value>
+        </Parameter>
+
+        <Parameter name="RUN_DIR">
+            <Description>EC-Earth run directory</Description>
+            <Type>PATH</Type>
+            <Value>/CECI/trsf/${USER}/run/ecearth/${exp_name}</Value>
+        </Parameter>
+
+        <Parameter name="INI_DATA_DIR">
+            <Description>Initial data directory used by EC-Earth</Description>
+            <Type>PATH</Type>
+            <Value>/scratch/ucl/elic/pbarriat/DATA/EC-EARTH</Value>
+        </Parameter>
+
+        <Parameter name="PROC_PER_NODE">
+            <Description>Number of processors per node</Description>
+            <Type>INTEGER</Type>
+            <Value>24</Value>
+        </Parameter>
+
+        <Parameter name="RESUBMIT_JOB">
+            <Description>Automatically resubmit the job? [true|false]</Description>
+            <Type>BOOLEAN</Type>
+            <Value>true</Value>
+        </Parameter>
+
+        <Parameter name="RESUBMIT_OPT">
+            <Description>Additional options for the submit command</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_BASE_DIR">
+            <Description>GRIB API base directory</Description>
+            <Type>PATH</Type>
+            <Value>${EBROOTGRIB_API}</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_BIN_SUBDIR">
+            <Description>GRIB API bin directory relative to the base directory</Description>
+            <Type>PATH</Type>
+            <Value>bin</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_DEFINITION_SUBDIR">
+            <Description>GRIB API definition directory relative to the base directory</Description>
+            <Type>PATH</Type>
+            <Value>share/grib_api/definitions</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_SAMPLES_SUBDIR">
+            <Description>GRIB API samples directory relative to the base directory</Description>
+            <Type>PATH</Type>
+            <Value>share/grib_api/ifs_samples/grib1</Value>
+        </Parameter>
+
+        <Parameter name="ADD_TO_LD_LIBRARY_PATH">
+            <Description>Additional shared library paths needed at runtime</Description>
+            <Type>STRING</Type>
+            <Value></Value>
+        </Parameter>
+
+        <Parameter name="PRE_LOAD_MODULES_CMD">
+            <Description>Command run before any modules are loaded</Description>
+            <Type>STRING</Type>
+            <Value>module purge</Value>
+        </Parameter>
+
+        <Parameter name="MODULE_LIST">
+            <Description>List of modules to load</Description>
+            <Type>STRING</Type>
+            <Value>2016a netCDF-Fortran/4.4.4-intel-2016a grib_api/1.16.0-intel-2016a openjpeg/1.5.2-intel-2016a</Value>
+        </Parameter>
+
+    </Platform>

+ 146 - 0
3.3.3.2/runtime/classic/platform/lemaitre3.cfg.tmpl

@@ -0,0 +1,146 @@
+# Platform dependent configuration functions for the 'lemaitre3' machine
+#(lemaitre3.cism.ucl.ac.be)
+
+function configure()
+{
+    # This function should configure all settings/modules needed to
+    # later prepare the EC-Earth run directory and set variables used
+    # in the run script
+
+
+    # Configure paths for building/running EC-Earth
+    ecearth_src_dir=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]
+    run_dir=[[[PLT:ACTIVE:RUN_DIR]]]
+    ini_data_dir=[[[PLT:ACTIVE:INI_DATA_DIR]]]
+    archive_dir=/scratch/ucl/elic/${USER}/ecearth/archive/${exp_name}
+
+    # File for standard output.
+    # NOTE: This will be modified for restart jobs!
+    stdout_file=${SLURM_SUBMIT_DIR-$PWD}/${SLURM_JOB_NAME-"local"}_${SLURM_JOB_ID-"id"}.log
+
+    # Resubmit this job for automatic restarts? [true/false]
+    # Also, add options for the resubmit command here.
+    resubmit_job=[[[PLT:ACTIVE:RESUBMIT_JOB]]]
+    resubmit_opt="[[[PLT:ACTIVE:RESUBMIT_OPT]]]"
+
+    # Configure number of processors per node
+    proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
+
+    # Configure and load modules
+    pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
+    module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
+
+    if [ -n "${pre_load_modules_cmd}" ]
+    then
+        ${pre_load_modules_cmd}
+    fi
+    if [ -n "${module_list}" ]
+    then
+        module load ${module_list}
+    fi
+
+    # Configure grib api paths
+    export GRIB_DEFINITION_PATH=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/util/grib_table_126:[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_DEFINITION_SUBDIR]]]
+    export GRIB_SAMPLES_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_SAMPLES_SUBDIR]]]
+    export GRIB_BIN_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_BIN_SUBDIR]]]
+
+    # Add directories to the shared library search path
+    if [ -n "[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]" ]
+    then
+        export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
+    fi
+}
+
+function launch()
+{
+    # Compute and check the node distribution
+    info "======================="
+    info "Node/proc distribution:"
+    info "-----------------------"
+    info "IFS:   ${ifs_numproc}"
+    info "NEMO:  ${nem_numproc}"
+    info "XIOS:  ${xio_numproc}"
+    info "======================="
+
+    cmd="mpirun"
+
+    while (( "$#" ))
+    do
+        nranks=$1
+        executable=./$(basename $2)
+        shift
+        shift
+
+        cmd+=" -n $nranks $executable"
+
+        while (( "$#" )) && [ "$1" != "--" ]
+        do
+            cmd+=" $1"
+            shift
+        done
+        shift || true
+
+        (( "$#" )) && cmd+=" :"
+    done
+
+    #export OMP_NUM_THREADS=1
+    pwd
+    echo $cmd
+    #exit
+    $cmd
+}
+
+function finalise2()
+{
+    # This function should execute of any post run functionality, e.g.
+    # platform dependent cleaning or a resubmit
+
+    if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
+    then
+        info "Resubmitting job for leg $((leg_number+1))"
+        # Need to go to start_dir to find the run script
+        cd ${SLURM_SUBMIT_DIR}  # same as $start_dir
+
+        cp ./${SLURM_JOB_NAME} ./$(basename ${SLURM_JOB_NAME}).$$
+     
+        sed "s:force_run_from_scratch=true:force_run_from_scratch=false:" \
+            <./$(basename ${SLURM_JOB_NAME}).$$ \
+            >./$(basename ${SLURM_JOB_NAME})
+
+        cp -f ./${SLURM_JOB_NAME} ./$(basename ${SLURM_JOB_NAME}).$$
+
+        sed "s:special_restart=true:special_restart=false:" \
+            <./$(basename ${SLURM_JOB_NAME}).$$ \
+            >./$(basename ${SLURM_JOB_NAME})
+
+        \rm -f ./${PBS_JOBNAME}.$$
+
+        # Submit command
+        set -x
+        qsub ./$(basename ${SLURM_JOB_NAME})
+        set +x
+    else
+        info "Not resubmitting."
+    fi
+}
+
+function finalise()
+{
+    # This function should execute of any post run functionality, e.g.
+    # platform dependent cleaning or a resubmit
+
+    if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
+    then
+        info "Resubmitting job for leg $((leg_number+1))"
+        # Need to go to start_dir to find the run script
+        cd ${start_dir}
+        # Submit command
+        # Note: This does not work if you specify a job name with sbatch -J jobname!
+        sbatch -N ${SLURM_JOB_NUM_NODES}                                                 \
+               -o ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
+               -e ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
+               -d ${SLURM_JOB_ID}                                                        \
+               ${resubmit_opt}                                                           \
+               ./${SLURM_JOB_NAME}
+    fi
+}

+ 109 - 0
3.3.3.2/runtime/classic/platform/zenobe-intelmpi.xml

@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+    <Platform name="zenobe">
+        <Description>
+            HOST:        zenobe.hpc.cenaero.be
+            ARCH:        linux_x86_64
+            CPU MODEL:   Ivy Bridge
+            MAINTAINER:  Pierre-Yves Barriat [pierre-yves.barriat@uclouvain.be]
+        </Description>
+
+        <Translation name="ZENOBE_CFG">
+            <Description>Platform dependent configuration (zenobe)</Description>
+            <Template>../classic/platform/zenobe.cfg.tmpl</Template>
+            <Target>ecconf.cfg</Target>
+            <Properties></Properties>
+        </Translation>
+
+        <Parameter name="BUILD_ARCH">
+            <Description>Architecture used when building EC-Earth</Description>
+            <Type>STRING</Type>
+            <Value>ecconf</Value>
+        </Parameter>
+
+        <Parameter name="ECEARTH_SRC_DIR">
+            <Description>Base directory for EC-Earth sources</Description>
+            <Type>PATH</Type>
+            <Value>${HOME}/modeles/ecearth/ecearth_3.3.3.2/sources</Value>
+        </Parameter>
+
+        <Parameter name="RUN_DIR">
+            <Description>EC-Earth run directory</Description>
+            <Type>PATH</Type>
+            <Value>/SCRATCH/acad/ecearth/${USER}/run/${exp_name}</Value>
+        </Parameter>
+
+        <Parameter name="INI_DATA_DIR">
+            <Description>Initial data directory used by EC-Earth</Description>
+            <Type>PATH</Type>
+            <Value>/SCRATCH/acad/ecearth/DATA/v3.3.3.2/inidata</Value>
+        </Parameter>
+
+        <Parameter name="PROC_PER_NODE">
+            <Description>Number of processors per node</Description>
+            <Type>INTEGER</Type>
+            <Value>24</Value>
+        </Parameter>
+
+        <Parameter name="RESUBMIT_JOB">
+            <Description>Automatically resubmit the job? [true|false]</Description>
+            <Type>BOOLEAN</Type>
+            <Value>false</Value>
+        </Parameter>
+
+        <Parameter name="RESUBMIT_OPT">
+            <Description>Additional options for the submit command</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_BASE_DIR">
+            <Description>GRIB API base directory</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/grib_api</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_BIN_SUBDIR">
+            <Description>GRIB API bin directory relative to the base directory</Description>
+            <Type>PATH</Type>
+            <Value>bin</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_DEFINITION_SUBDIR">
+            <Description>GRIB API definition directory relative to the base directory</Description>
+            <Type>PATH</Type>
+            <Value>share/definitions</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_SAMPLES_SUBDIR">
+            <Description>GRIB API samples directory relative to the base directory</Description>
+            <Type>PATH</Type>
+            <Value>share/ifs_samples/grib1</Value>
+        </Parameter>
+
+        <Parameter name="ADD_TO_LD_LIBRARY_PATH">
+            <Description>Additional shared library paths needed at runtime</Description>
+            <Type>STRING</Type>
+            <Value>/projects/acad/ecearth/opt/grib_api/lib:/projects/acad/ecearth/opt/openjpeg/lib:/projects/acad/ecearth/opt/netcdf/4.4.1.1_ivy_2016.2.181/lib</Value>
+        </Parameter>
+
+        <Parameter name="PRE_LOAD_MODULES_CMD">
+            <Description>Command run before any modules are loaded</Description>
+            <Type>STRING</Type>
+            <Value>module purge</Value>
+        </Parameter>
+
+        <Parameter name="MODULE_LIST">
+            <Description>List of modules to load</Description>
+            <Type>STRING</Type>
+            <Value>
+               compiler/intel/comp_and_lib/2016.2.181 intelmpi/5.1.3.181/64 hdf5/1.8.18-el6/intel_2016.2.181/intelmpi_5.1.3.181
+            </Value>
+        </Parameter>
+
+        <Parameter name="USE_MACHINEFILE">
+            <Description>Use MPI machinefiles to control process placement? [true|false]</Description>
+            <Type>BOOLEAN</Type>
+            <Value>%USE_MACHINEFILE%</Value>
+        </Parameter>
+
+    </Platform>

+ 313 - 0
3.3.3.2/runtime/classic/platform/zenobe.cfg.tmpl

@@ -0,0 +1,313 @@
+# Platform dependent configuration functions for the 'zenobe' machine
+#(zenobe.hpc.cenaero.be)
+
+function configure()
+{
+    # This function should configure all settings/modules needed to
+    # later prepare the EC-Earth run directory and set variables used
+    # in the run script
+
+    # SCRATCH is not defined in MN3, define it here
+    # and also make sure it is defined when compiling
+    export SCRATCH=/SCRATCH/acad/ecearth/${USER}
+
+    # Configure paths for building/running EC-Earth
+    ecearth_src_dir=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]
+    run_dir=[[[PLT:ACTIVE:RUN_DIR]]]
+    ini_data_dir=[[[PLT:ACTIVE:INI_DATA_DIR]]]
+    archive_dir=/SCRATCH/acad/ecearth/${USER}/archive/${exp_name}
+
+    # File for standard output.
+    # NOTE: This will be modified for restart jobs!
+    stdout_file=${PBS_O_WORKDIR-$PWD}/${PBS_JOBNAME-"local"}_${PBS_JOBID-"id"}.log
+
+    # Resubmit this job for automatic restarts? [true/false]
+    # Also, add options for the resubmit command here.
+    resubmit_job=[[[PLT:ACTIVE:RESUBMIT_JOB]]]
+    resubmit_opt="[[[PLT:ACTIVE:RESUBMIT_OPT]]]"
+
+    # Configure GRIBEX paths
+    export LOCAL_DEFINITION_TEMPLATES=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]
+    export ECMWF_LOCAL_TABLE_PATH=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]
+
+    # Configure grib api paths
+    export GRIB_DEFINITION_PATH=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/util/grib_table_126:[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_DEFINITION_SUBDIR]]]
+    export GRIB_SAMPLES_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_SAMPLES_SUBDIR]]]
+    export GRIB_BIN_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_BIN_SUBDIR]]]
+
+    # Configure number of processors per node
+    proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
+
+    # Configure and load modules
+    pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
+    module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
+
+    if [ -n "${pre_load_modules_cmd}" ]
+    then
+        ${pre_load_modules_cmd}
+    fi
+    if [ -n "${module_list}" ]
+    then
+        module load ${module_list}
+    fi
+
+    # Add directories to the shared library search path
+    if [ -n "[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]" ]
+    then
+        export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
+    fi
+
+    # Use machinefiles or not
+    [[ `echo "$use_machinefile" | tr '[:upper:]' '[:lower:]'` == true ]] && use_machinefile=true || use_machinefile=false
+
+    ulimit -s unlimited
+
+    # Load specific IMPI environment configuration
+    configure_impi
+}
+
+function configure_python()
+{
+    # specific for python+eccodes setup - used for OSM pre/post-processing
+    # it would be simple to do the following in configure
+    # module load eccodes/2.8.0 python/2.7.13
+    module load eccodes/2.8.0 python/2.7.13
+    unset GRIB_DEFINITION_PATH
+    unset GRIB_SAMPLES_PATH
+    unset GRIB_BIN_PATH
+    export GRIB_BIN_PATH=/apps/ECCODES/2.8.0/INTEL/bin
+}
+
+function configure_impi()
+{
+    [ -z "${OMP_NUM_THREADS-}" ] && export OMP_NUM_THREADS=1
+    export I_MPI_DEBUG=5
+}
+
+function get_hosts()
+{
+    # This function uses a scheduler command to get the hosts allocated for the current job
+    hosts=(`scontrol show hostname | paste -s`)
+}
+
+function machinefile_config()
+{
+    # User configuration starts here
+    # hard-coded c4mip configurations, must use the proper _numproc settings
+    if has_config ifs nemo pisces rnfmapper xios lpjg ; then
+      if ! has_config tm5 ; then
+            ifs_ppn=48 ; [[ ${ifs_numproc}  != 336 ]] && info "wrong numproc setting for ifs in machinefile_config" || true
+            nem_ppn=43 ; [[ ${nem_numproc}  != 380 ]] && info "wrong numproc setting for nemo in machinefile_config" || true
+            xio_ppn=5  ; [[ ${xio_numproc}  !=   5 ]] && info "wrong numproc setting for xios in machinefile_config" || true
+            lpjg_ppn=5 ; [[ ${lpjg_numproc} !=  40 ]] && info "wrong numproc setting for lpjg in machinefile_config" || true
+        else
+            ifs_ppn=48 ; [[ ${ifs_numproc}  != 256 ]] && info "wrong numproc setting for ifs in machinefile_config" || true
+            nem_ppn=46 ; [[ ${nem_numproc}  != 192 ]] && info "wrong numproc setting for nemo in machinefile_config" || true
+            xio_ppn=2  ; [[ ${xio_numproc}  !=   2 ]] && info "wrong numproc setting for xios in machinefile_config" || true
+            lpjg_ppn=2 ; [[ ${lpjg_numproc} !=   8 ]] && info "wrong numproc setting for lpjg in machinefile_config" || true
+            tm5_ppn=4  ; [[ ${tm5_numproc}  !=   4 ]] && info "wrong numproc setting for tm5 in machinefile_config" || true
+        fi
+      else
+        # Add any new exclusive binary here
+        ifs_exc=TRUE
+        nem_exc=TRUE
+        xio_exc=TRUE
+        lpjg_exc=TRUE
+        tm5_exc=TRUE
+
+        # Modify the allocation to each binary using more than one process here
+        ifs_ppn=48
+        nem_ppn=48
+        xio_ppn=48
+        lpjg_ppn=48
+        tm5_ppn=45
+    fi
+}
+
+function machinefile_init()
+{
+    # Get max processes per node from the platform variable
+    max_ppn=$proc_per_node
+
+    components=( ifs nem xio rnf amip lpjg )
+    if $(has_config tm5)
+    then
+      components=( "${components[@]}" "tm5" )
+    fi
+    
+    for component in ${components[@]}
+    do
+      eval ${component}_exc=FALSE
+      eval ${component}_ppn=1
+    done
+  
+    # Call user configuration and get_host functions
+    machinefile_config
+    get_hosts
+ 
+    # Declare array to store the processes as they are assigned
+    declare -a -g processes_hosts
+    for n in `seq 0 ${#hosts[@]}`
+    do
+      processes_hosts[$n]=0
+    done
+
+    > machinefile
+    
+    current_hostid=0
+}
+
+machinefile_find_available_node()
+{
+  while [ $((${processes_hosts[$current_hostid]} + ${!ppn})) -gt $max_ppn ]
+  do
+    let "current_hostid += 1"
+  done
+}
+
+machinefile_add()
+{
+  total_proc=$2
+  # Iterate through all the possible binaries
+  for component in ${components[@]} 
+  do
+    binary="${component}_exe_file"
+    exclusive="${component}_exc"
+    # Check if the current binary matches the input executable
+    if [ ./$(basename ${!binary}) = "$1" ]
+    then
+       ppn="${component}_ppn"
+       # Exclusive mode: start allocation at the first empty node
+       if [[ ${!exclusive} == "TRUE" ]]
+       then
+         while [ ${processes_hosts[$current_hostid]} -gt 0 ]
+         do
+           let "current_hostid += 1"
+         done
+       # Shared mode: start allocation in the first node with enough free cores
+       # Notice that only the first node is checked
+       # Then, if a previous binary had "exc=TRUE", allocation space is not ensure in subsequent nodes
+       else
+         current_hostid=0
+         machinefile_find_available_node
+       fi
+
+       # Allocate ppn cores in each of the subsequent nodes till there are no more processes to assign
+       count=0
+       while [ ${total_proc} -gt 0 ]
+       do
+         if [ ${current_hostid} -ge ${#hosts[@]} ]
+         then
+           echo "Not enough computing nodes"
+           exit 1
+         fi
+         current_hostname=${hosts[$current_hostid]}
+         while [[ ${total_proc} -gt 0 && ${count} -lt ${!ppn} ]] 
+         do 
+           echo ${hosts[$current_hostid]} >> machinefile
+           let "count += 1"
+           let "processes_hosts[$current_hostid] += 1"
+           let "total_proc -= 1" || true 
+         done 
+         if [ ${count} -eq ${!ppn} ]
+         then
+           let "current_hostid += 1"
+           machinefile_find_available_node
+           count=0
+         fi
+       done
+    fi
+  done
+}
+
+function launch()
+{
+
+    cmd="mpirun"
+
+    if [ "$use_machinefile" = "true" ]
+    then
+      cmd="mpirun -machinefile machinefile"
+      machinefile_init
+    fi
+
+    while (( "$#" ))
+    do
+        # Get number of MPI ranks and executable name
+        nranks=$1
+        executable=./$(basename $2)
+        
+        if [ "$use_machinefile" = "true" ]
+        then
+          machinefile_add $executable $nranks
+        fi
+
+        shift
+        shift
+
+        cmd+=" -np $nranks $executable"
+
+        # Add any arguments to executable
+        while (( "$#" )) && [ "$1" != "--" ]
+        do
+            cmd+=" $1"
+            shift
+        done
+        shift || true
+
+        # Add colon of more executables follow
+        (( "$#" )) && cmd+=" :"
+    done
+
+    #export OMP_NUM_THREADS=1
+    #export OMP_NUM_THREADS=1
+    #export I_MPI_ADJUST_BCAST=3
+    #export PSM2_MTU=8196
+    #export PSM2_MEMORY=large
+    #export PSM2_MQ_RNDV_HFI_THRESH=1
+    #export I_MPI_DEBUG=5
+    #export I_MPI_FABRIC=tmi
+    pwd
+    echo $cmd
+    #exit
+    $cmd
+}
+
+function finalise()
+{
+    # This function should execute of any post run functionality, e.g.
+    # platform dependent cleaning or a resubmit
+
+    if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
+    then
+        info "Resubmitting job for leg $((leg_number+1))"
+
+        # go to submit dir
+        cd ${PBS_O_WORKDIR}  # same as ${start_dir}
+
+        # So use sed instead 
+        log=$(basename ${stdout_file}).$(printf %03d $((leg_number+1)))
+
+        cp ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
+     
+        sed "s:#PBS -o out/.*:#PBS -o out/${log}:" \
+            <./${PBS_JOBNAME}.$$ \
+            >./${PBS_JOBNAME}
+
+        cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
+
+        sed "s:special_restart=true:special_restart=false:" \
+            <./${PBS_JOBNAME}.$$ \
+            >./${PBS_JOBNAME}
+
+        \rm -f ./${PBS_JOBNAME}.$$
+
+        # Submit command
+        set -x
+        qsub ./${PBS_JOBNAME}
+        set +x
+    else
+        info "Not resubmitting."
+    fi
+
+}

+ 24 - 0
3.3.3.2/runtime/classic/zenobe.sh.tmpl

@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+#PBS -q large
+#PBS -r y
+#PBS -W group_list=ecearth
+#PBS -l walltime=23:50:00
+#PBS -l select=17:ncpus=24:mem=63000mb:mpiprocs=24:ompthreads=1
+#PBS -M noname@uclouvain.be
+#PBS -m abe
+
+exec > ${PBS_O_WORKDIR-$PWD}/${PBS_JOBNAME-"local"}_${PBS_JOBID-"id"}.log
+echo "------------------ Job Info --------------------"
+echo "jobid : $PBS_JOBID"
+echo "jobname : $PBS_JOBNAME"
+echo "job type : $PBS_ENVIRONMENT"
+echo "submit dir : $PBS_O_WORKDIR"
+echo "queue : $PBS_O_QUEUE"
+echo "user : $PBS_O_LOGNAME"
+echo "threads : $OMP_NUM_THREADS"
+
+set -ue
+
+# Directories
+start_dir=${PBS_O_WORKDIR-$PWD}

+ 4 - 0
3.3.3.2/sources/config-build.xml

@@ -0,0 +1,4 @@
+    <xi:include href="platform/zenobe-intelmpi.xml" />
+    <xi:include href="platform/lemaitre3-intelmpi.xml" />
+
+</Configuration>

+ 415 - 0
3.3.3.2/sources/lemaitre3-intelmpi.xml

@@ -0,0 +1,415 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <Platform name="lemaitre3-intelmpi">
+        <Description>
+            HOST:        lemaitre3.cism.ucl.ac.be
+            ARCH:        linux_x86_64
+            CPU MODEL:   Intel Skylake
+            MAINTAINER:  PY Barriat [pierre-yves.barriat@uclouvain.be]
+            COMPILER:    i-compilers (icc+ifort, 18.0.1.163)
+            MPI:         Intel MPI
+            BLAS/LAPACK: Intel MKL
+        </Description>
+
+        <Parameter name="ECEARTH_SRC_DIR">
+            <Description>Base directory for EC-Earth sources</Description>
+            <Type>PATH</Type>
+            <Value>${HOME}/modeles/ecearth/ecearth_3.3.0/sources</Value>
+        </Parameter>
+
+        <Parameter name="MPI_BASE_DIR">
+            <Description>MPI base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTIMPI)/intel64</Value>
+        </Parameter>
+
+        <Parameter name="MPI_INC_SUBDIR">
+            <Description>MPI include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="MPI_LIB_SUBDIR">
+            <Description>MPI lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="MPI_LIBS_WITHOUT_L">
+            <Description>MPI libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>mpi mpiif mpigf</Value>
+        </Parameter>
+
+        <Parameter name="LAPACK_BASE_DIR">
+            <Description>LAPACK base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTIMKL)/mkl</Value>
+        </Parameter>
+
+        <Parameter name="LAPACK_LIB_SUBDIR">
+            <Description>LAPACK lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib/intel64</Value>
+        </Parameter>
+
+        <Parameter name="LAPACK_LIBS_WITHOUT_L">
+            <Description>LAPACK libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>mkl_intel_lp64 mkl_core mkl_sequential</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_BASE_DIR">
+            <Description>NetCDF base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTNETCDF)</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_INC_SUBDIR">
+            <Description>NetCDF include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include $(EBROOTNETCDFMINFORTRAN)/include</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_LIB_SUBDIR">
+            <Description>NetCDF lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib64 $(EBROOTNETCDFMINFORTRAN)/lib</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_LIBS_WITHOUT_L">
+            <Description>NetCDF libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>netcdff netcdf</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_BASE_DIR">
+            <Description>GRIB API base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTGRIB_API)</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_INC_SUBDIR">
+            <Description>GRIB API include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_LIB_SUBDIR">
+            <Description>GRIB API lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_LIBS_WITHOUT_L">
+            <Description>GRIB_API libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>grib_api_f90 grib_api</Value>
+        </Parameter>
+
+        <Parameter name="GRIBEX_BASE_DIR">
+            <Description>GRIBEX base directory</Description>
+            <Type>PATH</Type>
+            <Value>/scratch/ucl/elic/pbarriat/DATA/OPT/gribex</Value>
+        </Parameter>
+
+        <Parameter name="GRIBEX_LIB_SUBDIR">
+            <Description>GRIBEX lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="GRIBEX_LIBS_WITHOUT_L">
+            <Description>GRIBEX libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>gribexR64</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_BASE_DIR">
+            <Description>JPEG base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTOPENJPEG)</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_INC_SUBDIR">
+            <Description>JPEG include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_LIB_SUBDIR">
+            <Description>JPEG lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_LIBS_WITHOUT_L">
+            <Description>JPEG libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>openjpeg</Value>
+        </Parameter>
+
+        <Parameter name="SZIP_BASE_DIR">
+            <Description>SZIP base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTSZIP)</Value>
+        </Parameter>
+
+        <Parameter name="SZIP_INC_SUBDIR">
+            <Description>SZIP include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="SZIP_LIB_SUBDIR">
+            <Description>SZIP lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="SZIP_LIBS_WITHOUT_L">
+            <Description>SZIP libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>sz</Value>
+        </Parameter>
+
+        <Parameter name="HDF4_BASE_DIR">
+            <Description>HDF4 base directory</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_INC_SUBDIR">
+            <Description>HDF4 include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_LIB_SUBDIR">
+            <Description>HDF4 lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_LIBS_WITHOUT_L">
+            <Description>HDF4 libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF5_BASE_DIR">
+            <Description>HDF5 base directory</Description>
+            <Type>PATH</Type>
+            <Value>$(EBROOTHDF5)</Value>
+        </Parameter>
+
+        <Parameter name="HDF5_INC_SUBDIR">
+            <Description>HDF5 include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="HDF5_LIB_SUBDIR">
+            <Description>HDF5 lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="HDF5_LIBS_WITHOUT_L">
+            <Description>HDF5 libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>hdf5_hl hdf5</Value>
+        </Parameter>
+
+        <Parameter name="MAKE">
+            <Description>Make command (GNU make min 3.81 needed!)</Description>
+            <Type>STRING</Type>
+            <Value>make</Value>
+        </Parameter>
+
+        <Parameter name="FC">
+            <Description>F90 Compiler</Description>
+            <Type>STRING</Type>
+            <Value>ifort</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS">
+            <Description>General F90 flags for compiling</Description>
+            <Type>STRING</Type>
+            <Value>-O2 -fp-model precise -xHost -r8</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS_FREEFORM">
+            <Description>Allow for free format Fortran</Description>
+            <Type>STRING</Type>
+            <Value>-free</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS_FIXEDFORM">
+            <Description>Expect fixed Fortran format</Description>
+            <Type>STRING</Type>
+            <Value>-fixed</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS_FPP_PREFIX">
+            <Description>Fortran preprocessor flag prefix</Description>
+            <Type>STRING</Type>
+            <Value>-D</Value>
+        </Parameter>
+
+        <Parameter name="CC">
+            <Description>C Compiler</Description>
+            <Type>STRING</Type>
+            <Value>icc</Value>
+        </Parameter>
+
+        <Parameter name="CXX">
+            <Description>C++ Compiler</Description>
+            <Type>STRING</Type>
+            <Value>icc</Value>
+        </Parameter>
+
+        <Parameter name="CFLAGS">
+            <Description>General C flags for compiling</Description>
+            <Type>STRING</Type>
+            <Value>-O2 -fp-model precise -xHost</Value>
+        </Parameter>
+
+        <Parameter name="CFLAGS_CPP_PREFIX">
+            <Description>C preprocessor flag prefix</Description>
+            <Type>STRING</Type>
+            <Value>-D</Value>
+        </Parameter>
+
+        <Parameter name="LD">
+            <Description>Linker</Description>
+            <Type>STRING</Type>
+            <Value>ifort</Value>
+        </Parameter>
+
+        <Parameter name="LDFLAGS">
+            <Description>General flags for linking</Description>
+            <Type>STRING</Type>
+            <Value>-O2 -fp-model precise -xHost</Value>
+        </Parameter>
+
+        <Parameter name="AR">
+            <Description>Command for building libraries from object files (usually ar)</Description>
+            <Type>STRING</Type>
+            <Value>ar</Value>
+        </Parameter>
+
+        <Parameter name="ARFLAGS">
+            <Description>Flags for library building command (When using ar: include u)</Description>
+            <Type>STRING</Type>
+            <Value>curv</Value>
+        </Parameter>
+
+        <Parameter name="ARFLAGS_EXTRACT">
+            <Description>Flags for library building command (When using ar: include u)</Description>
+            <Type>STRING</Type>
+            <Value>p</Value>
+        </Parameter>
+
+        <Parameter name="CPP">
+            <Description>C preprocessor command</Description>
+            <Type>STRING</Type>
+            <Value>cpp</Value>
+        </Parameter>
+
+        <Parameter name="FPP">
+            <Description>C preprocessor command</Description>
+            <Type>STRING</Type>
+            <Value>fpp</Value>
+        </Parameter>
+
+        <Parameter name="CPPFLAGS">
+            <Description>C preprocessor flags</Description>
+            <Type>STRING</Type>
+            <Value>-P -C</Value>
+        </Parameter>
+
+        <Parameter name="XIOS_CFLAGS">
+            <Description>CFLAGS flags for XIOS</Description>
+            <Type>STRING</Type>
+            <Value>-ansi -w</Value>
+        </Parameter>
+
+        <Parameter name="XIOS_ADD_LDFLAGS">
+            <Description>More LD flags for XIOS</Description>
+            <Type>STRING</Type>
+            <Value>-lstdc++</Value>
+        </Parameter>
+
+        <Parameter name="OASIS_ADD_FFLAGS">
+            <Description>More F90 flags for Oasis</Description>
+            <Type>STRING</Type>
+            <Value>-132 -check pointers -check uninit</Value>
+        </Parameter>
+
+        <Parameter name="OASIS_ADD_PPDEFS">
+            <Description>More CPP/FPP macros for Oasis</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="OASIS_ADD_LDFLAGS">
+            <Description>More LD flags for Oasis</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="NEMO_ADD_FFLAGS">
+            <Description>More F90 flags for Nemo</Description>
+            <Type>STRING</Type>
+            <Value>-check pointers -check uninit</Value>
+        </Parameter>
+
+        <Parameter name="NEMO_ADD_LDFLAGS">
+            <Description>More LD flags for Nemo</Description>
+            <Type>STRING</Type>
+            <Value>-lstdc++</Value>
+        </Parameter>
+
+        <Parameter name="IFS_PPDEFS">
+            <Description>Preprocessor defs for IFS sources</Description>
+            <Type>STRING</Type>
+            <Value>linux LINUX LITTLE LITTLE_ENDIAN POINTER_64 BLAS</Value>
+        </Parameter>
+
+        <Parameter name="IFSAUX_ADD_FFLAGS">
+            <Description>More F90 flags for ifs/ifsaux</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="TM5_DEFAULT_FFLAGS">
+            <Description>Default F90 flags for TM5 (ie without optimization)</Description>
+            <Type>STRING</Type>
+            <Value>-warn declarations -traceback -r8</Value>
+        </Parameter>
+
+        <Parameter name="TM5_OPTIM_FFLAGS">
+            <Description>F90 optimization flags for TM5</Description>
+            <Type>STRING</Type>
+            <Value>-O3 -fp-model strict -g</Value>
+        </Parameter>
+
+        <Parameter name="TM5_MDEFS_FFLAGS">
+            <Description>Model preprocessor defs. Set to with_ecearth_optics if aerosols feedback will be switch on.</Description>
+            <Type>STRING</Type>
+            <Value>with_ecearth_optics</Value>
+        </Parameter>
+
+        <Parameter name="TM5_CO2_ONLY">
+            <Description>Light version of TM5 (True or False)</Description>
+            <Type>STRING</Type>
+            <Value>False</Value>
+        </Parameter>
+
+        <Parameter name="MAKEDEPF90">
+            <Description>F90 dependency generator</Description>
+            <Type>STRING</Type>
+            <Value>$(ECEARTH_SRC_DIR)/util/makedepf90/bin/makedepf90</Value>
+        </Parameter>
+
+    </Platform>

+ 68 - 0
3.3.3.2/sources/nemo_lemaitre3_arch-ecconf.fcm.tmpl

@@ -0,0 +1,68 @@
+# EC-EARTH3 ec-conf-based configuration
+#
+# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
+# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
+# XIOS_HOME   root directory containing lib for XIOS
+# OASIS_HOME  root directory containing lib for OASIS
+#
+# NCDF_INC    netcdf4 include file
+# NCDF_LIB    netcdf4 library
+# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
+# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
+# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
+# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
+#
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make
+# USER_INC    complete list of include files
+# USER_LIB    complete list of libraries to pass to the linker
+#
+# Note that:
+#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
+#  - fcm variables are starting with a % (and not a $)
+
+%HDF5_HOME           [[[PLT:ACTIVE:HDF5_BASE_DIR]]]
+%HDF5_LIB            $(addprefix -L,$(addsuffix /,[[[PLT:ACTIVE:HDF5_BASE_DIR]]])[[[PLT:ACTIVE:HDF5_LIB_SUBDIR]]]) \
+                     $(addprefix -l,[[[PLT:ACTIVE:HDF5_LIBS_WITHOUT_L]]])
+
+%NCDF_INC            $(addprefix -I,$(addsuffix /,[[[PLT:ACTIVE:NETCDF_BASE_DIR]]])[[[PLT:ACTIVE:NETCDF_INC_SUBDIR]]])
+%NCDF_LIB            $(addprefix -L,$(addsuffix /,[[[PLT:ACTIVE:NETCDF_BASE_DIR]]])[[[PLT:ACTIVE:NETCDF_LIB_SUBDIR]]]) \
+                     $(addprefix -l,[[[PLT:ACTIVE:NETCDF_LIBS_WITHOUT_L]]])
+
+%MPI_INC             $(addprefix -I,[[[PLT:ACTIVE:MPI_BASE_DIR]]]/[[[PLT:ACTIVE:MPI_INC_SUBDIR]]])
+%MPI_LIB             $(addprefix -L,$(addsuffix /,[[[PLT:ACTIVE:MPI_BASE_DIR]]])[[[PLT:ACTIVE:MPI_LIB_SUBDIR]]]) \
+                     $(addprefix -l,[[[PLT:ACTIVE:MPI_LIBS_WITHOUT_L]]])
+
+%XIOS_HOME           [[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/xios-2
+%XIOS_INC            -I%XIOS_HOME/inc
+%XIOS_LIB            -L%XIOS_HOME/lib -lxios
+
+%OASIS_HOME          [[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/oasis3-mct/ecconf
+%OASIS_INC           -I%OASIS_HOME/build/lib/psmile.MPI1
+%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip
+
+%CPP                 [[[PLT:ACTIVE:FPP]]]
+
+%FC                  [[[PLT:ACTIVE:FC]]]
+%FCFLAGS             [[[PLT:ACTIVE:FFLAGS]]] [[[PLT:ACTIVE:NEMO_ADD_FFLAGS]]]
+%FFLAGS              %FCFLAGS
+
+%FPPFLAGS            [[[PLT:ACTIVE:CPPFLAGS]]]
+
+%LD                  [[[PLT:ACTIVE:LD]]]
+%LDFLAGS             [[[PLT:ACTIVE:LDFLAGS]]] [[[PLT:ACTIVE:NEMO_ADD_LDFLAGS]]]
+
+%AR                  [[[PLT:ACTIVE:AR]]]
+%ARFLAGS             [[[PLT:ACTIVE:ARFLAGS]]]
+
+%MK                  [[[PLT:ACTIVE:MAKE]]]
+
+%USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC %MPI_INC
+%USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB %MPI_LIB

+ 42 - 0
3.3.3.2/sources/runoff-mapper_lemaitre3_Makefile.tmpl

@@ -0,0 +1,42 @@
+executable = ../bin/runoff-mapper.exe
+
+FC      = [[[PLT:ACTIVE:FC]]]
+FFLAGS  = [[[PLT:ACTIVE:FFLAGS]]]
+
+LD      = [[[PLT:ACTIVE:LD]]]
+LDFLAGS = [[[PLT:ACTIVE:LDFLAGS]]]
+
+OASIS_BASE_DIR = [[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/oasis3-mct/ecconf
+OASIS_MOD_DIR  = $(OASIS_BASE_DIR)/build/lib/psmile.MPI1
+OASIS_INC_DIR  = $(OASIS_BASE_DIR)/lib/psmile/include
+OASIS_LIB_DIR  = $(OASIS_BASE_DIR)/lib
+OASIS_LIBS     = -lpsmile.MPI1 -lmct -lmpeu -lscrip
+
+MPI_LIB_DIR    = $(addsuffix /,[[[PLT:ACTIVE:MPI_BASE_DIR]]])[[[PLT:ACTIVE:MPI_LIB_SUBDIR]]]
+MPI_LIBS       = $(addprefix -l,[[[PLT:ACTIVE:MPI_LIBS_WITHOUT_L]]])
+
+NETCDF_INC_DIR = $(addprefix -I,$(addsuffix /,[[[PLT:ACTIVE:NETCDF_BASE_DIR]]])[[[PLT:ACTIVE:NETCDF_INC_SUBDIR]]])
+NETCDF_LIB_DIR = $(addprefix -L,$(addsuffix /,[[[PLT:ACTIVE:NETCDF_BASE_DIR]]])[[[PLT:ACTIVE:NETCDF_LIB_SUBDIR]]])
+NETCDF_LIBS    = $(addprefix -l,[[[PLT:ACTIVE:NETCDF_LIBS_WITHOUT_L]]])
+
+VPATH = cplng
+
+cplng_srcs = \
+    cplng_data_mod.F90 \
+    cplng_init_mod.F90 \
+    cplng_config_mod.F90 \
+    cplng_exchange_mod.F90 \
+    cplng_finalize_mod.F90 \
+    cplng_mod.F90
+
+rnfmap_srcs = runoff_mapper_mod.F90 runoff_mapper.F90
+
+$(executable): config_mod.o $(cplng_srcs:.F90=.o) $(rnfmap_srcs:.F90=.o)
+	$(LD) $(LDFLAGS) -o $@ $^ -L$(OASIS_LIB_DIR) $(OASIS_LIBS) $(NETCDF_LIB_DIR) $(NETCDF_LIBS) -L$(MPI_LIB_DIR) $(MPI_LIBS)
+
+%.o: %.F90
+	$(FC) $(FFLAGS) -c -I$(OASIS_MOD_DIR) -I$(NETCDF_INC_DIR) $<
+
+.PHONY: clean
+clean:
+	@rm -f *.o *.mod

+ 66 - 0
3.3.3.2/sources/xios-2_lemaitre3_bld.cfg

@@ -0,0 +1,66 @@
+# ----------------------- FCM extract configuration file -----------------------
+cfg::type                           bld
+cfg::version                        1.0
+
+
+# ------------------------------------------------------------------------------
+# Build information
+# ------------------------------------------------------------------------------
+
+inc arch.fcm
+inc config.fcm
+
+%CFLAGS           %BASE_CFLAGS %COMPIL_CFLAGS
+%FFLAGS           %BASE_FFLAGS %COMPIL_FFLAGS
+%LD_FLAGS         %ARCH_LD %BASE_LD
+
+
+dest::root   $PWD
+
+bld::infile_ext::cpp   C::SOURCE
+bld::infile_ext::conf  CPP::INCLUDE
+bld::infile_ext::hpp   CPP::INCLUDE
+
+
+search_src           true
+src::zzz .
+src::date $PWD/extern/boost/src/date_time
+src::blitz $PWD/extern/blitz/src
+#src::netcdf $PWD/extern/netcdf4
+src::remap $PWD/extern/remap/src
+bld::lib xios
+bld::target libxios.a
+#bld::target generate_fortran_interface.exe 
+bld::target xios_server.exe 
+#bld::target test_remap.exe
+#bld::target test_regular.exe
+#bld::target test_new_features.exe test_unstruct_complete.exe 
+#bld::target test_client.exe test_complete.exe
+bld::exe_dep
+
+bld::tool::cc        %CCOMPILER
+bld::tool::fc        %FCOMPILER
+bld::tool::fpp       %FPP
+bld::tool::cpp       %CPP
+#bld::tool::cppflags  %CBASE_INC -I${PWD}/extern/src_netcdf -I${PWD}/extern/boost/include -I${PWD}/extern/rapidxml/include -I${PWD}/extern/blitz/include 
+bld::tool::cppflags  %CBASE_INC -I${PWD}/extern/rapidxml/include -I${PWD}/extern/blitz/include
+bld::tool::fppflags  %BASE_INC -I${PWD}/extern/rapidxml/include 
+bld::tool::ld        %LINKER
+bld::tool::ldflags   %LD_FLAGS 
+#bld::tool::cflags    %CFLAGS %CBASE_INC -I${PWD}/extern/src_netcdf -I${PWD}/extern/boost/include -I${PWD}/extern/rapidxml/include -I${PWD}/extern/blitz/include 
+bld::tool::cflags    %CFLAGS %CBASE_INC -I${PWD}/extern/rapidxml/include -I${PWD}/extern/blitz/include
+bld::tool::fflags    %FFLAGS %FBASE_INC 
+bld::tool::cppkeys   %CPP_KEY
+bld::tool::fppkeys   %CPP_KEY
+bld::tool::make      %MAKE
+
+# Pre-process code before analysing dependencies
+bld::pp    false          
+bld::pp::interface/fortran              true
+bld::pp::interface/fortran_attr         true
+bld::excl_dep        use::mod_prism_get_comm
+bld::excl_dep        use::mod_prism_get_localcomm_proto
+bld::excl_dep        use::mod_prism_proto
+bld::excl_dep        use::mod_prism
+bld::excl_dep        use::netcdf
+bld::excl_dep        inc::mpif.h

+ 409 - 0
3.3.3.2/sources/zenobe-intelmpi.xml

@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="UTF-8"?>
+    <Platform name="zenobe-intelmpi">
+        <Description>
+            HOST:        zenobe.hpc.cenaero.be
+            ARCH:        linux_x86_64
+            CPU MODEL:   Intel IvyBridge
+            MAINTAINER:  PY Barriat [pierre-yves.barriat@uclouvain.be]
+            COMPILER:    i-compilers (icc+ifort, 15.0.5.223)
+            MPI:         Intel MPI
+            BLAS/LAPACK: Intel MKL
+        </Description>
+
+        <Parameter name="ECEARTH_SRC_DIR">
+            <Description>Base directory for EC-Earth sources</Description>
+            <Type>PATH</Type>
+            <Value>${HOME}/modeles/ecearth/ecearth_3.3.3.2/sources</Value>
+        </Parameter>
+
+        <Parameter name="MPI_BASE_DIR">
+            <Description>MPI base directory</Description>
+            <Type>PATH</Type>
+            <Value>/softs/intel/impi/5.1.3.181/intel64</Value>
+        </Parameter>
+
+        <Parameter name="MPI_INC_SUBDIR">
+            <Description>MPI include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="MPI_LIB_SUBDIR">
+            <Description>MPI lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="MPI_LIBS_WITHOUT_L">
+            <Description>MPI libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>mpi mpiif mpigf</Value>
+        </Parameter>
+
+        <Parameter name="LAPACK_BASE_DIR">
+            <Description>LAPACK base directory</Description>
+            <Type>PATH</Type>
+            <Value>/softs/intel/compilers_and_libraries_2016.2.181/linux/mkl</Value>
+        </Parameter>
+
+        <Parameter name="LAPACK_LIB_SUBDIR">
+            <Description>LAPACK lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib/intel64</Value>
+        </Parameter>
+
+        <Parameter name="LAPACK_LIBS_WITHOUT_L">
+            <Description>LAPACK libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>mkl_intel_lp64 mkl_core mkl_sequential</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_BASE_DIR">
+            <Description>NetCDF base directory</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/netcdf/4.4.1.1_ivy_2016.2.181</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_INC_SUBDIR">
+            <Description>NetCDF include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_LIB_SUBDIR">
+            <Description>NetCDF lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="NETCDF_LIBS_WITHOUT_L">
+            <Description>NetCDF libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>netcdff netcdf</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_BASE_DIR">
+            <Description>GRIB API base directory</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/grib_api</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_INC_SUBDIR">
+            <Description>GRIB API include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_LIB_SUBDIR">
+            <Description>GRIB API lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="GRIBAPI_LIBS_WITHOUT_L">
+            <Description>GRIB_API libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>grib_api_f90 grib_api</Value>
+        </Parameter>
+
+        <Parameter name="GRIBEX_BASE_DIR">
+            <Description>GRIBEX base directory</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/gribex</Value>
+        </Parameter>
+
+        <Parameter name="GRIBEX_LIB_SUBDIR">
+            <Description>GRIBEX lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="GRIBEX_LIBS_WITHOUT_L">
+            <Description>GRIBEX libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>gribexR64</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_BASE_DIR">
+            <Description>JPEG base directory</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/openjpeg</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_INC_SUBDIR">
+            <Description>JPEG include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/openjpeg/include</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_LIB_SUBDIR">
+            <Description>JPEG lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>/projects/acad/ecearth/opt/openjpeg/lib</Value>
+        </Parameter>
+
+        <Parameter name="JPEG_LIBS_WITHOUT_L">
+            <Description>JPEG libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>openjpeg</Value>
+        </Parameter>
+
+        <Parameter name="SZIP_BASE_DIR">
+            <Description>SZIP base directory</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="SZIP_INC_SUBDIR">
+            <Description>SZIP include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="SZIP_LIB_SUBDIR">
+            <Description>SZIP lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="SZIP_LIBS_WITHOUT_L">
+            <Description>SZIP libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_BASE_DIR">
+            <Description>HDF4 base directory</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_INC_SUBDIR">
+            <Description>HDF4 include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_LIB_SUBDIR">
+            <Description>HDF4 lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF4_LIBS_WITHOUT_L">
+            <Description>HDF4 libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="HDF5_BASE_DIR">
+            <Description>HDF5 base directory</Description>
+            <Type>PATH</Type>
+            <Value>/softs/hdf5/1.8.18-el6/intel/2016.2.181/intelmpi/5.1.3.181</Value>
+        </Parameter>
+
+        <Parameter name="HDF5_INC_SUBDIR">
+            <Description>HDF5 include directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>include</Value>
+        </Parameter>
+
+        <Parameter name="HDF5_LIB_SUBDIR">
+            <Description>HDF5 lib directory relative to base dir</Description>
+            <Type>PATH</Type>
+            <Value>lib</Value>
+        </Parameter>
+
+        <Parameter name="HDF5_LIBS_WITHOUT_L">
+            <Description>HDF5 libraries (without -l prefix)</Description>
+            <Type>STRING</Type>
+            <Value>hdf5_hl hdf5</Value>
+        </Parameter>
+
+        <Parameter name="MAKE">
+            <Description>Make command (GNU make >3.81 needed!)</Description>
+            <Type>STRING</Type>
+            <Value>make</Value>
+        </Parameter>
+
+        <Parameter name="FC">
+            <Description>F90 Compiler</Description>
+            <Type>STRING</Type>
+            <Value>mpiifort</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS">
+            <Description>General F90 flags for compiling</Description>
+            <Type>STRING</Type>
+            <Value>-r8 -O3 -xAVX -mtune=ivybridge -ip -fp-model precise -extend-source 132 </Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS_FREEFORM">
+            <Description>Allow for free format Fortran</Description>
+            <Type>STRING</Type>
+            <Value>-free</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS_FIXEDFORM">
+            <Description>Expect fixed Fortran format</Description>
+            <Type>STRING</Type>
+            <Value>-fixed</Value>
+        </Parameter>
+
+        <Parameter name="FFLAGS_FPP_PREFIX">
+            <Description>Fortran preprocessor flag prefix</Description>
+            <Type>STRING</Type>
+            <Value>-D</Value>
+        </Parameter>
+
+        <Parameter name="CC">
+            <Description>C Compiler</Description>
+            <Type>STRING</Type>
+            <Value>mpiicc</Value>
+        </Parameter>
+
+        <Parameter name="CFLAGS">
+            <Description>General C flags for compiling</Description>
+            <Type>STRING</Type>
+            <Value>-O1 -fp-model precise -xAVX -mtune=ivybridge</Value>
+        </Parameter>
+
+        <Parameter name="CFLAGS_CPP_PREFIX">
+            <Description>C preprocessor flag prefix</Description>
+            <Type>STRING</Type>
+            <Value>-D</Value>
+        </Parameter>
+
+        <Parameter name="CXX">
+            <Description>C++ Compiler</Description>
+            <Type>STRING</Type>
+            <Value>mpiicc</Value>
+        </Parameter>
+
+        <Parameter name="LD">
+            <Description>Linker</Description>
+            <Type>STRING</Type>
+            <Value>mpiifort</Value>
+        </Parameter>
+
+        <Parameter name="LDFLAGS">
+            <Description>General flags for linking</Description>
+            <Type>STRING</Type>
+            <Value>-O3 -fp-model precise -xAVX -mtune=ivybridge</Value>
+        </Parameter>
+
+        <Parameter name="AR">
+            <Description>Command for building libraries from object files (usually ar)</Description>
+            <Type>STRING</Type>
+            <Value>ar</Value>
+        </Parameter>
+
+        <Parameter name="ARFLAGS">
+            <Description>Flags for library building command (When using ar: include u)</Description>
+            <Type>STRING</Type>
+            <Value>curv</Value>
+        </Parameter>
+
+        <Parameter name="ARFLAGS_EXTRACT">
+            <Description>Flags for library building command (When using ar: include u)</Description>
+            <Type>STRING</Type>
+            <Value>p</Value>
+        </Parameter>
+
+        <Parameter name="CPP">
+            <Description>C preprocessor command</Description>
+            <Type>STRING</Type>
+            <Value>fpp</Value>
+        </Parameter>
+
+        <Parameter name="FPP">
+            <Description>C preprocessor command</Description>
+            <Type>STRING</Type>
+            <Value>fpp</Value>
+        </Parameter>
+
+        <Parameter name="CPPFLAGS">
+            <Description>C preprocessor flags</Description>
+            <Type>STRING</Type>
+            <Value>-P -C -traditional</Value>
+        </Parameter>
+
+        <Parameter name="XIOS_CFLAGS">
+            <Description>CFLAGS flags for XIOS</Description>
+            <Type>STRING</Type>
+            <Value>-ansi -w</Value>
+        </Parameter>
+
+        <Parameter name="XIOS_ADD_LDFLAGS">
+            <Description>More LD flags for XIOS</Description>
+            <Type>STRING</Type>
+            <Value>-lstdc++</Value>
+        </Parameter>
+
+        <Parameter name="OASIS_ADD_FFLAGS">
+            <Description>More F90 flags for Oasis</Description>
+            <Type>STRING</Type>
+            <Value>-132 -check pointers -check uninit</Value>
+        </Parameter>
+
+        <Parameter name="OASIS_ADD_PPDEFS">
+            <Description>More CPP/FPP macros for Oasis</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="OASIS_ADD_LDFLAGS">
+            <Description>More LD flags for Oasis</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="NEMO_ADD_FFLAGS">
+            <Description>More F90 flags for Nemo</Description>
+            <Type>STRING</Type>
+            <Value>-check pointers -check uninit -fpe0</Value>
+        </Parameter>
+
+        <Parameter name="NEMO_ADD_LDFLAGS">
+            <Description>More LD flags for Nemo</Description>
+            <Type>STRING</Type>
+            <Value>-lstdc++</Value>
+        </Parameter>
+
+        <Parameter name="IFS_PPDEFS">
+            <Description>Preprocessor defs for IFS sources</Description>
+            <Type>STRING</Type>
+            <Value>linux LINUX LITTLE LITTLE_ENDIAN POINTER_64 BLAS</Value>
+        </Parameter>
+
+        <Parameter name="IFSAUX_ADD_FFLAGS">
+            <Description>More F90 flags for ifs/ifsaux</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="MAKEDEPF90">
+            <Description>F90 dependency generator</Description>
+            <Type>STRING</Type>
+            <Value>${ECEARTH_SRC_DIR}/util/makedepf90/bin/makedepf90</Value>
+        </Parameter>
+
+      <Parameter name="TM5_DEFAULT_FFLAGS">
+            <Description>Default F90 flags for TM5 (ie without optimization)</Description>
+            <Type>STRING</Type>
+            <Value>-O2 -g -traceback -r8 -fp-model strict -fp-model source -xHost</Value>
+        </Parameter>
+
+       <Parameter name="TM5_OPTIM_FFLAGS">
+            <Description>F90 optimization/debug flags for TM5</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+        <Parameter name="TM5_MDEFS_FFLAGS">
+            <Description>Model preprocessor defs</Description>
+            <Type>STRING</Type>
+            <Value/>
+        </Parameter>
+
+    </Platform>

+ 13 - 2
install.sh

@@ -5,7 +5,7 @@ echo "Release you want :"
 echo "##################"
 repertoirdebase=`pwd`
 PS3='> '   # le prompt
-COMPIL=("dev" "trunk" "primavera" "3.2.2" "3.2.3" "3.3.0")
+COMPIL=("dev" "trunk" "primavera" "3.2.2" "3.2.3" "3.3.0", "3.3.3.2")
 select CHOIX in "${COMPIL[@]}" ; do
   case $REPLY in
       1)  
@@ -39,6 +39,15 @@ case "$CHOIX" in
       cp $CHOIX/runtime/classic/platform/zenobe-intelmpi.xml $TARGET/runtime/classic/platform
       cp $CHOIX/runtime/classic/platform/lemaitre3-intelmpi.xml $TARGET/runtime/classic/platform
       ;;
+    *3.3.3.2*)
+      echo "New 3.3.3.2 release"
+      sed -i '$ d' $TARGET/sources/config-build.xml    
+      cat $CHOIX/sources/config-build.xml >> $TARGET/sources/config-build.xml
+      cp $CHOIX/sources/zenobe-intelmpi.xml $TARGET/sources/platform
+      #   
+      cp $CHOIX/runtime/classic/config-run.xml $TARGET/runtime/classic/config-run.xml
+      cp $CHOIX/runtime/classic/platform/zenobe-intelmpi.xml $TARGET/runtime/classic/platform
+      ;;  
     *3.2.3*)
       echo "3.2.3 release"
       cp $CHOIX/sources/config-build.xml $TARGET/sources/config-build.xml
@@ -79,8 +88,10 @@ case "$machine" in
       echo "Zenobe"
       cp $CHOIX/runtime/classic/platform/zenobe.cfg.tmpl $TARGET/runtime/classic/platform/zenobe.cfg.tmpl
       cat $CHOIX/runtime/classic/zenobe.sh.tmpl > $TARGET/runtime/classic/ece-ifs+nemo.sh.tmpl
+      cat $CHOIX/runtime/classic/zenobe.sh.tmpl > $TARGET/runtime/classic/ece-esm.sh.tmpl
       cat $CHOIX/runtime/classic/ece-ifs+nemo.sh.tmpl >> $TARGET/runtime/classic/ece-ifs+nemo.sh.tmpl
-      cp util/arch-frontal3.fcm $TARGET/sources/nemo-3.6/ARCH/
+      cat $CHOIX/runtime/classic/ece-esm.sh.tmpl >> $TARGET/runtime/classic/ece-esm.sh.tmpl
+      #cp util/arch-frontal3.fcm $TARGET/sources/nemo-3.6/ARCH/
       ;;
     *frontal*)
       echo "Zenobe"

+ 69 - 0
util/arch-frontal1.fcm

@@ -0,0 +1,69 @@
+# EC-EARTH3 ec-conf-based configuration
+#
+# NCDF_HOME   root directory containing lib and include subdirectories for netcdf4
+# HDF5_HOME   root directory containing lib and include subdirectories for HDF5
+# XIOS_HOME   root directory containing lib for XIOS
+# OASIS_HOME  root directory containing lib for OASIS
+#
+# NCDF_INC    netcdf4 include file
+# NCDF_LIB    netcdf4 library
+# XIOS_INC    xios include file    (taken into accound only if key_iomput is activated)
+# XIOS_LIB    xios library         (taken into accound only if key_iomput is activated)
+# OASIS_INC   oasis include file   (taken into accound only if key_oasis3 is activated)
+# OASIS_LIB   oasis library        (taken into accound only if key_oasis3 is activated)
+#
+# FC          Fortran compiler command
+# FCFLAGS     Fortran compiler flags
+# FFLAGS      Fortran 77 compiler flags
+# LD          linker
+# LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries
+# FPPFLAGS    pre-processing flags
+# AR          assembler
+# ARFLAGS     assembler flags
+# MK          make
+# USER_INC    complete list of include files
+# USER_LIB    complete list of libraries to pass to the linker
+#
+# Note that:
+#  - unix variables "$..." are accpeted and will be evaluated before calling fcm.
+#  - fcm variables are starting with a % (and not a $)
+
+%HDF5_HOME           /softs/hdf5/1.8.18-el6/intel/2016.2.181/intelmpi/5.1.3.181
+%HDF5_LIB            $(addprefix -L,$(addsuffix /,/softs/hdf5/1.8.18-el6/intel/2016.2.181/intelmpi/5.1.3.181)lib) \
+                     $(addprefix -l,hdf5_hl hdf5)
+
+%NCDF_INC            $(addprefix -I,$(addsuffix /,/projects/acad/ecearth/opt/netcdf/4.4.1.1_ivy_2016.2.181)include)
+%NCDF_LIB            $(addprefix -L,$(addsuffix /,/projects/acad/ecearth/opt/netcdf/4.4.1.1_ivy_2016.2.181)lib) \
+                     $(addprefix -l,netcdf) \
+                     $(addprefix -l,netcdff)
+
+%MPI_INC             $(addprefix -I,$(addsuffix /,/softs/intel/compilers_and_libraries_2016.2.181/linux/mpi/intel64)include)
+%MPI_LIB             $(addprefix -L,$(addsuffix /,/softs/intel/compilers_and_libraries_2016.2.181/linux/mpi/intel64)lib) \
+                     $(addprefix -l,mpi mpi_mpifh mpi_usempif08)
+
+%XIOS_HOME           ${HOME}/modeles/ecearth/ecearth_3.3.0/sources/xios-2.5
+%XIOS_INC            -I%XIOS_HOME/inc
+%XIOS_LIB            -L%XIOS_HOME/lib -lxios
+
+%OASIS_HOME          ${HOME}/modeles/ecearth/ecearth_3.3.0/sources/oasis3-mct/ecconf
+%OASIS_INC           -I%OASIS_HOME/build/lib/psmile.MPI1
+%OASIS_LIB           -L%OASIS_HOME/lib -lpsmile.MPI1 -lmct -lmpeu -lscrip
+
+%CPP                 cpp
+
+%FC                  gfortran
+%FCFLAGS             -fdefault-real-8 -ffree-line-length-none -O3 -funroll-all-loops 
+%FFLAGS              %FCFLAGS
+
+%FPPFLAGS            -P -C -traditional
+
+%LD                  gfortran
+%LDFLAGS             -O3
+
+%AR                  ar
+%ARFLAGS             -r -s
+
+%MK                  gmake
+
+%USER_INC            %XIOS_INC %OASIS_INC %NCDF_INC %MPI_INC
+%USER_LIB            %XIOS_LIB %OASIS_LIB %NCDF_LIB %MPI_LIB