PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
PHYEX1D: 1D MODEL USING PHYEX

About this section

The phyex1d module of the pyphyex python package runs 1D atmospheric simulations using ideal cases described in a "common format" file (or built from xarray data). The physics is provided by the PHYEX package (through the python binding, pyphyex.lowlevel), the same as the one used by the Meso-NH and AROME models. A simplified physics, not using PHYEX, is also available.

Installation

phyex1d is part of the pyphyex package (see the Offline documentation):

pip install pyphyex # from PyPI
pip install ./PHYEX # or from a clone of the PHYEX repository

The ecRad radiation scheme is used through the pyecrad package, installed as a dependency from PyPI (as pyecrad-SR, built from the pyecrad-main branch of ecRad, until pyecrad is published by ECMWF). Prebuilt wheels are available for Linux (x86_64 and aarch64); elsewhere, the installation compiles ecRad from the source distribution: a Fortran compiler, CMake and NetCDF-Fortran are then needed (see the pyecrad documentation for the build options). A development version of pyecrad can be used instead with the 'pyecrad' option of the PHYEX physics (path to the pyecrad package directory, the libecrad4py library being given by the PYECRAD_LIBRARY environment variable).

This installs the following commands (each of them has a -h option):

  • phyex1d-cases_install: install the DEPHY-SCM cases (download or link)
  • phyex1d-cases_list: list the installed DEPHY-SCM cases
  • phyex1d-exp_run: run experiments on a case
  • phyex1d-exp_list: list the experiments having results
  • phyex1d-exp_plot: plot the results of experiments
  • phyex1d-exp_2nc: convert the results of an experiment into a dephycf netCDF file
  • phyex1d-grid_list: list the available vertical grids
  • phyex1d-grid_show: print the description of a vertical grid
  • phyex1d-namel_list: list the available namelists
  • phyex1d-namel_show: print the content of a namelist

Cases

The cases in the common format are provided by the DEPHY-SCM repository. They are installed in ${PHYEXCONF}/phyex1d/DEPHY-SCM (the PHYEXCONF environment variable defaults to ${HOME}/.phyex):

phyex1d-cases_install download # clone (or update) the DEPHY-SCM repository (about 1 GB)
phyex1d-cases_install link PATH # or use an existing DEPHY-SCM repository (symbolic link)
phyex1d-cases_list # list of the cases (CASE/SUBCASE) and of their driver files

Experiments

An experiment is run on a case given by the name of an installed case (CASE/SUBCASE) or by the path to a netCDF driver file. For instance, the ARMCU case can be run with the PHYEX physics (default) and with the simplified physics:

phyex1d-exp_run ARMCU/REF -o out --name armcu --exp dt=60 name=phyex \
--exp dt=60 name=simple class=SimplePhysicsTQ
phyex1d-exp_list -o out --name armcu
phyex1d-exp_plot -o out --name armcu --exp phyex --plot rc.png y_var=P rc

And a rc plot (time evolution) is available in the rc.png file. With the times option, profiles are plotted at the given output times (in seconds), e.g. –plot rc_prof.png y_var=P times=3600,7200 rc. Variable names can contain wildcards (quoted), and the nonzero=<threshold> option removes the negligible variables, e.g. –plot rc_bu.png y_var=P times=3600 nonzero=1e-3 'bu_*_RC_*' for the main budgets of rc.

Each –exp option describes an experiment with key=value strings: dt (timestep), name, grid, class (physics class: PhysicsAromeTQ, PhysicsAromeThetaR, SimplePhysicsTQ or SimplePhysicsThetaR) and the options of the physics class (namelist for the PHYEX physics, activation of the different processes for the simplified physics...). The list of the keys, with their default values, is given by phyex1d-exp_run -h.

The results are stored in OUTPUT_DIR/<comparison name>/<experiment name>.hdf5 (OUTPUT_DIR is given by the -o option and the comparison name by the –name option). An experiment is not run again if its result file exists (use –force).

phyex1d-exp_2nc converts the results of an experiment (designated with the -o, –name and –exp options) into a netCDF file following the DEPHY common format for SCM outputs (dephycf, as done by EMS: names, units and attributes of examples/post.dephycf/variables.py, levf/levh/time dimensions), e.g. phyex1d-exp_2nc -o out –name armcu –exp phyex armcu_phyex.nc. Variables without dephycf equivalent are written with their phyex1d name, and budgets are summed by scheme and converted into the dephycf tendencies (tnta_turb, tnqv_micro, tnua_geo...).

With the budgets=True option of the PhysicsArome* classes (e.g. –exp class=PhysicsAromeThetaR budgets=True), the contribution of each process is added to the output, as bu_<scheme>_<variable>_<process> variables. They are tendencies (s-1 units) of the time step ending at the output time, for the variables U, V, W, TH (potential temperature, even with the T and q prognostic variables), TKE, RV, RC... (mixing ratios, even with the specific contents as prognostic variables). The schemes are:

  • adjust, shallow, turb and micro: budgets computed by PHYEX (with the PHYEX names of the processes);
  • rad: radiation computed by ecRad (LW and SW processes);
  • forc: large-scale forcings (ADV for advection, RAD for prescribed radiation, SUBS for the vertical advection by the prescribed vertical velocity, GEO for the geostrophic wind, NUD for nudging);
  • driver: operations done by the 1D model (TKEMIN for the minimum value of TKE, NEGA for the removal of the negative values after the vertical advection);
  • all: TOT is the total tendency (difference between the end and the beginning of the time step) and RES is the residual (total tendency minus the sum of all the other budgets).

The list of the processes is obtained by computing a first time step on a copy of the initial state.

Grids (.grid files) and namelists (.namel files) are searched in ${PHYEXCONF}/phyex1d/grids and ${PHYEXCONF}/phyex1d/namelists, then in the package. The description of the .grid file format is given by the docstring of the pyphyex.phyex1d.Grid class. phyex1d-grid_list lists the available grids (name, kind, number of levels and location: internal for a grid of the package, the file name for a grid of the user directory, or internal overridden by the file name), and phyex1d-grid_show GRID prints a grid description, which can be used as a starting point for a new grid (phyex1d-grid_show L90arome > ${PHYEXCONF}/phyex1d/grids/mygrid.grid). In the same way, phyex1d-namel_list lists the available namelists (name and location) and phyex1d-namel_show NAMELIST prints the content of a namelist.

Besides the PHYEX namelists, the PHYEX group of the namelist selects the schemes of the 1D model: CMICRO, CSCONV, CTURB (PHYEX schemes), RAD (ECRAD or NONE) and SURFACE.

With CMICRO='LIMA' (options in the NAM_PARAM_LIMA namelist), the LIMA concentrations are added to the state as lima_<name> variables (lima_NC, lima_NR, lima_CCN_FREE01, lima_NI...). As in Meso-NH, the free aerosol concentrations are initialised from XCCN_CONC/LCCN_HOM and XIFN_CONC/LIFN_HOM, the hydrometeor concentrations are deduced from the initial mixing ratios (SET_CONC_LIMA) and the others are null. The concentrations are transported by the turbulence, the shallow convection and the large-scale vertical advection. The CACTCCN key of the PHYEX group (default 'NONE') gives the CCN activation scheme. The surface scheme computes the surface fluxes that are not prescribed by the case (surface_forcing_* attributes of the DEPHY format):

  • WASP (default): ocean flux scheme, using the prescribed surface temperature;
  • BETA: simple bulk scheme of LMDZ, using the prescribed surface temperature, with an evaporation efficiency beta (1 over ocean, smaller values for land surfaces). BETA_TYPE='CASE' (default) takes beta in the case description (if absent, 1 over ocean, sea ice and land ice, error over land), BETA_TYPE='CONSTANT' takes the BETA key of the PHYEX group. Z0_TYPE='CASE' (default) takes the roughness lengths in the case description, Z0_TYPE='CONSTANT' takes the Z0 and Z0H keys (Z0H defaulting to Z0), Z0_TYPE='CHARNOCK' computes z0 with the Charnock formula;
  • NONE: null fluxes.

The LSTAB key (default .FALSE.) activates the stability correction of the BETA scheme (Louis functions) and of the momentum flux computed from a prescribed roughness length (Monin-Obukhov, surface_forcing_wind='z0'). Example: &PHYEX SURFACE='BETA', LSTAB=.TRUE. /

Usage from python

The experiments can also be run from python, with the ExperimentRunner class (pyphyex.phyex1d module). Instead of using a netCDF driver file, a case can be built programmatically from an xarray Dataset using the CaseXarray class. Complete examples with profiles, forcing and plots are available in the src/pyphyex/phyex1d/examples directory (case_xarray_demo.py with the PHYEX physics, and case_xarray_simple.py with the simplified physics).