dumux-krs

dumux-krs is primarily a DuMux pore-network application for simulating the production and transport of discrete gas bubbles. It couples two-phase flow in a pore network to particle tracking with bubble growth, detachment, advection, buoyancy, merging, trapping, dissolution, and exit events.

Animated pore-network bubble simulation

Example pore-network bubble simulation.

The repository also contains the resolved single-bubble simulations used to develop the pore-network closure relations. Most users can run the PNM model and use the published data without rebuilding those closures or generating new three-dimensional meshes.

Repository components

Component Purpose Documentation
appl/pnm-bubbles Main pore-network bubble simulator, validation cases, campaign runner, and analysis scripts. PNM-bubbles README
appl/bubble-velocity Optional resolved Stokes simulations and closure fitting/convergence analysis. Bubble-velocity README
appl/cgal-mesher Optional CGAL volume-meshing tool for generating additional resolved-flow meshes. CGAL mesher README

The fitted closure relations from bubble-velocity are already implemented in pnm-bubbles; they do not need to be refitted before using the PNM model.

Published data locations

The included research data are stored with the application that produced them rather than in a single repository-level data directory:

Path Contents
appl/pnm-bubbles/data/ Published PNM campaign directories, run inputs and metadata, logs, time series, campaign summaries, and derived plots.
appl/bubble-velocity/data/ Published pressure-, gravity-, and combined-forcing resolved-flow runs, convergence data, and fitted-model summaries.
appl/bubble-velocity/mesh/ Ready-to-run volume meshes and the published Surface Evolver OFF surfaces used by the resolved-flow and CGAL workflows.

New PNM campaigns are also written below appl/pnm-bubbles/data/. New raw bubble-velocity sweeps are written below build-cmake/appl/bubble-velocity/sweep_runs/; this build-directory output is not part of the published dataset unless it is deliberately copied into the application data directory.

Installation

Reproducible installation

The recommended publication setup uses install.sh, generated with DuMux's make_installscript.py. It clones the publication module and all required DUNE/DuMux modules at the exact revisions listed below, then builds them with the portable settings in cmake.opts.

Module Revision
skjelanger2026a (dumux-krs) v1.0.0
dumux 351785a6bee1141a3b5d2b197a29a82192f48a5e
dune-common 2988ac1d85f59c949a73524be60631ffdb26d2e3
dune-geometry 5673e95ac364ad3498aed9eaf65e0d224384d15a
dune-grid 954436b88247e904628ec4d7c8bb7b2eaac08900
dune-istl 21c67275b17e93918365177f93f42e4aaa9afd23
dune-localfunctions ddbf693b5f9c867b2d58d418fe130bbe92c06a99
dune-foamgrid 52d9512b36e31da10c33d57e509934c45928ba90
dune-uggrid cf2513efb6497dc95744649e0658cedef2980bff

DuMux's GridFormat dependency is initialized at the submodule revision pinned by the DuMux commit (ba7026bfd3fab4b618391e47149ce4b7da6ef513).

On Ubuntu, install the base system tools, clone this repository, and run the installer:

sudo apt install build-essential cmake git pkg-config python3 python3-venv \
    libopenmpi-dev openmpi-bin libsuitesparse-dev
git clone https://git.iws.uni-stuttgart.de/dumux-pub/skjelanger2026a.git
cd skjelanger2026a
./install.sh

The script creates a DUMUX/ directory below the current directory, checks out the pinned revisions, initializes required submodules, runs dunecontrol, and builds the publication applications. The resulting executables are below DUMUX/skjelanger2026a/build-cmake/appl/.

The base configuration deliberately disables the optional CGAL mesher. To build it, install CGAL and Eigen3 and follow the instructions under appl/cgal-mesher.

Manual installation

Required for the PNM application

Install DuMux, DUNE, dune-foamgrid, and dune-uggrid using the DuMux installation instructions. On Ubuntu, the remaining basic system tools can typically be installed with:

sudo apt install build-essential cmake git pkg-config python3 python3-venv \
    libopenmpi-dev openmpi-bin libsuitesparse-dev

Place or clone the publication module beside the other DUNE modules:

cd <dune-module-root>
git clone https://git.iws.uni-stuttgart.de/dumux-pub/skjelanger2026a.git

The relevant directory layout is:

<dune-module-root>/
├── dune-common/
├── dune-geometry/
├── dune-grid/
├── dune-istl/
├── dune-localfunctions/
├── dune-foamgrid/
├── dune-uggrid/
├── dumux/
└── skjelanger2026a/

Configure the module and build its available targets from the DUNE-module root:

./dune-common/bin/dunecontrol --only=dumux-krs all

This creates skjelanger2026a/build-cmake. CGAL and Eigen3 are optional: when they are unavailable, configuration prints a status message and skips only the cgal_pill_mesher target. The PNM and bubble-velocity solvers still build.

To rebuild only the main PNM executable:

cd skjelanger2026a
cmake --build build-cmake --target pnm_bubbles -j

Automated smoke tests

CTest is CMake's test runner. This repository registers three end-to-end smoke tests: PNM validation case 1, the resolved Stokes solver on a bundled coarsest r=30 µm mesh, and—when CGAL and Eigen3 are installed—regeneration of that mesh geometry with CGAL. Build and run them with:

cmake --build build-cmake --target build_tests -j
ctest --test-dir build-cmake --output-on-failure

List the registered tests without running them using ctest --test-dir build-cmake -N.

Python environment

Create the shared analysis environment from the repository root:

python3 -m venv python/.venv
source python/.venv/bin/activate
python3 -m pip install numpy scipy pandas matplotlib pillow

The PNM runner itself mainly uses the Python standard library, while the packages above support the validation and campaign plots.

Run the pore-network model

The standard showcase uses a 5 × 5 × 5 pore network:

cd build-cmake/appl/pnm-bubbles
./pnm_bubbles showcase.input

showcase_large.input and showcase_larger.input provide larger networks. The executable writes VTK output and gas_exit_timeseries.csv in the current working directory. Additional particle, pore, throat, and Reynolds-number tables are written when Output.ParticleLogging = true.

Eight focused validation cases are included under appl/pnm-bubbles/tests/. Campaign generation, validation plots, model parameters, and all output files are described in the PNM-bubbles README.

Run a PNM campaign

Edit the user-settings section near the top of appl/pnm-bubbles/python/run_pnm.py, then run from the repository root:

source python/.venv/bin/activate
python3 appl/pnm-bubbles/python/run_pnm.py

The runner expands the selected parameter arrays into independent cases, runs them in parallel, and maintains resumable campaign summaries under appl/pnm-bubbles/data/. Example analysis commands are:

python3 appl/pnm-bubbles/python/plot_steady_runs_byG.py
python3 appl/pnm-bubbles/python/plot_steady_runs_byP.py
python3 appl/pnm-bubbles/python/plot_steady_runs_byRd.py
python3 appl/pnm-bubbles/python/plot_steady_runs_byT.py

Included PNM data

appl/pnm-bubbles/data contains published inputs, run metadata, logs, time series, campaign summaries, and derived plots for three no-slip campaign families based on showcase.input, showcase_large.input, and showcase_larger.input.

Large per-timestep .vtp snapshots and crash core dumps are excluded from Git. Included .pvd manifests can therefore refer to omitted snapshots; run the preserved input again to regenerate a complete visualization sequence. The data README explains the campaign and run-directory naming conventions.

Optional resolved-flow and meshing tools

The bubble_velocity_stokes solver can be built and run without CGAL, Eigen3, Gmsh, or Surface Evolver because three normal ready-to-run meshes are included for bubbles with equivalent radii of 20, 30, and 40 µm. A coarsest r=30 µm mesh is also included for the automated smoke test:

cmake --build build-cmake --target bubble_velocity_stokes -j
cd build-cmake/appl/bubble-velocity
./bubble_velocity_stokes params.input

Resolved pressure-, gravity-, and combined-forcing campaigns are published under appl/bubble-velocity/data. The bubble-velocity README documents the solver, parameter sweeps, fitting scripts, convergence plots, and mesh naming.

Generating new meshes with the CGAL pipeline additionally requires CGAL, Eigen3, Gmsh, meshio, pyvista, and VTK:

sudo apt install libcgal-dev libeigen3-dev gmsh
source python/.venv/bin/activate
python3 -m pip install meshio pyvista vtk

Rerun dunecontrol after installing CGAL and Eigen3 so that the optional cgal_pill_mesher target is created. Surface Evolver 2.70 is only required to produce bubble shapes that are not already present in the 16 published 25 µm-throat OFF surfaces. See the CGAL mesher README for the complete workflow.

Output locations

Attribution

Parts of the simulation applications are based on or adapted from DuMux. DuMux is developed by the DuMux Project contributors and is available from https://dumux.org. See NOTICE.md for provenance and external software information.

License

Software in this repository is licensed under the GNU General Public License version 3 or later (GPL-3.0-or-later). Documentation, published meshes, figures, and research data are licensed under Creative Commons Attribution 4.0 (CC-BY-4.0). Repository licensing metadata is released under Creative Commons Zero 1.0 (CC0-1.0).

File-level SPDX declarations and REUSE.toml are authoritative. See LICENSE.md for details and LICENSES/ for the complete license texts.