An OpenFOAM solver for computing suspended particles in water currents Nils R. B. Olsen a, *, Subhojit Kadia a , Elena Pummer a and Gudrun Hillebrand b a Department of Civil and Environmental Engineering, The Norwegian University of Science and Technology, S. P. Andersens vei 5, N-7491 Trondheim, Norway b Federal Institute of Hydrology, Am Mainzer Tor 1, D-56068 Koblenz, Germany *Corresponding author. E-mail: nils.r.olsen@ntnu.no NRBO, 0000-0001-8472-5292; SK, 0000-0002-9134-3222; EP, 0000-0002-0255-4715; GH, 0000-0003-1489-9443 ABSTRACT A new OpenFOAM solver has been developed for computing the spatial variation of particle concentrations in owing water. The new solver was programmed in C þþ using OpenFOAM libraries, and the source code has been made openly available. The current article describes the coding of how the water ow and particle movements are computed. The solver is based on a Eulearian approach, where the particles are computed as concentrations in cells of a grid that resolves the computational domain. The Reynolds-averaged NavierStokes equations are solved by simpleFoam, using the k-ε turbulence model. The new solver uses a drift-ux approach to take the fall or rise velocity of the par- ticles into account in a convection-diffusion equation. The model is therefore called sediDriftFoam. The results from the solver were tested on two cases with different types of particles. The rst case was a sand trap with sand particles. The geometry was three-dimensional with a recirculation zone. The computed sediment concentrations in three vertical proles compared well with earlier numerical studies and lab- oratory measurements. The second case was a straight channel ume with plastic particles that had a positive rise velocity. In this case, the results also compared well with the laboratory measurements. Key words: CFD, numerical modelling, OpenFOAM, plastic particles, sediDriftFoam, sediments HIGHLIGHTS Open source 3D sediment model. Based on OpenFOAM. Simple and easy to learn. Tested on computing trap efciency of a sand trap. Tested on computing suspended plastic particles in a channel. INTRODUCTION The science of Hydroinformatics includes numerical modelling of water ow in lakes, rivers, canals and ducts (Maduka & Li 2021; Olsen 2022; Paschmann et al. 2022). Three-dimensional water ow elds are often found by solving the NavierStokes equations using a turbulence model in a science called computational uid dynamics (CFD). The set of equations are complex to solve for a general geometry. The most used CFD programmes may have a source code with millions of lines that have taken many decades to make. There are several issues related to the complexity of codes with a large number of lines. Industry average experience is about 125 bugs pr. 1,000 lines of code (McConnell 2004). Also, the transfer of coding knowledge to new staff is very time-consuming. The risk of inexperienced staff introducing new bugs in the programme is considerable. Companies making CFD software are very dependent on specialised personnel with coding experience, and problems arise when key staff retire or move to other companies. Also, it is difcult for researchers outside the company to get access to the code, both for legal reasons and for the large amount of knowledge that needs to be transferred. A solution to these problems is to use a high-level object-oriented computing language with open source access. The current article describes a solver made in OpenFOAM, which is based on the object-oriented C þþ programming language. Open- FOAM is a library of different solvers that the users can extend by adding equations and thereby creating new solvers for specic ow problems. In the current study, it was possible to create a solver for computing particle transport in water This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY 4.0), which permits copying, adaptation and redistribution, provided the original work is properly cited (http://creativecommons.org/licenses/by/4.0/). © 2023 The Authors Journal of Hydroinformatics Vol 00 No 0, 1 doi: 10.2166/hydro.2023.309 corrected Proof Downloaded from http://iwaponline.com/jh/article-pdf/doi/10.2166/hydro.2023.309/1275317/jh2023309.pdf by guest on 25 August 2023