WRF dynamical core for LES/mesoscale simulations

From Planets
Revision as of 16:21, 20 June 2025 by Noe clement (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

WRF is a mesoscale numerical weather prediction system designed for both atmospheric research and operational forecasting applications over the Earth's atmosphere: see WRF presentation.

In the PCM, we take advantage of the dynamical core of the WRF model to run LES (large-eddy simulations) or mesoscale simulations.

To do so, we take the WRF model, remove all its physical packages related to the Earth's atmosphere, and plug in the physical package from the PCM (either Venus, Mars, Titan, or Generic).

A description of the various equations solved by WRF can be found here: Skamarock et al. (2019, 2021).

Studies with PCM+WRF

Descriptions of the application of WRF dynamical core with the PCM can be found in:

- Noé CLEMENT's PhD thesis (chapter 3) for the Generic PCM.

- Maxence Lefevre's PhD thesis for the Venus PCM.

- Aymeric Spiga's PhD thesis for the Mars PCM

Studies with the PCM coupled to the WRF dynamical core have been done using WRF V2, WRF V3, WRF V4.

Our aim is now to use WRF V4 as much as possible, which offers significant improvements in terms of numerical schemes in particular.

Here is a list of studies using the PCM coupled to the WRF dynamical core:

Planet Reference Physical package Dynamical core
Mars Spiga and Forget (2009) Mars PCM WRF V2
Mars Spiga et al. (2010) Mars PCM WRF V3
Venus Lefèvre et al. (2018) Venus PCM WRF V3
Venus Lefèvre et al. (2020) Venus PCM WRF V2
Exoplanets Lefèvre et al. (2021) Generic PCM WRF V3
Exoplanets Leconte et al. (2024) Generic PCM WRF V4
Uranus, Neptune Clément et al. (2024) Generic PCM WRF V4

Remarks

For advanced users:

When compiling the model, the flags:

#ifndef MESOSCALE
      use ...
#else
      use ...

select lines compiled depending on the configuration.

WRF equations

Below is a synthesis of equations solved by WRF.

WRF dynamical core.png

Installing PCM+WRF

3 git repositories to handle:

- LES_planet_workflow

- git-trunk (physics & GCM dynamical core)

- WRFV4 (dynamics)

The first is hosted on Aymeric Spiga's git, and will download (git clone) the two others which are part of La communauté des modèles atmosphériques planétaires repositories.

Terrestrial WRF

Compiling terrestrial WRF is a good first step.

"git clone --recurse-submodules https://github.com/wrf-model/WRF"

Commands:

./configure

then

./compile em_les

WRF compilation can take some time. Consider doing:

nohup ./compile em_les &

Final built executables will be: "ideal.exe" and "wrf.exe"

These will be the same for the PCM+WRF. "ideal.exe" prepares the domain. "wrf.exe" runs the simulation.

WRF+PCM

The modifications we make in these files aim to incorporate the Physics of the PCM as a library, as well as the interface between WRF and the PCM.

On any cluster, one has to build a file "mesoscale.env" which should look more or less like:

# mesoscale.env file

source YOUR_ifort_ENV

# for WRFV4
declare -x WRFIO_NCD_LARGE_FILE_SUPPORT=1

declare -x NETCDF=`nf-config --prefix`
declare -x NCDFLIB=$NETCDF/lib
declare -x NCDFINC=$NETCDF/include

# PCM/WRFV4 interface
declare -x LMDZ_LIBO='code/LMDZ.COMMON/libo/YOUR_ARCH_NAME'

On ADASTRA:

# mesoscale.env file

source code/LMDZ.COMMON/arch/arch-ADASTRA-ifort.env

# for WRFV4
declare -x WRFIO_NCD_LARGE_FILE_SUPPORT=1

declare -x NETCDF=$NETCDF_DIR
# alternatively: declare -x NETCDF=`nf-config --prefix`
declare -x NCDFLIB=$NETCDF/lib
declare -x NCDFINC=$NETCDF/include

# specific to ADASTRA
declare -x NETCDF_classic=1

# fix for "undefined symbol: __libm_feature_flag" errors at runtime:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NETCDF_DIR/lib

# PCM/WRFV4 interface
declare -x LMDZ_LIBO=code/LMDZ.COMMON/libo/ADASTRA-ifort

This file should be sourced before performing compilation steps. Ideally, it will be integrated automatically (no need to source manually). It should also be sourced before executing the compiled files to run simulations.

In case of a failed compilation, the command

./clean -a

in the WRFV4 directory allows you to remove intermediate compiled files.