Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
1 result

msc-climate-modeling-lab-s2025-code-4-students

  • Clone with SSH
  • Clone with HTTPS
  • Climate Modelling Lab, MSc Meteorology, elective class, S2024 (280351 VU)

    General tools and tipps can be found at the project wiki.

    Recipe for lecturer: generate a tarball with the icon model code for distribution to students

    Get model code from branch climmodlab_s2023:

    git clone https://gitlab.phaidra.org/climate/icon-esm-univie.git
    git checkout origin/climmodlab_s2023

    Configure following the recipe for the students. Then create a distribution tarball:

    make dist

    This leads to the file icon-2.6.0.tar.bz2, which can then be distributed to the students.

    Recipe for students: how to get, configure and compile ICON on VSC4

    Get and untar the tarball and enter the model code directory:

    cp  /gpfs/data/fs72044/avoigt_teach/icon-2.6.0.tar.bz2 /gpfs/data/fs72044/iconAB
    tar xfv icon-2.6.0.tar.bz2
    mv icon-2.6.0 icon-esm-univie
    cd icon-esm-univie/

    Configure the model, using MPI parallel communication (this step typically takes several minutes):

    config/vsc/vsc4.intel-intelmpi_spack --enable-mpi

    You can check for a successful configure step by looking at the last line of the file config.log. This line should read configure: exit 0.

    Load the libraries that are needed for compilation of the model:

    spack load /xg435ds  # intel-oneapi-compilers@2022.2.1 linux-almalinux8-skylake_avx512 / gcc@9.5.0
    spack load /p7jisxw  # intel-oneapi-mkl@2022.2.1 linux-almalinux8-skylake_avx512 / intel@2021.7.1
    spack load /6a7vghr  # netcdf-fortran@4.6.0 linux-almalinux8-skylake_avx512 / intel@2021.7.1
    spack load /kqslczm  # libxml2@2.10.1 linux-almalinux8-skylake_avx512 / intel@2021.7.1
    spack load /tlvfj62  # eccodes@2.25.0 linux-almalinux8-skylake_avx512 / intel@2021.7.1

    Compile the model, using 8 cores for faster compilation (this step typically takes several minutes):

    make -j 8

    A successful compilation should end with the following lines printed to screen

    FCLD bin/icon

    support/util_file.o: In function `util_tmpnam':

    /home/fs72044/avoigt_teach/climlab_s2024/icon-esm-univie/support/util_file.c:63: warning: the use of tmpnam' is dangerous, better use mkstemp'

    make[1]: Leaving directory '/home/fs72044/avoigt_teach/climlab_s2024/icon-esm-univie'

    The compilation leads to the binary bin/icon.

    Running an AMIP-like simulation

    A runscript for an AMIP-like simulation is available in runs/amip/, the run script is exp.amip.run. The script is written for user avoigt_teach and needs to be adapted accordingly for others users (e.g., replacing avoigt_teach where needed and adapting some of the directory names.)

    The simulation is AMIP-like because SSTs, sea ice etc. are prescribed as climatological averages and are the same for each year.

    Simulations

    • amip simulation: to test basic running of model
    • slabctr: slab-ocean present-day control simulation, q-flux taken from https://phaidra.univie.ac.at/detail/o:1683142, sstclim_seb_atm_seb_2d_ml_1980-2008.ymonmean.seb_wtr.addc_3.1970-2069.nc, uses a ghost flux of 3Wm-2 to keep climate close to AMIP climate
    • slab4x: 4xCO2, restarted from 1990-01-01 of slabctr
    • slab4x-sun: 4xCO2 and sun dimmed by 3% via fsolrad=0.97 namelist switch, restarted from 1990-01-01 of slabctr
    • slab4x-vap: 4xCO2 and transparent stratospheric water vapor at klev=22 and above, restarted from 1990-01-01 of slabctr

    Output is on native triangular grid and model levels. To interpolate to lat-lon-p:

    # 2d data: lat-lon interpolation
    cdo -P 16 -remapcon,r180x90 -setgrid,icon_grid_G.nc file.nc file.r180x90.nc
    # 2d daily-mean precip data interpolated to nearest neighbour for analysis of extreme precipitation
    cdo -P 16 -remapnn,r360x90 -setgrid,icon_grid_G.nc -selvar,pr file_dm.nc file_dm.pr.remapnn-r360x180.nc

    For example:

    for file in slab4x-vap_atm_2d_daily_ml_????????T000000Z.nc; do echo $file; cdo -remapnn,r360x180 -setgrid,icon_grid_G.nc -selvar,pr $file ${file}.pr.remapnn-r360x180.nc; done
    
    cdo mergetime slab4x-vap_atm_2d_daily_ml_*pr.remapnn-r360x180.nc ../output4students/slab4x-vap/slab4x-vap_atm_2d_daily_ml_199001-201701.pr.remapnn-r360x180.nc
    
    # clean up if needed: files with one month each
    rm  slab4x-vap_atm_2d_daily_ml_*.pr.remapnn-r360x180.nc
    # 3d data: lat-lon-p interpolation in one go
    plev="100000,95000,90000,85000,80000,75000,70000,65000,60000,55000,50000,45000,40000,35000,30000,25000,20000,15000,10000,5000,10"
    cdo -s -P 16 -remapcon,r180x90 -setgrid,icon_grid_G.nc -ap2pl,$plev file.nc file.r180x90.plev.nc

    For example:

    cdo -O -P 16 mergetime slabctr_atm_3d_ml_????????T000000Z.nc slabctr_atm_3d_ml_197901-201701.nc
    cdo -O -P 16 -ap2pl,$plev slabctr_atm_3d_ml_197901-201701.nc slabctr_atm_3d_ml_197901-201701.plev.nc
    cdo -O -s -P 16 -remapcon,r180x90 -setgrid,icon_grid_G.nc slabctr_atm_3d_ml_197901-201701.plev.nc slabctr_atm_3d_ml_197901-201701.plev.r180x90.nc

    Interpolated output is on VSC4 in /gpfs/data/fs72044/avoigt_teach/experiments/s2024/output4students. The output is also available at the IMG Teachinghub in /lehre/climmodlab_s2024/output4students/.