2.1. Getting the code¶
The code is available on a git repository, hosted on github: https://github.com/ita-solar/rh. If you don’t have git installed and just want to get started, the easiest way is to download a zip file with the latest revision: https://github.com/ita-solar/rh/archive/master.zip. If you have git installed and would like to be up-to-date with the repository, you can do a git clone:
git clone https://github.com/ita-solar/rh.git
or using SSH:
git clone firstname.lastname@example.org:ita-solar/rh.git
Whether you unpack the zip file or do one of the above it will create a directory called
rh in your current path. This directory will have the following subdirectories:
|rh||Main RH source|
|rh/Atmos||Used to keep atmosphere files|
|rh/Atoms_example||Used to keep atom files, line and wavelength lists (example)|
|rh/idl||Old RH IDL routines, not used|
|rh/Molecules||Used to keep molecule files|
|rh/python||Utility Python programs|
|rh/rh15d.||Source files for RH 1.5D|
|rh/rhf1d||Source files for 1D geometry, deprecated, do not use|
|rh/rhsphere||Source files for spherical geometry, deprecated, do not use|
|rh/tools||Associate C programs for RH, not tested.|
The source code directories for other geometries (rhf1d, rhsphere) are still in the code tree, but they are deprecated and will be removed soon. With the latest changes related to rh15d, they are not guaranteed to work or even run. Do not use.
RH 1.5D makes use of the HDF5 library to read the atmosphere files and write the output. It is not possible to run the code without this library. RH 1.5D requires HDF5 version 1.8.1 or newer (including versions 1.10.x).
RH 1.5D previously made use of the netCDF4 library for its output (which in turn also required HDF5). The latest changes mean RH 1.5D needs only HDF5. Because netCDF4 files are also HDF5 files, the output is still readable in the same way as before and input files in netCDF version 4 format can still be read in the same way by RH 1.5D. If you used input atmospheres in netCDF version 3 format, then these will have to be converted to HDF5. It is recommended that new atmosphere files be created in HDF5 only.
Because HDF5 is commonly used in high-performance computing, many supercomputers already have them available. In Fram, they can be loaded as (also loading the intel compilers):
module load HDF5/1.8.19-intel-2018a intel/2018a
module load hdf5/1.8.18_mpt
module load intelcomp/18.0.1 mpt/2.14 hdf5/1.8.19
module load cray-hdf5-parallel
and at ITA’s Linux system:
module load hdf5/Intel/1.8.19 Intel_parallel_studio/2018/3.051
RH 1.5D is parallelised via MPI, therefore an MPI library is necessary even if running with only one CPU. These are readily available in supercomputers and clusters, but not always in individual workstations. In such cases, users will have to manually install both MPI and HDF5 libraries (HDF5 should be compiled with the MPI library so that the parallel I/O module works).
If using Linux or MacOS, HDF5 is available in a variety of ways. The safest bet is to download and compile HDF5 from the source, enabling parallel builds in the
./configure script, e.g.:
./configure (...) --enable-parallel
An easier way, but not guaranteed to work every time, is to install both MPI and HDF5 with parallel support is via the Anaconda Python distribution. Once you install Anaconda (version 3.6 or above), you can install the
hdf5-parallel package, which installs both MPI and HDF5 and has been tested with RH 1.5D:
conda install -c spectraldns hdf5-parallel
If you obtain pre-compiled binaries or packages for HDF5, you need to make sure they have parallel support enabled. Most available packages do not have parallel support. This includes typical packages from Linux distributions and the
hdf5 Anaconda package (but not the above
Compilation of RH 1.5D consists of two steps:
- Compilation of the geometry-independent main libraries (
- Compilation of the
rh15d_mpitree and main binaries
RH 1.5D has been compiled in a variety of architectures and compilers, including gcc, the Intel compilers, and clang. As for MPI implementations, it has been tested with SGI’s mpt, OpenMPI, mpich, mvapich, and Intel’s MPI.
2.3.1. Makefile configuration¶
RH 1.5D does not automatically look for the compilers and libraries. You need to tell RH which compilers to use and where to find the HDF5 library by editing the file
rh/Makefile.config. This file is also used to set up any additional compiler or linker flags, if appropriate. Changes to any other Makefiles are not necessary. It is also no longer necessary to set the environment variables
CPU, as in previous versions.
HDF5_DIR, please enter the base directory for the library (not the directory with the lib* files), so that both library and include files are used. In Fram and Hexagon this is already stored in the
HDF5_DIR environment variable, so you can comment that line in
Makefile.config. If your version of HDF5 was not built as a shared binary, you need to link HDF5 and other used libraries directly (you will need to set at least
There are two steps in the compilation: main libraries and rh15d binaries. To speed up compilation, you can use parallel builds (e.g.
make -j8) in all steps of the compilation.
2.3.2. Main libraries¶
The common RH files are put in a library under the base directory. After editing
Makefile.config, build the main libraries with
make on the
rh directory. If successful, the compilation will produce the two library files
2.3.3. Program binaries¶
rh15d contains the source files for the 1.5D version. After compiling the main library, go to that directory and compile the binaries with
make. The following executables will be created:
|rh15d_ray_pool||Main RH 1.5D binary, uses a job pool (see Binaries and execution)|
|rh15d_ray||Alternative RH 1.5D binary. Deprecated. This program runs much slower than rh15d_ray_pool and is kept for backwards compatibility only. Will be removed in a future revision.|
|rh15d_lteray||Special binary for running in LTE|
2.4. Run directory¶
Once compiled, you can copy or link the binaries to a run directory. This directory will contain all the necessary input files, and it should contain two subdirectories called
If the subdirectories
scratch do not exist in the directory where the code is run, the code will crash with an obscure error message.