|
PHYEX 0.9.5
PHYsique EXternalisée
|
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.
phyex1d is part of the pyphyex package (see the Offline documentation):
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):
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):
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:
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:
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):
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. /
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).