{ "cells": [ { "cell_type": "markdown", "id": "cb3e8e38-7039-4754-a4e0-db980bc8c7b6", "metadata": {}, "source": [ "
\n", "\n", "

ICON Training - Hands-on Session

\n", "\n", "# Optional Exercise 1: Tracer Advection\n", "\n", "---\n", "\n", "
\n", "\"alt_text\"/\n", "
Vertical cross sections of predefined initial tracer distributions.
\n", " Tracer q3 only depends on the latitudinal position, while q4 is constant. \n", "
\n", "
\n", "\n", "The Jablonowski-Williamson (JW) test case provides a set of four predefined tracer initial conditions which can be activated \n", "or deactivated via namelist (see the figure on the right). \n", "Here, you will learn **how to enable and control the transport of passive tracers** in an idealized test.\n", "See the Tutorial book, Sections 4.2.2 and 3.6.5, for details on the configuration of the tracer transport for standard NWP runs.\n", "\n", "For simplicity, we make use of the following scripts and namelists from the previous JW exercises:\n", "\n", "* the master namelist file (**icon_master.namelist**)\n", "* the model namelist file for the nested setup (**NAMELIST_NWP**)\n", "* the ICON batch job (**icon.sbatch**)" ] }, { "cell_type": "markdown", "id": "197b2a60-7459-4e92-8d9a-f680551af671", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "
\n", " Exercise (Setup): \n", "
\n", " Execute the following cell, in order to\n", " \n", "
" ] }, { "cell_type": "code", "execution_count": null, "id": "eccee5ab-ad5e-4d5e-ba1d-ef516e52d65a", "metadata": { "tags": [] }, "outputs": [], "source": [ "# base directory for ICON sources and binary:\n", "export ICONDIR=/pool/data/ICON/ICON_training/icon/\n", "\n", "# directory with input grids:\n", "export GRIDDIR=/pool/data/ICON/ICON_training/exercise_idealized/grids/\n", "\n", "# absolute path to directory with plenty of space:\n", "export SCRATCHDIR=/scratch/${USER::1}/$USER\n", "export EXPDIR=$SCRATCHDIR/exercise_idealized/exp_JW_R02B04_adv\n", "if [ ! -d $EXPDIR ]; then\n", " mkdir -p $EXPDIR\n", "fi\n", "\n", "# visualization settings\n", "export SCRIPTDIR=$HOME/icon-training-scripts/exercise_idealized/plot_scripts\n", "\n", "# copy prepared Namelists and batch script\n", "cp /pool/data/ICON/ICON_training/exercise_idealized/NAMELIST_NWP $EXPDIR/\n", "cp /pool/data/ICON/ICON_training/exercise_idealized/icon_master.namelist $EXPDIR/\n", "cp /pool/data/ICON/ICON_training/exercise_idealized/icon.sbatch $EXPDIR/\n", "\n", "# grid files: link to experiment directory\n", "ln -sf ${GRIDDIR}/icon_grid_00*.nc ${EXPDIR}/." ] }, { "cell_type": "markdown", "id": "e2a82937-0f36-41fb-be52-430db4f84ea8", "metadata": {}, "source": [ "In the above settings we used the `scratch` partition of the file system, with a quota of 15 TiB (see `/sw/bin/lfsquota.sh -u $USER`)." ] }, { "cell_type": "markdown", "id": "8f8c8596-4cc7-43cf-acf4-e645feeba8a3", "metadata": {}, "source": [ "###" ] }, { "cell_type": "markdown", "id": "bd693a87-7413-437d-b418-50510bee3909", "metadata": {}, "source": [ "In the namelist file **NAMELIST_NWP** we have omitted the namelists `run_nml`, `nh_testcase_nml` and the output namelists `output_nml`, as we are going to recreate them for a setup with tracers." ] }, { "cell_type": "markdown", "id": "bb6f4ffb-fbc3-4517-84a7-234f916ce231", "metadata": {}, "source": [ "
\n", " Exercise (Enabling the transport of one or more passive tracers):\n", "
\n", " In order to enable tracer advection for the JW test, adapt the namelist settings in the cell below as follows:\n", " \n", "
" ] }, { "cell_type": "code", "execution_count": null, "id": "4a98cdfb-aebd-4300-882a-64d1c24f6dd9", "metadata": {}, "outputs": [], "source": [ "cat >> $EXPDIR/NAMELIST_NWP << EOF\n", "\n", "! run_nml: general switches ---------------------------------------------------\n", "&run_nml\n", " ltestcase = .TRUE. ! idealized testcase runs\n", " num_lev = 40,40,40 ! number of full levels (atm.) for each domain\n", " lvert_nest = .FALSE. ! vertical nesting\n", " dtime = 1440. ! timestep in seconds\n", " ldynamics = .TRUE. ! compute adiabatic dynamic tendencies\n", " ltransport = ?????????? ! main switch for large-scale tracer transport\n", " ntracer = ?????????? ! number of advected tracers\n", " iforcing = 0 ! pure dynamics (no physics forcing)\n", " msg_level = 10 ! controls how much printout is written during runtime\n", " ltimer = .FALSE. ! timer for monitoring the runtime of specific routines\n", " output = \"nml\" ! main switch for enabling/disabling components of the model output\n", "/\n", "\n", "! nh_testcase_nml: idealized testcase specification --------------------------\n", "&nh_testcase_nml\n", " nh_test_name = \"jabw\" ! testcase selection\n", " jw_up = 1.0 ! amplitude of u-perturbation [m/s]\n", " tracer_inidist_list = ?????????? ! choosing from a list of predefined tracer distributions\n", "/\n", "\n", "! transport_nml: tracer transport ---------------------------------------------\n", "!&transport_nml\n", "! ivadv_tracer = 3, 3, 3, 3 ! tracer specific method to compute vertical advection\n", "! ihadv_tracer = 2, 2, 2, 2 ! tracer specific method to compute horizontal advection\n", "! itype_hlimit = 0, 0, 0, 0 ! type of limiter for horizontal transport\n", "! itype_vlimit = 0, 0, 0, 0 ! type of limiter for horizontal transport\n", "! beta_fct = 1.005 ! factor of allowed over-/undershooting in monotonous limiter\n", "!/\n", "EOF" ] }, { "cell_type": "markdown", "id": "be316a53-8023-458d-8fb4-32a87e96b671", "metadata": {}, "source": [ "
\n", " Exercise (Extend the output namelist):\n", " \n", " Note: In idealized tests, tracers are named qx, where x is a number indicating the position of the tracer within the ICON-internal 4D tracer memory.
\n", " For this testcase, tracer 1 is named q1, and so on.
\n", " These default names can be overwritten with the namelist variable tracer_names (transport_nml). See Section 4.2.2 of the tutorial for details. \n", "
" ] }, { "cell_type": "code", "execution_count": null, "id": "cd807804-2166-46c7-85be-3c81b351a9ef", "metadata": {}, "outputs": [], "source": [ "cat >> $EXPDIR/NAMELIST_NWP << EOF\n", "\n", "! output_nml: specifies an output stream --------------------------------------\n", "! model level output on native (triangular) grid\n", "&output_nml\n", " filetype = 4 ! output format: 2=GRIB2, 4=NETCDFv2\n", " dom = -1 ! write all domains\n", " output_bounds = 0., 10000000., 86400. ! output: start, end, increment\n", " steps_per_file = 30 ! number of output steps in one output file\n", " mode = 1 ! 1: forecast mode (relative t-axis), 2: climate mode (absolute t-axis)\n", " include_last = .TRUE. ! flag whether to include the last time step\n", " output_filename = 'exp3_JW' ! file name base\n", " output_grid = .TRUE. ! flag whether grid information is added to output.\n", " !\n", " ml_varlist = 'u', 'v', 'w', 'temp', 'pres','topography_c', 'pres_sfc', 'vor', 'div', ?????????\n", "/\n", "\n", "! output_nml: specifies an output stream --------------------------------------\n", "! pressure level output on native grid\n", "&output_nml\n", " filetype = 4 ! output format: 2=GRIB2, 4=NETCDFv2\n", " dom = -1 ! write all domains\n", " output_bounds = 0., 10000000., 86400. ! output: start, end, increment\n", " steps_per_file = 30 ! number of output steps in one output file\n", " mode = 1 ! 1: forecast mode (relative t-axis), 2: climate mode (absolute t-axis)\n", " include_last = .TRUE. ! flag whether to include the last time step\n", " output_filename = 'exp3_JW' ! file name base\n", " output_grid = .TRUE. ! flag whether grid information is added to output.\n", " remap = 0 ! no remapping (native grid)\n", " !\n", " pl_varlist = 'temp', 'vor', 'div', ?????????\n", " p_levels = 50000.,60000.,70000.,85000.,92500. ! pressure levels in Pa\n", "/\n", "\n", "! output_nml: specifies an output stream --------------------------------------\n", "! model level output on regular lat/lon grid\n", "&output_nml\n", " filetype = 4 ! output format: 2=GRIB2, 4=NETCDFv2\n", " dom = -1 ! write all domains\n", " output_bounds = 0., 10000000., 86400. ! output: start, end, increment\n", " steps_per_file = 30 ! number of output steps in one output file\n", " mode = 1 ! 1: forecast mode (relative t-axis), 2: climate mode (absolute t-axis)\n", " include_last = .TRUE. ! flag whether to include the last time step\n", " output_filename = 'exp3_JW_lonlat' ! file name base\n", " output_grid = .TRUE. ! flag whether grid information is added to output.\n", " remap = 1 ! remap to regular lat/lon grid\n", " reg_lat_def = -90.,1.0,90. ! start, increment, end latitude in degrees \n", " reg_lon_def = 0.,1.0,359.0 ! start, increment, end longitude in degrees\n", " !\n", " ml_varlist = 'u', 'v', 'w', 'temp', 'pres','topography_c', 'pres_sfc', 'vor', 'div', ??????????\n", "/\n", "EOF" ] }, { "cell_type": "markdown", "id": "67ce2710-99b6-4f1c-97ac-ef44ad208cc1", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "source": [ "
\n", "Solution\n", "
\n",
    "\n",
    "&run_nml\n",
    " ltransport                  =                      .TRUE.        ! main switch for large-scale tracer transport\n",
    " ntracer                     =                          4         ! number of advected tracers\n",
    "\n",
    "! nh_testcase_nml: idealized testcase specification --------------------------\n",
    "&nh_testcase_nml\n",
    " nh_test_name                =                        \"jabw\"      ! testcase selection\n",
    " jw_up                       =                          1.0       ! amplitude of u-perturbation [m/s]\n",
    " tracer_inidist_list         =                 1, 2, 3, 4         ! choosing from a list of predefined tracer distributions\n",
    "/\n",
    "\n",
    "! transport_nml: tracer transport ---------------------------------------------\n",
    "&transport_nml\n",
    " tracer_names                =                'q1','q2','q3','q4'\n",
    " ivadv_tracer                =                 3, 3, 3, 3         ! tracer specific method to compute vertical advection\n",
    " ihadv_tracer                =                 2, 2, 2, 2         ! tracer specific method to compute horizontal advection\n",
    " itype_hlimit                =                 4, 0, 0, 0         ! type of limiter for horizontal transport\n",
    " itype_vlimit                =                 3, 0, 0, 0         ! type of limiter for horizontal transport\n",
    " beta_fct                    =                          1.005     ! factor of allowed over-/undershooting in monotonous limiter\n",
    "/\n",
    "\n",
    "&output_nml 1\n",
    " ml_varlist                  =  'u', 'v', 'w', 'temp', 'pres','topography_c', 'pres_sfc', 'vor', 'div', 'q1', 'q2', 'q3', 'q4'\n",
    "\n",
    "&output_nml 2\n",
    " pl_varlist                  =  'temp', 'vor', 'div', 'q1', 'q2', 'q3', 'q4'\n",
    "\n",
    "&output_nml 3\n",
    " ml_varlist                  =  'u', 'v', 'w', 'temp', 'pres','topography_c', 'pres_sfc', 'vor', 'div', 'q1', 'q2', 'q3', 'q4'\n",
    "\n",
    "
\n", "
" ] }, { "cell_type": "markdown", "id": "66ac6921-0827-4c79-988b-8e047a19fe61", "metadata": {}, "source": [ "### Running the ICON model" ] }, { "cell_type": "markdown", "id": "6a73dfae-f72f-4a63-80ba-4a04df0fb750", "metadata": {}, "source": [ "
\n", " Exercise: \n", " Submit the job script icon.sbatch to the HPC cluster, using the Slurm command sbatch.\n", "
" ] }, { "cell_type": "code", "execution_count": null, "id": "5cc1dbbe-e4bd-40a1-becd-e15dd41e5855", "metadata": {}, "outputs": [], "source": [ "cd $EXPDIR && sbatch --account=$SLURM_JOB_ACCOUNT icon.sbatch" ] }, { "cell_type": "markdown", "id": "33cf52e5-f9d0-4654-b29a-7271f398d3c9", "metadata": {}, "source": [ "Check the job status using the Slurm command `squeue`" ] }, { "cell_type": "code", "execution_count": null, "id": "98d8790a-5879-493a-bb7d-fc98f6b26aa8", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "37ef113f-1479-4dd8-92b7-256c1f64a718", "metadata": {}, "source": [ "### Visualizaton" ] }, { "cell_type": "markdown", "id": "021aa706-84e5-4603-8f71-cf56966c36e9", "metadata": {}, "source": [ "
\n", " Exercise (Visualization):\n", "
\n", " We suggest to have a look at the results usingncview, as it is useful to scan through different levels and time steps. To do so, please log in with your account $USER@levante.dkrz.de using your SSH client (e.g. PuTTY). After login, first load the ncview module: module load ncview.\n", " \n", "
" ] }, { "cell_type": "raw", "id": "bc2cd8bd-86bc-425d-b8ca-ffb3d174921c", "metadata": {}, "source": [ "Your answer:" ] }, { "cell_type": "markdown", "id": "fcd2a2fd-12a6-484a-9ab2-f6a6caf43ac0", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "source": [ "
\n", "Solution\n", "Answer:\n", "\n", "Yes, the ICON transport is constancy preserving for the global domain as well as for nested domain(s). The given run is a two-way nested run, as can be inferred from the namelist variable lfeedback=.TRUE. (grid_nml). Hence the given run is sufficient to answer this question.\n", "\n", "No, the global maximum and minimum values of q1 are not preserved over time. In particular the global minimum value falls below zero. The transport scheme is creating spurious undershoots (and overshoots) in the advected field.\n", "
" ] }, { "cell_type": "markdown", "id": "3924f3d1-1b9e-470f-9de1-54fb087ee91c", "metadata": {}, "source": [ "
\n", " Exercise (Avoiding non-physical overshoots and undershoots):\n", "
\n", " Any higher-order transport scheme generates spurious overshoots and undershoots in the advected quantity. \n", " In particular, undershoots can lead to numerical instabilities in real case NWP runs and must be avoided.\n", " \n", "
" ] }, { "cell_type": "markdown", "id": "2a611ea0-2145-41f0-8939-112cfbc8573f", "metadata": {}, "source": [ "Your answer:\n", "\n", "`itype_hlimit` = ... \n", "`type_vlimit` = ..." ] }, { "cell_type": "markdown", "id": "7d2ac2c4-eda5-4709-a085-6f931cacf9ea", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [ "hide-input" ] }, "source": [ "
\n", "Solution\n", "\n", "Possible answer: \n", "`itype_hlimit` = 4, 0, 0, 0 \n", "`type_vlimit` = 3, 0, 0, 0\n", "\n", "
" ] }, { "cell_type": "markdown", "id": "82a12b80-1759-478d-8951-42b3b8cadcab", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "---" ] }, { "cell_type": "markdown", "id": "f65dd927-4aa2-4349-9e96-313b1c3277f9", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "

Congratulations! You have successfully completed optional Exercise 1.

" ] }, { "cell_type": "markdown", "id": "146116f1-a899-4a7c-8662-c5e42a3e1423", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "---" ] }, { "cell_type": "markdown", "id": "67ec8744-8de1-4143-b166-f57526c91be3", "metadata": {}, "source": [ "## Further Reading and Resources\n", "\n", "- ICON Tutorial, Ch. 4: https://www.dwd.de/DE/leistungen/nwv_icon_tutorial/nwv_icon_tutorial.html\n", "
A new draft version of the ICON Tutorial is available here: https://icon-training-2025-scripts-rendering-cc74a6.gitlab-pages.dkrz.de/index.html. It is currently being finalized and will be published soon.\n" ] }, { "cell_type": "markdown", "id": "cee681f0-8568-4254-b946-7e96a7c88d6d", "metadata": {}, "source": [ "---\n", "\n", "*Author info: Deutscher Wetterdienst (DWD) 2025 :: icon@dwd.de. For a full list of contributors, see CONTRIBUTING in the root directory. License info: see LICENSE file.*" ] } ], "metadata": { "kernelspec": { "display_name": "Bash", "language": "bash", "name": "bash" }, "language_info": { "codemirror_mode": "shell", "file_extension": ".sh", "mimetype": "text/x-sh", "name": "bash" } }, "nbformat": 4, "nbformat_minor": 5 }