One domain initialized and forced by ERA5
To perform a 3D Meso-NH simulation with real initial and surface conditions you need to prepare the physiographic data, prepare the initial and lateral boundary conditions and run the model using the PREP_PGD, PREP_REAL_CASE and MESONH executables respectively. In this example you will also use the DIAG program to calculate diagnostics after the simulation. These steps are described in the following sections:
Warning
This kind of simulation is parallelized and can be run with more than 1 core.
Note
You can find all the namelists presented in this section as well as the scripts here:
MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/
001_prep_pgd : directory to prepare the physiographic data
002_prep_real_case : directory to prepare the initial condition
003_mesonh : directory to run the model
004_diag : directory to calculate diagnostics after the simulation
005_python : directory to plot the figure
The different steps must be performed in the order indicated by the directory numbers.
Prepare the physiographic data (PREP_PGD)
To create the physiographic file you have to use PREP_PGD program. This program reads a file called PRE_PGD1.nam defining the characteristics of the simulation.
Tip
To see all the namelists you can use in the PREP_PGD program or to obtain information about namelists, please go here.
In the PRE_PGD1.nam file, we recommend to have the following minimum informations and namelists:
The name of the NetCDF file you will create with the PREP_PGD program (without the extension) in NAM_PGDFILE namelist:
&NAM_PGDFILE CPGDFILE = "PGD" /
Note
In this example, you will create a NetCDF file
PGD.nccorresponding to surface boundary conditions files.The kind of desired projection you will use in NAM_PGD_GRID namelist:
&NAM_PGD_GRID CGRID = "CONF PROJ" /
Note
In this example, you will use conformal projection and you also need to define charastetics of this projection filling NAM_CONF_PROJ and NAM_CONF_PROJ_GRID namelists.
The characteristic of the conformal projection in NAM_CONF_PROJ namelist:
&NAM_CONF_PROJ XLAT0 = 43.604, XLON0 = 1.444, XRPK = 0., XBETA = 0. /
The characteristic of the conformal projection grid in NAM_CONF_PROJ_GRID namelist:
&NAM_CONF_PROJ_GRID XLATCEN = 43.604, XLONCEN = 1.444, NIMAX = 50, NJMAX = 50, XDX = 10000., XDY = 10000. /
Note
In this example, you will use a grid of 50x50 horizontal grid points, with a horizontal resolution of 10 km and the domain will be centered in Toulouse (lon=43.604, lat=1.444).
The kind of cover database you want to use in NAM_COVER namelist:
&NAM_COVER YCOVER = "ECOCLIMAP_v2.0", YCOVERFILETYPE = "DIRECT" /
Note
In this example, you will use ECOCLIMAP_v2.0 database with more than 200 covers at 1 km horizontal resolution. Other database can be found here.
The kind of orography database you want to use in NAM_ZS namelist:
&NAM_ZS YZS = "gtopo30", YZSFILETYPE = "DIRECT" /
Note
In this example, you will use gtopo30 database at approximately 1 km horizontal resolution. Other database can be found here.
The kind of clay and sand database you want to use in NAM_ISBA namelist:
&NAM_ISBA YCLAY = "CLAY_HWSD_MOY", YCLAYFILETYPE = "DIRECT", YSAND = "SAND_HWSD_MOY", YSANDFILETYPE = "DIRECT" /
Note
In this example, you will use CLAY_HWSD_MOY and SAND_HWSD_MOY database at 1 km horizontal resolution. Other database can be found here.
Tip
See the full PRE_PGD1.nam file:
&NAM_PGDFILE CPGDFILE = "PGD" /
&NAM_PGD_GRID CGRID = "CONF PROJ" /
&NAM_CONF_PROJ XLAT0 = 43.604,
XLON0 = 1.444,
XRPK = 0.,
XBETA = 0. /
&NAM_CONF_PROJ_GRID XLATCEN = 43.604,
XLONCEN = 1.444,
NIMAX = 50,
NJMAX = 50,
XDX = 10000.,
XDY = 10000. /
&NAM_COVER YCOVER = "ECOCLIMAP_v2.0",
YCOVERFILETYPE = "DIRECT" /
&NAM_ZS YZS = "gtopo30",
YZSFILETYPE = "DIRECT" /
&NAM_ISBA YCLAY = "CLAY_HWSD_MOY",
YCLAYFILETYPE = "DIRECT",
YSAND = "SAND_HWSD_MOY",
YSANDFILETYPE = "DIRECT" /
This file is located here :
MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/001_prep_pgd/
You can launch PREP_PGD program using run_prep_pgd.sh script (execution takes less than 2 s):
cd MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/001_prep_pgd/
./run_prep_pgd.sh
At the end of the PREP_PGD execution, you need to have following files:
your_run_directory/
PRE_PGD1.nam : The file you’ve created from this example
PGD.nc : The NetCDF part of the physiographic data file
OUTPUT_LISTING0 : File containing debug informations
Tip
To verify that the program has been executed correctly, you should see the following lines at the end of the OUTPUT_LISTING0 file:
***************************
* PREP_PGD ends correctly *
***************************
Prepare the initial and lateral boundary conditions (PREP_REAL_CASE)
To create the initial and lateral boundary condition files for a real case Meso-NH simulation you have to use PREP_REAL_CASE program. This program reads a file called PRE_REAL1.nam defining the characteristics of the simulation.
Tip
To see all the namelists you can use in the PREP_REAL_CASE program or to obtain information about namelists, please go here.
Note
Before using PREP_REAL_CASE program to create initial and lateral boundary condition files for Meso-NH, you need to extract three dimensional Initialization of atmospheric and surface data. In this example, you have to extract ERA5 data. At the end of the extraction you need to have the two grib files era5.20251113.18 and era5.20251113.18.
In the PRE_REAL1.nam file, we recommend to have the following minimum informations and namelists:
The information about PGD file created in previous section in NAM_FILE_NAMES namelist:
&NAM_FILE_NAMES HPGDFILE = "PGD", HATMFILE = "era5.YEARMONTHDAY.HOUR", HATMFILETYPE = "GRIBEX", CINIFILE = "ERA5.YEARMONTHDAY.HOUR" /
Note
You will physiographic data file created in the previous step.
You need to run PREP_REAL_CASE program twice, replacing YEARMONTHDAY.HOUR with the correct dates of the grib files (20251113.18 and 20251113.19). The first file created with PREP_REAL_CASE program (
CINIFILE) will correspond to the initial condition and the second to the lateral boundary condition.
The vertical grid discretisation in NAM_VER_GRID namelist:
&NAM_VER_GRID NKMAX = 30, YZGRID_TYPE = "FUNCTN", ZDZGRD = 100., ZDZTOP = 3000., ZZMAX_STRGRD = 1500., ZSTRGRD = 10., ZSTRTOP = 15. /
Note
In this example, you will use 30 vertical grid points with a vertical resolution of 100 m close to the ground and a stretching until the top of the domain with a maximum grid spacing of 3000 m.
Tip
See the full PRE_REAL1.nam file:
&NAM_FILE_NAMES HPGDFILE = "PGD",
HATMFILE = "era5.YEARMONTHDAY.HOUR",
HATMFILETYPE = "GRIBEX",
CINIFILE = "ERA5.YEARMONTHDAY.HOUR" /
&NAM_VER_GRID NKMAX = 30,
YZGRID_TYPE = "FUNCTN",
ZDZGRD = 100.,
ZDZTOP = 3000.,
ZZMAX_STRGRD = 1500.,
ZSTRGRD = 10.,
ZSTRTOP = 15. /
This file is located here :
MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/002_prep_ideal_case/
You can launch PREP_REAL_CASE program using run_prep_real_case.sh script (execution takes less than 4 s):
cd MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/002_prep_real_case/
./run_prep_real_case.sh
At the end of the PREP_REAL_CASE execution, you need to have following files:
your_run_directory/
PRE_REAL1.nam : The file you’ve created from this example
ERA5.20251113.18.des : The descriptive part of the initial condition file
ERA5.20251113.18.nc : The NetCDF part of the initial condition file
ERA5.20251113.19.des : The descriptive part of the lateral boundary condition file
ERA5.20251113.19.nc : The NetCDF part of the lateral boundary condition file
PGD.nc : The NetCDF part of the physiographic data file
OUTPUT_LISTING0 : File containing debug informations
Tip
To verify that the program has been executed correctly, you should see the following lines at the end of the OUTPUT_LISTING1 file:
****************************************************
* PREP_REAL_CASE: PREP_REAL_CASE ENDS CORRECTLY. *
****************************************************
Launch the simulation (MESONH)
To launch the Meso-NH simulation you have to use MESONH program. This program reads a file called EXSEG1.nam defining the characteristics of the simulation.
Tip
To see all the namelists you can use in the MESONH program or to obtain information about namelists, please go here.
In the EXSEG1.nam file, we recommend to have the following minimum informations and namelists:
The name of the NetCDF files created by the PREP_PGD and PREP_REAL_CASE program in NAM_LUNITn namelist:
&NAM_LUNITn CINIFILE = "ERA5.20251113.18", CINIFILEPGD = "PGD", CCPLFILE(1) = "ERA5.20251113.19" /
The name of the experiment and segment and the configuration of the simulation in NAM_CONF namelist:
&NAM_CONF CCONF = "START", CEXP = "EXP01", CSEG = "SEG01" /
The simulated length (in s), the top absorbing layer coefficient and the activation of numerical diffusion in NAM_DYN namelist :
&NAM_DYN XSEGLEN = 60., LNUMDIFU = .TRUE., XALKTOP = 0.01, XALZBOT = 14000. /
The backup output writing period in NAM_BACKUP namelist:
&NAM_BACKUP XBAK_TIME(1,1) = 60.0 /
The time step, pressure solver option and the activation of the top absorbing layer in NAM_DYNn namelist:
&NAM_DYNn XTSTEP = 20., CPRESOPT = "CRESI", LHORELAX_UVWTH = .TRUE., LHORELAX_RV = .TRUE., LVE_RELAX = .TRUE., NRIMX = 5, NRIMY = 5, XT4DIFU = 1800. /
The temporal and advection schemes in NAM_ADVn namelist:
&NAM_ADVn CTEMP_SCHEME = "RKC4", CUVW_ADV_SCHEME = "CEN4TH", CMET_ADV_SCHEME = "PPM_01" /
The lateral boundary condition options NAM_LBCn namelist:
&NAM_LBCn CLBCX = 2*"OPEN", CLBCY = 2*"OPEN" /
Note
In this example you will use open boundary condition in i and j directions.
The physical parametrization options in NAM_PARAMn namelist:
&NAM_PARAMn CTURB = "TKEL", CRAD = "ECMW", CCLOUD = "ICE3", CSCONV = "EDKF", CDCONV = "NONE" /
Note
In this example, you will use turbulence, radiative, miscrophysics and shallow convection parametrizations.
The radiative parametrization options in NAM_PARAM_RADn namelist:
&NAM_PARAM_RADn XDTRAD = 300., XDTRAD_CLONLY = 300. /
The convective parametrization options in NAM_PARAM_KAFRn namelist:
&NAM_PARAM_KAFRn XDTCONV = 300. /
The turbulent parametrization options in NAM_TURBn namelist:
&NAM_TURBn CTURBLEN = "BL89", CTURBDIM = "1DIM" /
The frequent output options in NAM_OUTPUT namelist:
&NAM_OUTPUT COUT_VAR(1,1,1) = "INPRR", COUT_VAR(1,1,2) = "ACPRR", COUT_VAR(1,1,3) = "UT", COUT_VAR(1,1,4) = "VT", COUT_VAR(1,1,5) = "THT", COUT_VAR(1,1,6) = "RVT", XOUT_TIME_FREQ_FIRST = 0., XOUT_TIME_FREQ = 20., LOUT_REDUCE_FLOAT_PRECISION = T, COUT_DIR = "OUTPUT" /
Some SURFEX diagnostics in NAM_DIAG_SURFn namelist:
&NAM_DIAG_SURFn N2M = 2, LSURF_BUDGET = T, LRAD_BUDGET = T, LCOEF = T, LSURF_BUDGETC = T, LSURF_VARS = T /
Tip
See the full EXSEG1.nam file:
&NAM_LUNITn CINIFILE = "ERA5.20251113.18",
CINIFILEPGD = "PGD",
CCPLFILE(1) = "ERA5.20251113.19" /
&NAM_CONF CCONF = "START",
CEXP = "EXP01",
CSEG = "SEG01" /
&NAM_DYN XSEGLEN = 60.,
LNUMDIFU = .TRUE.,
XALKTOP = 0.01,
XALZBOT = 14000. /
&NAM_BACKUP XBAK_TIME(1,1) = 60. /
&NAM_DYNn XTSTEP = 20.,
CPRESOPT = "CRESI",
LHORELAX_UVWTH = .TRUE.,
LHORELAX_RV = .TRUE.,
LVE_RELAX = .TRUE.,
NRIMX = 5,
NRIMY = 5,
XT4DIFU = 1800. /
&NAM_ADVn CTEMP_SCHEME = "RKC4",
CUVW_ADV_SCHEME = "CEN4TH",
CMET_ADV_SCHEME = "PPM_01" /
&NAM_LBCn CLBCX = 2*"OPEN",
CLBCY = 2*"OPEN" /
&NAM_PARAMn CTURB = "TKEL",
CRAD = "ECMW",
CCLOUD = "ICE3",
CSCONV = "EDKF",
CDCONV = "KAFR" /
&NAM_PARAM_RADn XDTRAD = 300.,
XDTRAD_CLONLY = 300. /
&NAM_PARAM_KAFRn XDTCONV = 300. /
&NAM_TURBn CTURBLEN = "BL89",
CTURBDIM = "1DIM" /
&NAM_OUTPUT COUT_VAR(1,1,1) = "INPRR",
COUT_VAR(1,1,2) = "ACPRR",
COUT_VAR(1,1,3) = "UT",
COUT_VAR(1,1,4) = "VT",
COUT_VAR(1,1,5) = "THT",
COUT_VAR(1,1,6) = "RVT",
XOUT_TIME_FREQ_FIRST = 0.,
XOUT_TIME_FREQ = 20.,
LOUT_REDUCE_FLOAT_PRECISION = T,
COUT_DIR = "OUTPUT" /
&NAM_DIAG_SURFn N2M = 2,
LSURF_BUDGET = T,
LRAD_BUDGET = T,
LCOEF = T,
LSURF_BUDGETC = T,
LSURF_VARS = T /
This file is located here :
MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/003_mesonh/
You can launch MESONH program using run_mesonh.sh script (execution takes approximately 50 s on 2 cores):
cd MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/003_mesonh/
./run_mesonh.sh
At the end of the MESONH execution, you need to have following files:
your_run_directory/
PGD.nc : The NetCDF part of the physiographic data file
ERA5.20251113.18.des : The descriptive part of the initial condition file
ERA5.20251113.18.nc : The NetCDF part of the initial condition file
ERA5.20251113.19.des : The descriptive part of the lateral boundary condition file
ERA5.20251113.19.nc : The NetCDF part of the lateral boundar condition file
EXSEG1.nam : The file you’ve created from this example
EXP01.1.SEG01.000.des : The descriptive part of the simulated output file
EXP01.1.SEG01.000.nc : The NetCDF part of the simulated output file
EXP01.1.SEG01.001.des : The descriptive part of the simulated output file
EXP01.1.SEG01.001.nc : The NetCDF part of the simulated output file
OUTPUT_LISTING0 : File containing debug informations
OUTPUT_LISTING1 : File containing debug informations
Tip
The *.001.nc file contains NAM_BACKUP output. This file can be used to restart the simulation. It contains one time variables.
To verify that the program has been executed correctly, you should see the following lines at the end of the
OUTPUT_LISTING1file:|++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| | MODEL1 | CPUTIME || 87.282| 43.641| 43.607| 43.675| 100.000| | MODEL1 | ELAPSED || 87.481| 43.740| 43.740| 43.741| 100.000| |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| |++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| |====================================================================================================| | SECOND/STEP=61 | CPUTIME || 1.431| 0.715| 0.715| 0.716| 1.639| | SECOND/STEP=61 | ELAPSED || 1.434| 0.717| 0.717| 0.717| 1.639| |----------------------------------------------------------------------------------------------------| | MICROSEC/STP/PT=75000 | CPUTIME || 19.078| 9.539| 9.531| 9.546| 100.000| | MICROSEC/STP/PT=75000 | ELAPSED || 19.122| 9.561| 9.561| 9.561| 100.000| |====================================================================================================|
Compute diagnostics after the simulation (DIAG)
To compute diagnostics after a Meso-NH simulation you have to use DIAG program. This program reads a file called DIAG1.nam defining the characteristics of the diagnostics you want.
Tip
To see all the namelists you can use in the DIAG program or to obtain information about namelists, please go here.
In the DIAG1.nam file, we recommend to have the following minimum informations and namelists:
The name of input NetCDF files and the extension of the one created by the DIAG program in NAM_DIAG_FILE namelist:
&NAM_DIAG_FILE YINIFILE(1) = "EXP01.1.SEG01.001", YINIFILEPGD(1) = "PGD", YSUFFIX = "diag" /
Note
In this example, you will create a file called
EXP01.1.SEG01.001diag.nc.
The type of diag you want to perform in NAM_DIAG namelist :
&NAM_DIAG LISOAL = .TRUE., XISOAL(1) = 3000.0 /
Note
In this example, you will interpole some variables at a constant altitude of 500 m above sea level.
Tip
See the full DIAG1.nam file:
&NAM_DIAG_FILE YINIFILE(1) = "EXP01.1.SEG01.001",
YINIFILEPGD(1) = "PGD",
YSUFFIX = "diag" /
&NAM_DIAG LISOAL = .TRUE.,
XISOAL(1) = 500.0 /
This file is located here :
MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/004_diag/
You can launch DIAG program using run_diag.sh script (execution takes less than 15 s):
cd MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/004_diag/
./run_diag.sh
At the end of the DIAG execution, you need to have following files:
your_run_directory/
PGD.nc : The NetCDF part of the physiographic data file
DIAG1.nam : The file you’ve created from this example
EXP01.1.SEG01.001.des : The descriptive part of the simulated output file
EXP01.1.SEG01.001.nc : The NetCDF part of the simulated output file
EXP01.1.SEG01.001diag.nc : The NetCDF part of the diagnostic output file
OUTPUT_LISTING0 : File containing debug informations
OUTPUT_LISTING1 : File containing debug informations
Tip
To verify that the program has been executed correctly, you should see the following lines at the end of the OUTPUT_LISTING0 file:
***************************** **************
* EXIT DIAG CORRECTLY *
**************************** ***************
Plot results
You can plot the results using run_python.sh script (execution takes less than few seconds):
cd MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/005_python/
./run_python.sh
The figure created visible shows an example of a graph that you can plot from the simulation you just performed. It shows a classic episode of the Autan wind. Gray areas correspond to mountain higher than 500 m.
Example of real case simulation output. Horizontal wind speed at 500 m a.s.l.
Tip
See the python script used to plot this figure:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import numpy as np
import netCDF4
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# #########################################################
# ### To be defined by user ###
# #########################################################
cfg_file_name = 'EXP01.1.SEG01.001diag.nc'
# #########################################################
# ------------------------------------------------------
# Read netcdf file and variables
# ------------------------------------------------------
file_MNH = netCDF4.Dataset(cfg_file_name)
lon_MNH = file_MNH['LON'][1:-1,1:-1]
lat_MNH = file_MNH['LAT'][1:-1,1:-1]
zs_MNH = file_MNH['ZS'][1:-1,1:-1]
uwnd_MNH = file_MNH['ALT_U'][0,0,1:-1,1:-1]
vwnd_MNH = file_MNH['ALT_V'][0,0,1:-1,1:-1]
mask_MNH = uwnd_MNH < -1000.0
uwnd_MNH_masked = np.ma.masked_where(mask_MNH, uwnd_MNH)
vwnd_MNH_masked = np.ma.masked_where(mask_MNH, vwnd_MNH)
wnd_MNH_masked = np.sqrt(uwnd_MNH_masked**2.0+vwnd_MNH_masked**2.0)
# ------------------------------------------------------
# Quick plot
# ------------------------------------------------------
fig = plt.figure(figsize=(6, 6))
ax = plt.axes(projection=ccrs.PlateCarree())
pmsh = ax.contourf(lon_MNH[:,:], lat_MNH[:,:], wnd_MNH_masked[:,:], vmin=0.0, vmax=30.0, shading="auto", cmap="viridis")
ctf = ax.contourf(lon_MNH[:,:], lat_MNH[:,:], mask_MNH[:,:], levels=[0.5, 1], colors='lightgray')
qvr = ax.quiver (lon_MNH[::2,::2], lat_MNH[::2,::2], uwnd_MNH_masked[::2, ::2], vwnd_MNH_masked[::2, ::2], color="gray")
# ------------------------------------------------------
# Some adjustments to the plot
# ------------------------------------------------------
gl = ax.gridlines(draw_labels=True, linewidth=0.4, color='gray', linestyle='--')
gl.top_labels = False
gl.right_labels = False
ax.coastlines()
cbar =plt.colorbar(pmsh,shrink=0.59)
cbar.set_label(r"Wind speed at 500 m a.s.l. [m.s$^{-1}$]")
ax.plot(1.444, 43.604, marker='o', color='m', markersize=6)
ax.text(1.444, 43.604+0.1, "Toulouse", color='m', fontsize=10, ha='center', va='bottom')
plt.savefig('one_domain_era5.png', bbox_inches='tight', dpi=400)
This file is located here : MNH-V6-0-0/examples/tutorials/real_cases/1domain_from_ERA5/005_python/
Other examples
You can find real case simulation examples in Namelist catalogue section.