# Welcome to DORiE! (__D__UNE-__O__perated __Ri__chards equation solving __E__nvironment) [![build status](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/badges/master/build.svg)](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/commits/master) DORiE is a software suite for solving Richard's Equation. The core feature is a C++ PDE-solver powered by [DUNE](https://dune-project.org/). It implements a Discontinous Galerkin (DG) discretization scheme on structured rectangular / cubic and unstructured simplex grids in two and three spatial dimensions, and makes use of advanced features like adaptive grid refinement. The suite encapsulates a documentation and various tools for program setup, program testing, and output analysis, which are mostly written in Python. DORiE is developed and maintained by the [DORiE Developers](mailto:dorieteam@iup.uni-heidelberg.de) of the [TS-CCEES](http://ts.iup.uni-heidelberg.de/) research group at IUP Heidelberg, supervised by [Kurt Roth](http://ts.iup.uni-heidelberg.de/people/prof-dr-kurt-roth/), in collaboration with [Ole Klein](https://conan2.iwr.uni-heidelberg.de/people/oklein/) and the [Scientific Computing Group](https://conan2.iwr.uni-heidelberg.de/) of IWR Heidelberg. # Installation Instructions DORiE is a [DUNE](https://dune-project.org/) module and requires several other DUNE modules as well as third party software packages. Installation can be handled manually on your local machine, but for inexperienced users it is recommended to use the deployment software [Docker](https://www.docker.com/) instead. In any case, DORiE is configured, built, and installed via the [DUNE Buildsystem](https://dune-project.org/doc/installation/), using the `dunecontrol` script to handle DUNE-internal dependencies. ## Docker Installation - Simple Setup This setup is intended for users who simply want to start computations with DORiE. Install Docker on your machine. Then, use `git clone` to download the DORiE repository into a suitable directory on your machine. Enter the directory, and call docker build -t dorie . Docker will use a prepared image from Dockerhub and install DORiE into it. You can now call DORiE via the Docker deamon from any directory `dir` on your machine: docker run -i -t -v :/sim dorie The `-v` option tells docker to mount the directory into the container work directory (`sim`). In the section 'Usage' you will find a list of possible commands. Note that input and output files can only be placed in the `` directory or subdirectories thereof. You must use relative paths in the DORiE configuration files. ## Docker Installation - Interactive Setup This setup is intended for advanced users. You will gain access to the DORiE module outside the container, and be able to make changes to the source code. We have prepared a [DORiE DUNE Environment Image on Dockerhub](https://hub.docker.com/r/dorie/dune-env/), which is a modified image of the Ubuntu OS that has all dependencies readily installed. The current version is 2.5 (referencing the DUNE module version 2.5). Run a new container from this image by calling docker run -i -t dorie/dune-env:2.5 /bin/bash Docker will automatically download the image if necessary. Use the `-v` option of the `run` command to mount a local directory into the container: -v :/opt/dune/dorie This way, you can access the content of the (still empty) folder of the virtual machine from your local `/dorie` directory. *Mounting directories is not possible after your container has been started!* Next, use `git clone` to download the DORiE repository into the shared folder. Enter the container, and execute dunecontrol --only=dorie all to build DORiE, or MAKE_FLAGS="-j " dunecontrol --only=dorie all to build in parallel on `N` processes. Lastly, install the DORiE binaries by calling dunecontrol --only=dorie make install ### Update DUNE The DUNE modules in the repository might be outdated. You can update to the newest versions by calling dunecontrol update Then compile and install all modules again by executing dunecontrol all && dunecontrol make install ## Manual Installation Installing all packages manually can be quite an effort, but useful for developers who want to have easy access to the source files or users who prefer to run DORiE without the Docker overhead. Whenever possible, dependencies should be installed using a package manager, like [APT](https://wiki.ubuntuusers.de/APT/) on Ubuntu or [Homebrew](http://brew.sh/) on Mac. Manual installation on a Windows environment is strongly discouraged! ### Dependencies Depending on your system configuration, there will be more packages necessary to install DORiE on your machine. See the step-by-step manual for further details. | Software | Version/Branch | Comments | | ---------| -------------- | -------- | | CMake | >= 2.8.12 | | GCC | >= 5 | | git | | pkg-config | | HDF5 | | with MPI support | FFTW3 | | with MPI support | Python | 2.7 or 3.x | | pip | 2.7 or 3.x | | MPI | | Tested with OpenMPI | SuperLU | 4.3 or 5.x | | VirtualEnv | | Install via `pip` | | [dune-common](https://gitlab.dune-project.org/core/dune-common) | releases/2.5 | [dune-geometry](https://gitlab.dune-project.org/core/dune-geometry) | releases/2.5 | [dune-grid](https://gitlab.dune-project.org/core/dune-grid) | releases/2.5 | [dune-uggrid](https://gitlab.dune-project.org/staging/dune-uggrid) | releases/2.5 | [dune-istl](https://gitlab.dune-project.org/core/dune-istl) | releases/2.5 | [dune-localfunctions](https://gitlab.dune-project.org/core/dune-localfunctions) | releases/2.5 | [dune-functions](https://gitlab.dune-project.org/staging/dune-functions) | releases/2.5 | [dune-typetree](https://gitlab.dune-project.org/staging/dune-typetree) | releases/2.5 | [dune-pdelab](https://gitlab.dune-project.org/pdelab/dune-pdelab) | releases/2.5 | [dune-python](https://gitlab.dune-project.org/quality/dune-python) | releases/2.5 | [dune-testtools](https://gitlab.dune-project.org/quality/dune-testtools) | releases/2.5 If you also want to build the documentation, you will additionally need to install Doxygen, Sphinx and Breathe. ### Step-by-step Instructions These instructions are suitable for a clean **Ubuntu** or **Mac OS X** setup. The main difference between the two systems is the package manager. Debian-based systems have the APT manager already built in. On Mac, we recommend installing [Homebrew](http://brew.sh/). If you prefer to use [MacPorts](https://www.macports.org/), you need to check if some of the packages require different installation options than displayed here. 1. Install third party packages: **Ubuntu:** apt update apt install autoconf bison cmake flex gcc-5 g++-5 gfortran-5 \ git libatlas-base-dev libfftw3-dev libfftw3-mpi-dev \ libfreetype6-dev libhdf5-mpi-dev libopenmpi-dev libpng-dev \ libsuperlu-dev libxft-dev python-dev python-pip python-sphinx \ python-breathe doxygen **Mac OS X:** brew update brew install automake cmake doxygen gcc libtool libpng open-mpi \ pkg-config python3 superlu brew install hdf5 --with-mpi brew install fftw --with-mpi 2. Install the necessary Python packages using `pip`: **Ubuntu:** python -m pip install virtualenv **Mac OS X:** sudo -H python3 -m pip install virtualenv sphinx breathe 3. **Mac OS X** only: The Apple Clang compiler shipped with CMake is not suitable for compiling DUNE and UG. Before proceeding, call export CC=gcc-6 export CXX=g++-6 to enfore the Homebrew'd GCC compiler. Note that this variable export only lasts for your current terminal session. Always make sure that the configuration tool actually finds GCC instead of the Apple Clang. 4. Clone the DUNE modules and DORiE into a suitable folder on your machine. Make sure that you check out the correct branches (see above). Enter the parent folder, and call **Ubuntu:** MAKE_FLAGS="-j " ./dune-common/bin/dunecontrol all **Mac OS X:** CMAKE_FLAGS="-DDUNE_FORCE_PYTHON3=True" MAKE_FLAGS="-j " ./dune-common/bin/dunecontrol all to build all DUNE modules in parallel on `N` processes. If you installed software into paths not appended to your `PATH` variable, you will have to add `CMAKE_FLAGS` to the call to make sure that CMake finds all packages. Alternatively, you can add a custom options file. See the [DUNE Installation Instructions](https://dune-project.org/doc/installation/) for details. CMake will throw an error if required packages are not found. 5. To install all DUNE packages into system locations (so you can call `dunecontrol` and `dorie` from anywhere), you can run ./dune-common/bin/dunecontrol make install which may require `sudo` rights on your machine. This action is **optional and not required to run DORiE**. If you choose not to install DORiE, make sure to append the location of `dunecontrol` (`dune-common/bin`) and `dorie` (`dorie/build-cmake/bin`) to your search path. ## Recommended Third-Party Software The following software packages are cross-platform, so you should be able to find a release that fits your operating system: * [Gmsh](http://gmsh.info/): An open-source CAD that can be used to create the `.msh` files used by DORiE to define triangular meshes. * [ParaView](http://www.paraview.org/): A powerful post-processing tool for VTK files. Offers both visualization and data analysis tools. # Usage ## Start an interactive Docker session In case you built DORiE using `docker build` and want to start an interactive session, e.g. to build the documentation or do some debugging, you can do so by specifying a custom entrypoint for the container: docker run -i -t --entrypoint=/bin/bash -v :/sim dorie This way, an interactive bash session inside the container will be started (instead of directly running DORiE). Note that DUNE and DORiE are located in `/opt/dune`. ## Documentation The documentation of the current `master` branch can be found [online](http://dorie-docs.gitballoon.com) (password: `richards`). The documentation can be built after DORiE has been properly configured (i.e., by calling `dunecontrol`). Note that you might have to re-configure DORiE once after installing it, because some dependencies are installed at configure time (e.g. by `dunecontrol --only=dorie configure`). To build the documentation, just run dunecontrol --only=dorie make doc The documentation files can now be found in the subfolder `dorie/build-cmake/doc`. ## Run, DORiE, Run! During `make install`, DORiE installs a wrapper to access the functions and executables of DORiE from any location on your device. After a successful installation, you can call the wrapper by simply executing dorie If you did not run `dunecontrol make install`, you can find the wrapper in the `dorie/build-cmake/bin` folder of your installation. To start your first simulation run, create a new directory and enter it. Place some exemplary configuration and boundary condition data files in there by calling dorie create DORiE encapsulates two routines, the Parameter Field Generator (PFG) and the main program routine. Each takes a single `.ini` configuration file as arguments. Tweak the paramters to your liking and then call dorie pfg to create a parameter field file. Make sure that you instruct the main routine to call the file you just created. Then call dorie run to execute the main program. List all available commands and find further help by executing dorie --help or dorie --help ## Troubleshooting CMake heavily caches the results of its configuration process. In case you encounter errors or strange behavior, especially after an update, you should delete the DORiE build folder (called `build-cmake` by default) and re-install DORiE using `dunecontrol`. If the problem persists, take a look at the [List of Known Bugs](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/issues), or create an issue yourself. For problems related to the installation, refer to the sections below. ### Debugging DORiE can be built with debugging flags via CMake. To do so, run CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug" dunecontrol --only=dorie all After building, a debugger can hook into the executables. **Note:** If no `CMAKE_BUILD_TYPE` is specified during re-configuration, the last configuration build type is used. If no CMake files exist, it defaults to `Release`. You will find the actual value displayed in the final output of CMake. To re-create a release build, configure DORiE with the release build type by executing CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release" dunecontrol --only=dorie all #### Debugging inside Docker A debugger needs special security privileges usually not provided by the Docker engine. To enable debugging inside Docker, these privileges have to be granted when calling `docker run` by adding the options --security-opt seccomp=unconfined The debugger `gdb` is pre-installed in the Docker container. ### DORiE is running, but I suspect that something is wrong You can execute system tests in order to ensure that DORiE is running correctly and producing the expected results: ARGS="--output-on-failure" dunecontrol --only=dorie make test You will be informed whether each test has been passed or failed, and you may find additional output in the DORiE build directory. ### Further Help [Open an issue](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/issues/new), or write to the [DORiE developer mailing list](mailto:dorieteam@iup.uni-heidelberg.de).