Difference between revisions of "Quick Install and Run Mars PEM"

From Planets
Jump to: navigation, search
(Inputs files)
(Undo revision 2916 by Jbclement (talk))
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== How to install the model ==
+
In this page, we give a hopefully exhaustive enough overview of the necessary prerequisites and steps to download, compile and run a simple simulation with the PEM, set up on a Linux computer.
  
To download the model you'll need to follow exactly the same step as dowloading the martian model. You can have a look at the section Quick Install and Run of Mars Model and follow the "Prerequisites: Tools and Libraries" steps.
+
== Installation ==
  
The PEM is dowlnload alongside with the LMDZ.COMMON repository.
+
The PEM is downloaded alongside the '''LMDZ.COMMON''' repository of your trunk, following the same step described in the related section of [[Quick Install and Run Mars PCM]]. The Fortran code is in the following directory: <code>trunk/LMDZ.COMMON/libf/evolution/</code>. The two PEM programs are '''pem.F90''' and '''reshape_XIOS_output.F90'''.
The Fortran code of the PEM is in the following directory : trunk/LMDZ.COMMON/libf/evolution/
 
The main program is in the file pem.F90
 
  
=== Compiling the test case ===
+
== Compilation ==
To compile the PEM at the sought resolution, run (in LMDZ.COMMON):
+
 
 +
To compile the PEM, in LMDZ.COMMON, do:
 +
<syntaxhighlight lang="bash">
 +
./makelmdz_fcm -arch [local] -p [planet] -d [dimensions] -j 8 pem
 +
</syntaxhighlight>
 +
Options with example:
 +
# [local]: ''root name of arch files'', assuming that they have been set up for your configuration;
 +
# [planet]: ''mars'' to use the Mars planet physics package;
 +
# [dimensions]: ''64x48x54'' to define the grid you want to use (longitude x latitude x atmospheric layers).
 +
To run the PEM, you need a dedicated reshaping tool with consistent options. To compile it, in LMDZ_COMMON, do:
 +
<syntaxhighlight lang="bash">
 +
./makelmdz_fcm -arch [local] -p [planet] -d [dimensions] -j 8 reshape_XIOS_output
 +
</syntaxhighlight>
 +
To run the PEM, you also need a PCM working with XIOS and consistent options. To compile it, in LMDZ.COMMON, do:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
./makelmdz_fcm -arch local -p mars -d 64x48x54 -j 8 pem
+
./makelmdz_fcm -arch [local] -p [planet] -parallel mpi_omp -io XIOS -d [dimensions] -j 8 gcm
 
</syntaxhighlight>
 
</syntaxhighlight>
Here, we assume that you have generated the '''arch-local.*''' files as per what is suggested in the previous section.
+
After compilation, the executable file can be found in the "bin" sub-directory.
The options for ''makelmdz_fcm'' used here imply:
 
* '''-p mars''': the PEM will use the "mars" physics package
 
* '''-d 64x48x54''': the PEM grid will be 64x48 in longitude x latitude, with 54 vertical levels.
 
 
 
Upon successful compilation, the executable '''pem_64x48x29_phymars_seq.e''' should be generated in the '''bin''' subdirectory.
 
  
To run the PEM you'll also need a valid PCM, you can compile it using a similar command:
+
== Usage ==
  
 +
To run a PEM simulation, do:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
./makelmdz_fcm -arch local -p mars -parallel mpi_omp -io XIOS -d 64x48x54 -j 8 gcm
+
./launchPEM.sh [options]
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
Options:
 +
# None: to start a simulation from scratch;
 +
# 're': to relaunch a simulation from a starting point (interactive prompt).
  
To run the PEM you'll also need a tool (reshape_xios_output) that will we explained later, you can compile it using a similar command:
+
The Bash file ''launchPEM.sh'' is the master script to launch the PEM chained simulation. It checks if necessary files and required options for your simulation are ok.
  
<syntaxhighlight lang="bash">
+
== Requirements ==
./makelmdz_fcm -arch local -p mars -d 64x48x54 -j 8 reshape_xios_output
 
</syntaxhighlight>
 
  
=== Inputs files ===
+
To run the PEM, you can create a folder in which you need the following files:
 +
* your executable files for the PCM, the PEM and the reshaping tool with consistent options;
 +
* the xml files for XIOS which can be found in the PCM deftank folder: ''iodef.xml'', ''context_lmdz_physics.xml'', ''file_def_physics_mars.xml'' and ''field_def_physics_mars.xml'';
 +
* the def files you want to run the PCM: ''run.def'', ''callphys.def'', ''traceur.def'', etc. '''Be careful, do not forget to rename the PCM ''run.def'' into ''run_PCM.def''''';
 +
* the starting files you want to run the PCM: ''startfi.nc'', ''start.nc''/''start1D.txt''/profiles;
 +
* the necessary PEM files: ''launchPEM.sh'', ''lib_launchPEM.sh'', ''PCMrun.job'', ''PEMrun.job'', ''run_PEM.def'' and ''obl_ecc_lsp.asc'';
 +
* the optional PEM files ''diagpem.def'' to define the PEM variables to be ouputted and ''startpem.nc'' to set the initial state of the PEM.
  
Then all the compilation stuff is done. You ll want to create a folder to run a simulation and copy all the executable there. In addition to these executables, you'll need a few other files:
+
The PEM files can be found in the deftank folder, where a ''README'' file recaps everything.
  
Files for the PCM run:
+
Before a simulation, you have to set up some parameters/options:
* A start.nc and startfi.nc, if you do a chained simulation you probably have to rename them start0.nc and startfi0.nc, the number correspond to the martian year. The dimensions should correspond to the dimension in which you compiled the executables, they can be found in the Q"uick Install and Run" of the Mars Model.
+
# In ''launchPEM.sh'', the user has to specify:
* A datadir directory, this can be dowload by following the steps described in "Quick Install and Run" of the Mars Model.
+
#* '''n_mars_years''', '''n_earth_years''': the number of Mars/Earth years to be simulated in total (> 0);
* A callphys.def : you can take one in LMDZ.MARS/deftank/
+
#* '''nPCM_ini''': the number of initial PCM runs (>= 2);
* traceur.def : you can take one in LMDZ.MARS/deftank/
+
#* '''nPCM''': the number of PCM runs between each PEM run (>= 2, usually 2);
* z2sig.def : you can take one in LMDZ.MARS/deftank/
+
#* '''counting''': the counting method for the number of years to be simulated (0 = "only PEM runs count"; any other values = "PCM runs are taken into account"). The former option is the usual one;
* diagfi.def: Optional; not necessary since we do the outputs using XIOS
+
#* '''mode''': the launching mode (0 = "processing scripts"; any other values = "submitting jobs"). The former option is usually used to process the script on a local machine while the latter is used to submit jobs on a supercomputer with SLURM or PBS/TORQUE.
* A run.def, for chained simulation rename it run.def.ref, also available in LMDZ.MARS/deftank/ . If you do not want diagfi.nc output, you can change the variable ecritphy to 6699 for example.
+
# In ''PCMrun.job'', the user has to specify:
* xml files: iodef.xml, context_lmdz_physics.xml, field_def_physics_mars.xml, file_def_physics_mars.xml. For this last file you have to change to true the enable option of the FILE 3 (diurnal averages outputs for PEM) the other can be enable to false if you do not want other outputs.
+
#* the '''headers''' correspond to the ADASTRA supercomputer and should be changed for other machines and job schedulers. In case of "processing scripts" launching mode, the headers are naturally omitted.
* run0 : the file used to run chained simulation, available in LMDZ.MARS/deftank/
+
#* The '''path to source''' the arch file should be adapted to the machine.
 +
#* The '''name of the PCM executable''' file should be adapted.
 +
#* The '''execution command''' should also be adapted according to the set-up.
 +
# In ''PEMrun.job'', the user has to specify:
 +
#* The '''headers''' correspond to the ADASTRA supercomputer and should be changed for other machines and job schedulers. In case of "processing scripts" launching mode, the headers are naturally omitted.
 +
#* The '''path to source''' the arch file should be adapted to the machine.
 +
#* The '''name of the PEM and Reshaping executable''' files should be adapted.
 +
#* The PEM executable can have an '''optional argument''' which should be specified according to the set-up ("--auto-exit" for SLURM and PBS/TORQUE | "" when the script is not run as a job).
 +
# The user has to specify the wanted options in the '''def files''', especially for ''run_PEM.def'', ''run_PCM.def'', ''callphys.def''.
 +
# The user has to provide a ''startfi.nc'' whose orbital parameters are consistent with the initial date set in ''run_PEM.def''. The script '''inipem_orbit.sh''' can do it automatically with ''obl_ecc_lsp.asc''.
  
 +
== Outputs ==
  
Files for the PEM run:
+
The PEM simulation generates the following files:
* ob_ex_lsp.asc : Available in LMDZ.MARS/deftank/pem describing the changes in orbital parameters in marsian year
+
* the usual outputs of the PCM: ''restartfi.nc'', ''restart.nc'', ''diagfi.nc'', etc;
* run_PEM.def : The file to describe the PEM physical parametrizations you want (remember to include it in the run.def.ref or run.def_PEM)
+
* the XIOS outputs of the PCM, then reshaped: ''Xdiurnalave.nc''/''data2reshape*.nc''/''data_PCM_Y*.nc'';
* start_evol.nc : The last restart.nc of the GCM simulations
+
* the outputs of the chained simulation: ''launchPEM.log'', ''info_PEM.txt'' and possibly ''kill_launchPEM.sh'';
* startfi_evol.nc : The last restartfi.nc of the GCM simulations
+
* the usual outputs of the PEM: ''"restartfi.nc'', ''restart.nc''/''restart1D.txt'' and ''diagpem.nc''.
* data_GCM_Y1.nc and data_GCM_Y2.nc : The outputs of the last 2 typical year of the GCM, they have been reshape by he utility to be in the dynamical grid
 
* diagfi.def (Optional) : you can output PEM specific variables with diagfi.def, to do so we usually set a specific output time with a specific run.def_PEM and run.def_GCM.
 
* startfi_PEM.nc (Optional) : The start file specific of the PEM, if it is not present the PEM will create a default one.
 
* run_pem1 : The main bash file to run chained PEM simulations, you can specify the numer of PEM iterations (num_PEM_now=,num_PEM_end=), the number of GCM run in between each PEM run (nb_GCM_call). You have to adapat it to the machine you're runnning on.
 
  
=== Ouputs files  ===
+
During the simulation, the PCM/PEM run files are renamed conveniently and stored in the sub-directories '''logs''' (log files), '''starts''' (starting files) and '''diags''' (diagnostic files).
* restart_evol.nc : The last start.nc of the GCM simulations modified by the PEM
 
* restartfi_evol.nc : The last restartfi.nc of the GCM simulations modified by the PEM
 
* restartfi_PEM.nc : The restart file specific of the PEM
 
* info_run_PEM.txt : A file containing the time the PEM has extrapolate and the reason it stopped
 
* diagfi.def (Optional) : Information about the run
 
  
 +
If you run a simulation by submitting jobs, the script ''kill_launchPEM.sh'' is automatically generated. It can be used to kill in the queue of the job scheduler the jobs related to your chained simulation.
  
 
[[Category:Planetary-Evolution-Model]]
 
[[Category:Planetary-Evolution-Model]]

Latest revision as of 11:09, 24 October 2025

In this page, we give a hopefully exhaustive enough overview of the necessary prerequisites and steps to download, compile and run a simple simulation with the PEM, set up on a Linux computer.

Installation

The PEM is downloaded alongside the LMDZ.COMMON repository of your trunk, following the same step described in the related section of Quick Install and Run Mars PCM. The Fortran code is in the following directory: trunk/LMDZ.COMMON/libf/evolution/. The two PEM programs are pem.F90 and reshape_XIOS_output.F90.

Compilation

To compile the PEM, in LMDZ.COMMON, do:

./makelmdz_fcm -arch [local] -p [planet] -d [dimensions] -j 8 pem

Options with example:

  1. [local]: root name of arch files, assuming that they have been set up for your configuration;
  2. [planet]: mars to use the Mars planet physics package;
  3. [dimensions]: 64x48x54 to define the grid you want to use (longitude x latitude x atmospheric layers).

To run the PEM, you need a dedicated reshaping tool with consistent options. To compile it, in LMDZ_COMMON, do:

./makelmdz_fcm -arch [local] -p [planet] -d [dimensions] -j 8 reshape_XIOS_output

To run the PEM, you also need a PCM working with XIOS and consistent options. To compile it, in LMDZ.COMMON, do:

./makelmdz_fcm -arch [local] -p [planet] -parallel mpi_omp -io XIOS -d [dimensions] -j 8 gcm

After compilation, the executable file can be found in the "bin" sub-directory.

Usage

To run a PEM simulation, do:

./launchPEM.sh [options]

Options:

  1. None: to start a simulation from scratch;
  2. 're': to relaunch a simulation from a starting point (interactive prompt).

The Bash file launchPEM.sh is the master script to launch the PEM chained simulation. It checks if necessary files and required options for your simulation are ok.

Requirements

To run the PEM, you can create a folder in which you need the following files:

  • your executable files for the PCM, the PEM and the reshaping tool with consistent options;
  • the xml files for XIOS which can be found in the PCM deftank folder: iodef.xml, context_lmdz_physics.xml, file_def_physics_mars.xml and field_def_physics_mars.xml;
  • the def files you want to run the PCM: run.def, callphys.def, traceur.def, etc. Be careful, do not forget to rename the PCM run.def into run_PCM.def;
  • the starting files you want to run the PCM: startfi.nc, start.nc/start1D.txt/profiles;
  • the necessary PEM files: launchPEM.sh, lib_launchPEM.sh, PCMrun.job, PEMrun.job, run_PEM.def and obl_ecc_lsp.asc;
  • the optional PEM files diagpem.def to define the PEM variables to be ouputted and startpem.nc to set the initial state of the PEM.

The PEM files can be found in the deftank folder, where a README file recaps everything.

Before a simulation, you have to set up some parameters/options:

  1. In launchPEM.sh, the user has to specify:
    • n_mars_years, n_earth_years: the number of Mars/Earth years to be simulated in total (> 0);
    • nPCM_ini: the number of initial PCM runs (>= 2);
    • nPCM: the number of PCM runs between each PEM run (>= 2, usually 2);
    • counting: the counting method for the number of years to be simulated (0 = "only PEM runs count"; any other values = "PCM runs are taken into account"). The former option is the usual one;
    • mode: the launching mode (0 = "processing scripts"; any other values = "submitting jobs"). The former option is usually used to process the script on a local machine while the latter is used to submit jobs on a supercomputer with SLURM or PBS/TORQUE.
  2. In PCMrun.job, the user has to specify:
    • the headers correspond to the ADASTRA supercomputer and should be changed for other machines and job schedulers. In case of "processing scripts" launching mode, the headers are naturally omitted.
    • The path to source the arch file should be adapted to the machine.
    • The name of the PCM executable file should be adapted.
    • The execution command should also be adapted according to the set-up.
  3. In PEMrun.job, the user has to specify:
    • The headers correspond to the ADASTRA supercomputer and should be changed for other machines and job schedulers. In case of "processing scripts" launching mode, the headers are naturally omitted.
    • The path to source the arch file should be adapted to the machine.
    • The name of the PEM and Reshaping executable files should be adapted.
    • The PEM executable can have an optional argument which should be specified according to the set-up ("--auto-exit" for SLURM and PBS/TORQUE | "" when the script is not run as a job).
  4. The user has to specify the wanted options in the def files, especially for run_PEM.def, run_PCM.def, callphys.def.
  5. The user has to provide a startfi.nc whose orbital parameters are consistent with the initial date set in run_PEM.def. The script inipem_orbit.sh can do it automatically with obl_ecc_lsp.asc.

Outputs

The PEM simulation generates the following files:

  • the usual outputs of the PCM: restartfi.nc, restart.nc, diagfi.nc, etc;
  • the XIOS outputs of the PCM, then reshaped: Xdiurnalave.nc/data2reshape*.nc/data_PCM_Y*.nc;
  • the outputs of the chained simulation: launchPEM.log, info_PEM.txt and possibly kill_launchPEM.sh;
  • the usual outputs of the PEM: "restartfi.nc, restart.nc/restart1D.txt and diagpem.nc.

During the simulation, the PCM/PEM run files are renamed conveniently and stored in the sub-directories logs (log files), starts (starting files) and diags (diagnostic files).

If you run a simulation by submitting jobs, the script kill_launchPEM.sh is automatically generated. It can be used to kill in the queue of the job scheduler the jobs related to your chained simulation.