Difference between revisions of "Tool Box Venus PCM"

From Planets
Jump to: navigation, search
(LMDZ.VENUS/Tools)
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
=== UTIL ===
 
=== UTIL ===
 +
In the top-level ''UTIL'' directory can be found some utilities for post-processing Venus PCM outputs such as:
 +
* zrecast : a utility to vertically interpolate PCM outputs (which are on the native hybrid sigma-pressure vertical coordinate) onto pressure or altitude levels. An example of a compiling script, <code>compile</code>, to compile ''zrecast'' is also provided; to be adapted to your local settings.
 +
* ... To be completed ...
  
 
=== LMDZ.VENUS/Tools ===
 
=== LMDZ.VENUS/Tools ===
 +
This subdirectory contains the following utilities (check out the README file present in that directory for additional information):
 +
* angmom : to compute angular momentum and torque components
 +
* energy : to compute specific and integarted potential and kinetic energy
 +
* fft : to compute the Fourier decomposition
 +
* localtime_mean_and_std : to interpolate variables at the same local time everywhere
 +
* psi : to compute the streamfunction
 +
* stability: to compute stability, Richardson number and distance to cyclostrophic equilibrium
 +
* tem : to compute TransEulerianMean variables
 +
* tmc : to compute angular momentum transport from high-frequency outputs
 +
 +
The ''startarchive2icosa'' subdirectory contains some programs and instructions (see the README there) to generate a DYNAMICO-Venus set of start files from a lon-lat <code>start_archive.nc</code> file
 +
 +
====  Using angmom ====
 +
First, one need to compile the subprograms using this script :
 +
<pre>
 +
#!/bin/bash
 +
 +
# Source
 +
source /chemin/vers/votre/XIOS/arch.env
 +
source /chemin/vers/votre/XIOS/arch.path
 +
 +
# Chemins NetCDF
 +
NETCDF_INCLUDE=$NETCDF_INCDIR
 +
NETCDF_LIB=$NETCDF_LIBDIR
 +
 +
# Compilation des sous-programmes
 +
mpif90 -c -g -traceback cpdet.F90 moyzon.F moyzon2.F moytim.F dx_dp.F epflux.F90 io.F90 dmass.F90 reverse.F90 \
 +
$NETCDF_INCLUDE $NETCDF_LIB
 +
</pre>
 +
 +
Then, compile the main programs with this script :
 +
<pre>
 +
#!/bin/bash
 +
 +
# Source
 +
source /chemin/vers/votre/XIOS/arch.env
 +
source /chemin/vers/votre/XIOS/arch.path
 +
 +
# Chemins NetCDF
 +
NETCDF_INCLUDE=$NETCDF_INCDIR
 +
NETCDF_LIB=$NETCDF_LIBDIR
 +
 +
 +
main_programs=("stability.F90" "energy.F90" "psi.F90" "tem.F90" "angmom.F90" "tmc.F90")
 +
 +
for program in "${main_programs[@]}"; do
 +
    program_name=$(basename "$program" .F90)
 +
    mpif90 -g -traceback "$program" *.o \
 +
    -I /chemin/vers/votre/XIOS/inc -L /chemin/vers/votre/XIOS/lib -lxios -lstdc++ \
 +
    $NETCDF_INCLUDE $NETCDF_LIB -o "${program_name}.e"
 +
done
 +
 +
\rm *.o
 +
</pre>
 +
 +
Be aware that, if you modify a one of the main programs and wish to re-compile it, don't forget to re-compile the subprograms first. Without, you'll end up with an issue, that the script cannot find the .o files needed for the compilation.
 +
 +
After doing this, you should obtain the executable <code>angmom.e</code>. Copy it in the repository that contains the NetCDF files that you want to analyse.
 +
<pre>
 +
cp ../../your/path/
 +
</pre>
 +
 +
Then execute it
 +
<pre>
 +
./angmom.e
 +
</pre>
 +
 +
When the program is run, you will first be asked for the name of the file you wish to use. Write it down and then type enter.
 +
You will then be asked if you wish to use the file "dynzon.nc". If you don't want to, simply type "enter".
 +
 +
Normally, at the end of execution, you should obtain a file called "your_file_GAM.nc" (if the original name was "your_file.nc").
 +
 +
'''Nota Bene :'''
 +
Here is a modified "alternative" script of angmom.F90, that don't take into account the <code>dyzon.nc</code> file, and, which is run only by this command :
 +
<pre>
 +
./angmom.e your_file.nc
 +
</pre>
 +
 +
This is a way more practical use of it.
 +
 +
'''Nota Bene 2 :'''
 +
If you use angmom on a file that is a bit heavy, you will probably get an execution error, specifying that the machine has not been able to allocate enough memory. To remedy this, simply run a job in a compute node. The advantage of '''Nota Bene 1''' is that it is easier to run the program in a compute node that is not necessarily interactive (using the "alternative" script).
 +
 +
Example of script job submission in this case (simply use <code>sbatch your_submission_script</code>) :
 +
<pre>
 +
#!/bin/bash
 +
#SBATCH --nodes=1
 +
#SBATCH --ntasks-per-node=1
 +
#SBATCH --partition=zen16
 +
#SBATCH --mem=24G
 +
#SBATCH -J job_angmom
 +
#SBATCH --time=1:00:00
 +
#SBATCH --output=job_angmom.%j.out
 +
 +
 +
source /your/path/trunk/ARCH/arch-ifort_MESOIPSL.env
 +
 +
 +
./angmom.e your_file.nc > angmom.out 2>&1
 +
</pre>
 +
You can follow the run of the program in angmom.out, using for example <code>tail -f angmom.out</code>.
  
 
== Main programs (other than GCM) but included in the Venus PCM package ==
 
== Main programs (other than GCM) but included in the Venus PCM package ==
 
There are a few other main programs that are included with the GCM.  
 
There are a few other main programs that are included with the GCM.  
  
Advanced stuff: these main programs are located under ''LMDZ.VENUS/dynphy_lonlat/phyvenus/'' as they are at the interface between lon-lat dynamics and the Venus physics package  
+
Advanced stuff: these main programs are located under ''LMDZ.VENUS/libf/dynphy_lonlat/phyvenus/'' as they are at the interface between lon-lat dynamics and the Venus physics package  
  
 
=== start2archive ===
 
=== start2archive ===
 +
This program collects multiple <code>start.nc</code> and <code>startfi.nc</code> files from a series simulations and store them in a <code>start_archive.nc</code> file. For this one simply needs to run the <code>startarchive</code> program in the directory. It will automatically fetch <code>start.nc</code> and <code>startfi.nc</code> files and generate <code>start_archive.nc</code>. If a <code>start_archive.nc</code> file is already present then the current <code>start.nc</code> and <code>startfi.nc</code> files are added to the <code>start_archive.nc</code> file (which can contain multiple initial states, as long as they are on the same grid and correspond to different dates.
  
 +
The <code>startarchive</code> program should be compiled at the same resolution as the gcm which produced the start files, using the [[The_makelmdz_fcm_GCM_Compilation_Script | makelmdz_fcm]] compilation script
 +
 
=== newstart ===
 
=== newstart ===
 +
This program is to:
 +
* extract (and interpolate) <code>restart.nc</code> and <code>restartfi.nc</code> files from a <code>start_archive.nc</code> file or from a pair of <code>start.nc</code> and <code>startfi.nc</code> files. The subtle difference between the two setup is that grid interpolation (horizontal and/or vertical) is only possible if using a <code>start_archive.nc</code> input file
 +
* modify values and fields contained in the initial condition file
 +
* Compiling <code>newstart</code> is done using the [[The makelmdz fcm GCM Compilation Script|makelmdz_fcm]] utility. The program is then meant to be run interactively with the user providing options and choices when prompted.
 +
* Once the program has run and finished without error, it will generate <code>restart.nc</code> and <code>restartfi.nc</code>
 +
 +
=== rearrange_startphy ===
 +
In a nutshell, this program allows us to convert a <code>start_archive.nc</code> coming from Venus LMDZ simulation startfiles, into a <code>start.nc</code> and <code>startphy.nc</code> files, usable to begin a '''Venus - DYNAMICO''' simulation.
 +
You can find it here :
 +
<code>
 +
/your/path/LMDZ.VENUS/Tools/startarchive2icosa/
 +
</code>
 +
 +
Every step is well explained in the REAMDE file contained in the same directory.
  
 
== The rcm1d 1D column program ==
 
== The rcm1d 1D column program ==

Latest revision as of 11:00, 14 August 2024

Post-processing tools provided with the Venus PCM

First and foremost there are a number of postprocessing utilities (self-standing tools) which can be found in the UTIL and LMDZ.VENUS/Tools directories. Secondly one has some extra main programs in the dynamics-physics interface.

UTIL

In the top-level UTIL directory can be found some utilities for post-processing Venus PCM outputs such as:

  • zrecast : a utility to vertically interpolate PCM outputs (which are on the native hybrid sigma-pressure vertical coordinate) onto pressure or altitude levels. An example of a compiling script, compile, to compile zrecast is also provided; to be adapted to your local settings.
  • ... To be completed ...

LMDZ.VENUS/Tools

This subdirectory contains the following utilities (check out the README file present in that directory for additional information):

  • angmom : to compute angular momentum and torque components
  • energy : to compute specific and integarted potential and kinetic energy
  • fft : to compute the Fourier decomposition
  • localtime_mean_and_std : to interpolate variables at the same local time everywhere
  • psi : to compute the streamfunction
  • stability: to compute stability, Richardson number and distance to cyclostrophic equilibrium
  • tem : to compute TransEulerianMean variables
  • tmc : to compute angular momentum transport from high-frequency outputs

The startarchive2icosa subdirectory contains some programs and instructions (see the README there) to generate a DYNAMICO-Venus set of start files from a lon-lat start_archive.nc file

Using angmom

First, one need to compile the subprograms using this script :

#!/bin/bash

# Source
source /chemin/vers/votre/XIOS/arch.env
source /chemin/vers/votre/XIOS/arch.path

# Chemins NetCDF
NETCDF_INCLUDE=$NETCDF_INCDIR
NETCDF_LIB=$NETCDF_LIBDIR

# Compilation des sous-programmes
mpif90 -c -g -traceback cpdet.F90 moyzon.F moyzon2.F moytim.F dx_dp.F epflux.F90 io.F90 dmass.F90 reverse.F90 \
$NETCDF_INCLUDE $NETCDF_LIB

Then, compile the main programs with this script :

#!/bin/bash

# Source 
source /chemin/vers/votre/XIOS/arch.env
source /chemin/vers/votre/XIOS/arch.path

# Chemins NetCDF
NETCDF_INCLUDE=$NETCDF_INCDIR
NETCDF_LIB=$NETCDF_LIBDIR


main_programs=("stability.F90" "energy.F90" "psi.F90" "tem.F90" "angmom.F90" "tmc.F90")

for program in "${main_programs[@]}"; do
    program_name=$(basename "$program" .F90)
    mpif90 -g -traceback "$program" *.o \
    -I /chemin/vers/votre/XIOS/inc -L /chemin/vers/votre/XIOS/lib -lxios -lstdc++ \
    $NETCDF_INCLUDE $NETCDF_LIB -o "${program_name}.e"
done

\rm *.o

Be aware that, if you modify a one of the main programs and wish to re-compile it, don't forget to re-compile the subprograms first. Without, you'll end up with an issue, that the script cannot find the .o files needed for the compilation.

After doing this, you should obtain the executable angmom.e. Copy it in the repository that contains the NetCDF files that you want to analyse.

cp ../../your/path/

Then execute it

./angmom.e

When the program is run, you will first be asked for the name of the file you wish to use. Write it down and then type enter. You will then be asked if you wish to use the file "dynzon.nc". If you don't want to, simply type "enter".

Normally, at the end of execution, you should obtain a file called "your_file_GAM.nc" (if the original name was "your_file.nc").

Nota Bene : Here is a modified "alternative" script of angmom.F90, that don't take into account the dyzon.nc file, and, which is run only by this command :

./angmom.e your_file.nc

This is a way more practical use of it.

Nota Bene 2 : If you use angmom on a file that is a bit heavy, you will probably get an execution error, specifying that the machine has not been able to allocate enough memory. To remedy this, simply run a job in a compute node. The advantage of Nota Bene 1 is that it is easier to run the program in a compute node that is not necessarily interactive (using the "alternative" script).

Example of script job submission in this case (simply use sbatch your_submission_script) :

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --partition=zen16
#SBATCH --mem=24G
#SBATCH -J job_angmom
#SBATCH --time=1:00:00
#SBATCH --output=job_angmom.%j.out


source /your/path/trunk/ARCH/arch-ifort_MESOIPSL.env


./angmom.e your_file.nc > angmom.out 2>&1

You can follow the run of the program in angmom.out, using for example tail -f angmom.out.

Main programs (other than GCM) but included in the Venus PCM package

There are a few other main programs that are included with the GCM.

Advanced stuff: these main programs are located under LMDZ.VENUS/libf/dynphy_lonlat/phyvenus/ as they are at the interface between lon-lat dynamics and the Venus physics package

start2archive

This program collects multiple start.nc and startfi.nc files from a series simulations and store them in a start_archive.nc file. For this one simply needs to run the startarchive program in the directory. It will automatically fetch start.nc and startfi.nc files and generate start_archive.nc. If a start_archive.nc file is already present then the current start.nc and startfi.nc files are added to the start_archive.nc file (which can contain multiple initial states, as long as they are on the same grid and correspond to different dates.

The startarchive program should be compiled at the same resolution as the gcm which produced the start files, using the makelmdz_fcm compilation script

newstart

This program is to:

  • extract (and interpolate) restart.nc and restartfi.nc files from a start_archive.nc file or from a pair of start.nc and startfi.nc files. The subtle difference between the two setup is that grid interpolation (horizontal and/or vertical) is only possible if using a start_archive.nc input file
  • modify values and fields contained in the initial condition file
  • Compiling newstart is done using the makelmdz_fcm utility. The program is then meant to be run interactively with the user providing options and choices when prompted.
  • Once the program has run and finished without error, it will generate restart.nc and restartfi.nc

rearrange_startphy

In a nutshell, this program allows us to convert a start_archive.nc coming from Venus LMDZ simulation startfiles, into a start.nc and startphy.nc files, usable to begin a Venus - DYNAMICO simulation. You can find it here : /your/path/LMDZ.VENUS/Tools/startarchive2icosa/

Every step is well explained in the REAMDE file contained in the same directory.

The rcm1d 1D column program

The source code is located under LMDZ.VENUS/libf/phyvenus/dyn1d

... Compilation...