Examples on Levante¶
Having installed plotcleo, the following instructions are intended to guide you
through running each example using the bash scripts in scripts/levante/.
Note: the bash script for some of the examples chooses a build configuration which uses GPUs. To execute these scripts you will therefore need to be on a node in the GPU partition of Levante (see here for documentation on Levante’s partitions), or change the build configuration.
Configure the Bash Scripts¶
The bash script for every example in scripts/levante/examples/ provides command line
arguments to scripts/levante/examples/build_compile_run_plot.sh. This script has
two steps:
It builds and compiles the specified exectuable(s) of Cleo by running
scripts/levante/build_compile_cleo.sh [args]It generates input files, runs the exectuable(s), and plots the results by calling the example’s Python script.
You will need to configure build_compile_run_plot.sh in the following ways:
Use your Python version:
replace the path in the line stating
python=[...]with the path to your Python interpreter. (hint: if you useduvto install python for Cleo, you can find the interpreter path viauv python find.)Set the path to your YAC and YAXT installations
replace
yacyaxtroot=[...]with the path to the directory containing your yac and yaxt directories, or toyacyaxtroot=""if you do not intend to run an example that requires YAC.
You can optionally configure the bash script specific to each example
(found in the same directory e.g. scripts/levante/examples/shima2009.sh)
in the following ways:
Choose your build configuration:
choose which parallelism to utilise by modifying the
buildtypeparameter. The options arecuda,openmporserial. Note: settingbuildtype="cuda"requires you to execute the script on a node in the GPU partition of Levante and may also include OpenMP parallelism.Choose your compiler:
choose which compilers to use via the
compilernameparameter. The options areintelorgcc(both via MPI wrappers). Note: the bubble3d example requires you use thegcccompiler.Choose your build directory:
replace the path in the line stating
path2build=[...]with the path you desire.If you did not install Cleo in your home directory:
Ensure the lines which state the
path2CLEOandpath2buildto reflect this.
The Examples¶
Adiabatic Parcel
The examples, as2017.py and cuspbifurc.py, in examples/adiabaticparcel/ are for a
0-D model of a parcel of air expanding and contracting adiabatically with a two-way coupling between
the SDM microphysics and the thermodynamics. The setup mimics that in Arabas and Shima 2017
section 7 [AS17]. Note: due to numerical differences, the conditions for cusp
bifurcation and the plots will not be exactly identical to this reference.
Box Model Collisions
These examples, shima2009.py and breakup.py, in examples/boxmodelcollisions/ are for a
0-D box model with various collision kernels. The setup mimics that in Shima et al. 2009
section 5.1.4 [SKK+09]. Note: due to the randomness of the initial super-droplet
conditions and the collision algorithm, each run of these examples will not be completely identical,
but they should be reasonably similar, and have the same mean behaviour.
The Collision Kernels:
Golovin
The shima2009.py example models collision-coalescence using Golovin’s kernel.
The plot produced, by default called ~/CLEO/build_colls0d/[...]/bin/golovin_validation.png,
should be similar to Fig.2(a) of Shima et al. 2009 [SKK+09].
Long
The shima2009.py example models collision-coalescence using Long’s collision efficiency as
given by equation 13 of Simmel et al. 2002 [STT02].
The plot produced, by default called ~/CLEO/build_colls0d/[...]/bin/long_validation_[X].png,
should be similar to Fig.2(b) of Shima et al. 2009 [SKK+09].
Low and List
The breakup.py example models collision-coalescence-rebound-breakup using the hydrodynamic
kernel with Long’s collision efficiency as given by equation 13 of Simmel et al. 2002 [STT02],
and the coalescence/breakup/rebound probability from Low and List 1982(a) [LL82]
(see also McFarquhar 2004 [McF04]). If breakup occurs, a constant
number of fragments is produced.
This example produces a plot, by default called ~/CLEO/build_colls0d/[...]/bin/lowlist_validation.png.
Szakáll and Urbich
The breakup.py example models collision-coalescence-rebound-breakup using the hydrodynamic kernel with Long’s
collision efficiency as given by equation 13 of Simmel et al. 2002 [STT02], and the
coalescence/breakup/rebound probability from Szakáll and Urbich 2018 [SU18].
If breakup occurs, a constant number of fragments is produced.
This example produces a plot, by default called ~/CLEO/build_colls0d/[...]/bin/szakallurbich_validation.png.
Testik and Straub
The breakup.py example models collision-coalescence-rebound-breakup using the hydrodynamic kernel with Long’s
collision efficiency as given by equation 13 of Simmel et al. 2002 [STT02], and the
coalescence/breakup/rebound probability based on section 4 of Testik et al. 2011 (figure 12)
[TBB11] as well as coalescence efficiency and number of fragements produced from
Straub et al. 2010 and Schlottke et al. 2010 respectively ([SSB+10], [SBS+10]).
This example produces a plot, by default called ~/CLEO/build_colls0d/[...]/bin/testikstraub_validation.png.
Running the Box Model Collisions Examples:
Divergence Free Motion
This example is runs from the examples/divfreemotion/divfree2d.py script.
1. Configure the bash scripts, scripts/levante/examples/build_compile_run_plot.sh
and scripts/levante/examples/divfree2d.sh.
Execute the bash script
divfree2d.sh, e.g. from your Cleo directory:
$ scripts/levante/examples/divfree2d.sh
This example plots the motion of super-droplets without a terminal velocity in a 2-D divergence
free wind field. It produces a plot showing the motion of a sample of super-droplets, by default
called ~/CLEO/build_divfree2D/bin/divfree2d_motion2d_validation.png. The number of super-droplets in the domain
should remain constant over time, as shown in the plot produced and by default called
~/CLEO/build_divfree2D/bin/divfree2d_totnsupers_validation.png.
1-D Rainshafts
Constant 2-D Thermodynamics
This example is runs from the examples/constthermo2d/constthermo2d.py script.
1. Configure the bash scripts, scripts/levante/examples/build_compile_run_plot.sh
and scripts/levante/examples/constthermo2d.sh
Execute the bash script
constthermo2d.sh, e.g.
$ scripts/levante/examples/constthermo2d.sh
Several plots and animations are produced by this example. If you would like to compare to our reference solutions please contact us.
Kokkos Tools Profiling Test
This example, kokkostools.py, in examples/kokkostools/ compiles and runs the same
executable kokkostools for four different build configurations, (1) “cuda” with CUDA and OpenMP
parallelism, (2) “openmp” with only OpenMP parallelism, (3) “threads” with only C++ threads
parallelism, and (4) “serial” without parallelism. Using the (pre-installed) Kokkos tooks’
Kernel Timer profiler, this example then outputs the time taken for each run in various ones of
Cleo’s kernels.
Before running this example, you must first install the Kokkos tools libraries. You can use the
bash script scripts/levante/bash/install_kokkos_tools.sh to help you.
E.g. with a gcc/intel compiler:
$ cd /your/path/to/kokkos-tools-repo/ && git clone git@github.com:kokkos/kokkos-tools.git
$ scripts/levante/bash/install_kokkos_tools.sh /your/path/to/kokkos-tools-repo/ [gcc/intel] /path/to/install/kokkos-tools/[gcc/intel]/kokkostools
1. Configure the bash scripts, scripts/levante/examples/build_compile_run_plot.sh
and scripts/levante/examples/kokkostools.sh. You will need to set the
path2kokkostools variable to the path where you installed your Kokkos tools
(path to lib or lib64 and bin).
Execute the bash script
kokkostools.sh, e.g.
$ scripts/levante/examples/kokkostools.sh
By default, a .txt file with Kokkos’ simple kernel timer profiling tool data for two runs of each
of the four different build configurations is written to
~/CLEO/build_kokkostools/bin/[build_type]_[run_number]_[process_info].txt.
The time spent in the “timestep” region can be compared with the ones
in ~/CLEO/examples/kokkostools/kokkostools_kpkerneltimer_example_solution.
Python Bindings
This example is runs from the examples/python_bindings/python_bindings.py script.
1. Configure the bash scripts, scripts/levante/examples/build_compile_run_plot.sh
and scripts/levante/examples/python_bindings.sh
Execute the bash script
python_bindings.sh, e.g.
$ scripts/levante/examples/python_bindings.sh
Note: you may have issues with python versions >= 3.14, please see this note for details.
No plots are produced by this example but it should run sucessfully multiple times and produce
no plotting script for python bindings example messages. Please note the output during
time-stepping may not be ordered due to parallel execution.
Extension¶
Explore examples/exampleplotting which gives examples of how to plot output from Cleo
with cleopy and plotcleo, a few examples are demonstrated in the
examples/exampleplotting/exampleplotting.py script.