  We present a flexible scalable open-source computational framework, named
SECUReFoam, based on the finite-volume library OpenFOAM(R), for flow and
transport problems in highly heterogeneous geological media and other porous
materials. The framework combines geostatistical pre- and post-processing tools
with specialised Partial Differential Equations solvers. Random fields, for
permeability and other physical properties, are generated by means of
continuous or thresholded Gaussian random fields with various
covariance/variogram functions. The generation process is based on an explicit
spectral Fourier decomposition of the field which, although more
computationally intensive than Fast Fourier Transform methods, allows a more
flexible choice of statistical parameters and can be used for general
geometries and grids. Flow and transport equations are solved for single-phase
and variable density problems, with and without the Boussinesq approximation,
and for a wide range of density, viscosity, and dispersion models, including
dual-continuum (dual permeability or dual porosity) formulations. The
mathematical models are here presented in details and the numerical strategies
to deal with heterogeneities, equation coupling, and boundary conditions are
discussed and benchmarked for the heterogeneous Henry and
Horton-Rodgers-Lapwood problems, and other test cases. We show that our
framework is capable of dealing with large permeability variances, viscous
instabilities, and large-scale three-dimensional transport problems.
