Installation

Obtaining chombo-discharge

chombo-discharge can be freely obtained from https://github.com/chombo-discharge/chombo-discharge. The following packages are required:

The Chombo, nlohmann/json, and EBGeometry dependencies are automatically handled by chombo-discharge through git submodules.

Warning

Our version of Chombo is hosted at https://github.com/chombo-discharge/Chombo-3.3.git. chombo-discharge has made substantial changes to the embedded boundary generation in Chombo. It will not compile with other versions of Chombo than the one above.

Optional packages are

  • A serial or parallel version of HDF5, which is used for writing plot and checkpoint files.

  • An MPI installation, which is used for parallelization.

  • https://visit-dav.github.io/visit-website/ visualization, which used for visualization.

Cloning chombo-discharge

When compiling chombo-discharge, makefiles must be able to find both chombo-discharge and Chombo. In our makefiles the paths to these are supplied through the environment variables

  • DISCHARGE_HOME, pointing to the chombo-discharge root directory.

  • CHOMBO_HOME, pointing to your Chombo library

Note that DISCHARGE_HOME must point to the root folder in the chombo-discharge source code, while CHOMBO_HOME must point to the lib/ folder in your Chombo root directory. When cloning with submodules, both Chombo and nlohmann/json will be placed in the Submodules folder in $DISCHARGE_HOME.

Tip

To clone chombo-discharge directly to $DISCHARGE_HOME, set the environment variables and clone (using --recursive to fetch submodules):

export DISCHARGE_HOME=/home/foo/chombo-discharge
export CHOMBO_HOME=$DISCHARGE_HOME/Submodules/Chombo-3.3/lib

git clone --recursive git@github.com:chombo-discharge/chombo-discharge.git ${DISCHARGE_HOME}

Alternatively, if cloning using https:

export DISCHARGE_HOME=/home/foo/chombo-discharge
export CHOMBO_HOME=$DISCHARGE_HOME/Submodules/Chombo-3.3/lib

git clone --recursive https://github.com/chombo-discharge/chombo-discharge.git ${DISCHARGE_HOME}

chombo-discharge is built using a configuration file supplied to Chombo. This file must reside in $CHOMBO_HOME/mk. Some standard configuration files are supplied with chombo-discharge, and reside in $DISCHARGE_HOME/Lib/Local. These files may or may not work right off the bat.

Test build

For a quick compilation test the user can use the GNU configuration file supplied with chombo-discharge by following the steps below.

  1. Copy the GNU configuration file

    cp $DISCHARGE_HOME/Lib/Local/Make.defs.GNU $CHOMBO_HOME/mk/Make.defs.local
    
  2. If you do not have the GNU compiler suite, install it by

    sudo apt install csh gfortran g++ libblas-dev liblapack-dev
    

    This will install

    • LAPACK and BLAS

    • GNU compilers for Fortran and C++

  3. Compile chombo-discharge

    cd $DISCHARGE_HOME
    make -s -j4
    

This will compile the chombo-discharge source code in serial and without HDF5 (using four cores for the compilation). If successful, chombo-discharge libraries will appear in $DISCARGE_HOME/Lib.

Full configuration

chombo-discharge is compiled using GNU Make, following the Chombo configuration methods.

Important

Compilers, libraries, and configuration options are defined in a file Make.defs.local which resides in $CHOMBO_HOME/mk. Users need to supply this file in order to compile chombo-discharge.

Typically, a full configuration consists of specifying

  • Fortran and C++ compilers

  • Specifying configurations. E.g., serial or parallel builds, and compiler flags.

  • Library paths (in particular for HDF5).

Main settings

The main variables that the user needs to set are

  • DIM = 2/3 The dimensionality (must be 2 or 3).

  • DEBUG = TRUE/FALSE This enables or disables debugging flags and code checks/assertions.

  • OPT = FALSE/TRUE/HIGH. Setting OPT=TRUE/HIGH enables optimization flags that will speed up Chombo and chombo-discharge.

  • PRECISION = DOUBLE Currently, chombo-discharge has not been wetted with single precision. Many algorithms (like conjugate gradient) depend on the use of double precision.

  • CXX = <C++ compiler>

  • FC = <Fortran compiler>

  • MPI = TRUE/FALSE This enables/disables MPI.

  • MPICXX = <MPI compiler> This sets the MPI compiler.

  • CXXSTD = 14 For specifying the C++ standard. We are currently at C++14. Sets the C++ standard - we are currently at C++14.

  • USE_EB=TRUE Configures Chombo with embedded boundary functionality. This is a requirement.

  • USE_MF=TRUE Configures Chombo with multifluid functionality. This is a requirement.

  • USE_MT=TRUE/FALSE Configures Chombo with memory tracking functionality. Not supported with OpenMP.

  • USE_HDF5 = TRUE/FALSE This enables and disables HDF5 code.

  • OPENMPCC = TRUE/FALSE Turn on/off OpenMP threading.

MPI

To enable MPI, make sure that MPI is set to true and that the MPICXX compiler is set. For GNU installations, one will usually have MPICXX = mpicxx or MPICXX = mpic++, while for Intel builds one will usually have MPICXX = mpiicpc.

Note

The MPI layer distributes grid patches among processes, i.e. uses domain decomposition.

HDF5

If using HDF5, one must also set the following flags:

  • HDFINCFLAGS      = -I<path to hdf5-serial>/include (for serial HDF5).

  • HDFLIBFLAGS      = -L<path to hdf5-serial>/lib -lhdf5 -lz (for serial HDF5)

  • HDFMPIINCFLAGS   = -I<path to hdf5-parallel>/include (for parallel HDF5)

  • HDFMPILIBFLAGS   = -L<path to hdf5-parallel>/lib -lhdf5 -lz (for parallel HDF5).

Warning

Chombo only supports HDF5 APIs at version 1.10 and below. To use a newer version of HDF5 together with the 1.10 API, add -DH5_USE_110_API to the HDFINC flags.

OpenMP

To turn on OpenMP threading one can set the OPENMPCC to TRUE. When compiled with OpenMP all loops over grid patches uses threading in the form

#pragma omp parallel for schedule(runtime)
for (int mybox = 0; mybox < nbox; mybox++) {

}

Warning

Memory tracking is currently not supported together with threading. When compiling chombo-discharge make sure that memory tracking is turned off (see MainSettings).

Compiler flags

Compiler flags are set through

  • cxxoptflags  = <C++ compiler flags

  • foptflags    = <Fortran compiler flags

  • syslibflags  = <system library flags>

Note that LAPACK and BLAS are requirements in chombo-discharge. Linking to these can often be done using

  • syslibflag = -llapack -lblas (for GNU compilers)

  • syslibflag = -mkl=sequential (for Intel compilers)

Pre-defined configuration files

Some commonly used configuration files are found in $DISCHARGE_HOME/Lib/Local. chombo-discharge can be compiled in serial or with MPI, and with or without HDF5. The user need to configure the Chombo makefile to ensure that the chombo-discharge is properly configured. Below, we include brief instructions for compilation on a Linux workstation and for a cluster.

GNU configuration for workstations

Here, we provide a more complete installation example using GNU compilers for a workstation. These steps are intended for users that do not have MPI or HDF5 installed. If you already have installed MPI and/or HDF5, the steps below might require modifications.

  1. Ensure that $DISCHARGE_HOME and $CHOMBO_HOME point to the correct locations:

    echo $DISCHARGE_HOME
    echo $CHOMBO_HOME
    
  2. Install GNU compiler dependencies by

    sudo apt install csh gfortran g++ libblas-dev liblapack-dev
    

    This will install

    • LAPACK and BLAS

    • GNU compilers for Fortran and C++

  3. To also install OpenMPI and HDF5:

    sudo apt install libhdf5-dev libhdf5-openmpi-dev openmpi-bin
    

    This will install

    • OpenMPI

    • HDF5, both serial and parallel.

    Both serial and parallel HDF5 will be installed, and these are usually found in folders

    • /usr/lib/x86_64-linux-gnu/hdf5/serial/ for serial HDF5

    • /usr/lib/x86_64-linux-gnu/hdf5/openmpi/ for parallel HDF5 (using OpenMPI).

    Before proceeding further, the user need to locate the HDF5 libraries (if building with HDF5).

  4. After installing the dependencies, copy the desired configuration file to $CHOMBO_HOME/mk:

    • Serial build without HDF5:

      cp $DISCHARGE_HOME/Lib/Local/Make.defs.GNU $CHOMBO_HOME/mk/Make.defs.local
      
    • Serial build with HDF5:

      cp $DISCHARGE_HOME/Lib/Local/Make.defs.HDF5.GNU $CHOMBO_HOME/mk/Make.defs.local
      
    • MPI build without HDF5:

      cp $DISCHARGE_HOME/Lib/Local/Make.defs.MPI.GNU $CHOMBO_HOME/mk/Make.defs.local
      
    • MPI build with HDF5:

      cp $DISCHARGE_HOME/Lib/Local/Make.defs.MPI.HDF5.GNU $CHOMBO_HOME/mk/Make.defs.local
      
  5. Compile the chombo-discharge

    cd $DISCHARGE_HOME
    make -s -j4 discharge-lib
    

This will compile the chombo-discharge source code using the configuration settings set by the user. To compile chombo-discharge in 3D, do make -s -j4 DIM=3 discharge-lib. If successful, chombo-discharge libraries will appear in $DISCARGE_HOME/Lib.

Configuration on clusters

To configure chombo-discharge for executation on a cluster, use one of the makefiles supplied in $DISCHARGE_HOME/Lib/Local if it exists for your computer. Alternatively, copy $DISCHARGE_HOME/Lib/Local/Make.defs.local.template to $CHOMBO_HOME/mk/Make.defs.local and set the compilers, optimization flags, and paths to HDF5 library.

On clusters, MPI and HDF5 are usually already installed, but must usually be loaded (e.g. as modules) before compilation.

Configuration files for GitHub

chombo-discharge uses GitHub actions for continuous integration and testing. These tests run on Linux for a selection of GNU and Intel compilers. The configuration files are located in $DISCHARGE_HOME/Lib/Local/GitHub.

Troubleshooting

If the prerequisites are in place, compilation of chombo-discharge is usually straightforward. However, due to dependencies on Chombo and HDF5, compilation can sometimes be an issue. Our experience is that if Chombo compiles, so does chombo-discharge.

If experiencing issues, try cleaning chombo-discharge by

cd $DISCHARGE_HOME
make pristine

Note

Do not hesitate to contact us at GitHub regarding installation issues.

Common problems

  • Missing library paths:

    On some installations the linker can not find the HDF5 library. To troubleshoot, make sure that the the environment variable LD_LIBRARY_PATH can find the HDF5 libraries:

    echo $LD_LIBRARY_PATH
    

    If the path is not included, it can be defined by:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/<path_to_hdf5_installation>/lib
    
  • Incomplete perl installations.

    Chombo may occasionally complain about incomplete perl modules. These error messages are unrelated to Chombo and chombo-discharge, but the user may need to install additional perl modules before compiling chombo-discharge.