Implementation of the HHO numerical algorithm for the Peaceman model
The Peaceman model is a nonlinear coupled system of elliptic-parabolic equations that describe the flow of a miscible fluid in a porous medium. The Hybrid High-Order (HHO) method is an arbitrary order numerical scheme for diffusion equations on generic grids. This repository contains the code for an implementation of the HHO method for the Peaceman model, as described here.
How to build
The code has been built and tested on Ubuntu 16.04, for which we provide instructions. Other environments should work if set up correctly. You will need to install the following tools / libraries in order to build the code:
- CMake version 2.6 or above: https://cmake.org/
- Clang C++ compiler, version 3.8 or above: https://clang.llvm.org/
- Eigen C++ library, version 3.3 or above: http://eigen.tuxfamily.org/
- The follwing Boost C++ libraries: http://www.boost.org/
- Boost filesystem
- Boost program options
Make sure that you have the development version of boost installed. For example, on Ubuntu, install
Once you have installed all of the required dependencies, set up the build directory and generate the build files by running the following from the repository root:
mkdir build cd build cmake ..
The test code can then be built from the build directory by running
The code requires a set of test meshes to be present in order to work. The meshes should be placed in a subdirectory /meshes/ in the location of the test executable. For example, the unit test meshes should be placed in ./build/UnitTests/meshes, and the solver test meshes should be placed in ./build/PeacemanTests/meshes. The test meshes used in our tests can be found in the meshes directory of the repository. They should be copied or symlinked into the relevant locations. For example, on Ubuntu, if the repository is located at ~/hho/, you can create the relevant symbolic links by writing
ln -s ~/hho/meshes/UnitTests ~/hho/build/UnitTests/meshes ln -s ~/hho/meshes/PeacemanTests ~/hho/build/PeacemanTests/meshes
Running the tests
There are two types of tests included; unit tests and solver tests. The unit tests test an individual component of the solver. For example, the test
test_darcy_flux checks that the flux reconstructed from the numerical velocity converges to the correct value. To run this test, you could write
cd build/UnitTests make test_darcy_flux ./test_darcy_flux
The results are output to build/UnitTests/output/convergence and can be visualised using the tools mentioned below.
The solver tests run the complete solver and examine the solution for a particular quality. The generic tests are
test_peaceman3, which test the degree k=0,1,2,3 schemes respectively. For example, to run the scheme with degree k=2, with 100 time steps for the time interval [0,2000] on the mesh scaled_2_2.typ1, write
cd build/PeacemanTests make test_peaceman2 ./test_peaceman2 --nsteps=100 --time=2000 --mesh=scaled_2_2.typ1
The results are output to build/PeacemanTests/output/peaceman as VTU data files.
Visualising the results
The numerical scheme outputs the resulting functions as VTU data files. One option to view VTU data files is to use ParaView. Alternatively, the repository includes a number of convenient Python3 scripts for visualising the results. For instance, the script
plot3d.py produces surface plots using the matplotlib library. To produce a surface plot of the concentration function generated by the test program, you might write
which will produce a plot that looks like this:
There are also the scripts
contour3d.py which produces contour plots, and the script
lineplot.py which produces line graphs for visualising the results of tests that measure convergence or timing. For example, writing
from the UnitTest build directory after running the Darcy flux unit tests will produce a convergence result like the following:
The code for handling the meshes is a prelimary version of what became the DiSk++ library by Matteo Cicuttin. The code for assembling the high order operators is based on code written by Danielle Di Pietro for similar HHO schemes.
This code is licenced under the Mozilla Public License. If you use this code or parts of it for scientific publications, you are required to cite it as following:
An arbitrary order scheme on generic meshes for miscible displacements in porous media. Daniel Anderson, Jerome Droniou SIAM Journal on Scientific Computing, 40 (4), B1020-B1054, 2018