This repository contains a Fortran 90 code for pore-scale / micromodel simulations of 3D fluid flow–solute transport–geochemical reactions.
The solver uses:
- D3Q19 Lattice Boltzmann Method (LBM) for single-phase incompressible fluid flow
- D3Q7 LBM for multi-component solute advection–diffusion
- A PFLOTRAN-style geochemical kernel (
ptran_*files) for equilibrium (homogeneous) + kinetic (heterogeneous) reactions
It can simulate dissolution–precipitation, mineral surface reactions, and related processes.
-
micromodel.F90— programmicromodel
Generates a geometry filewallin_small.raw(logical 4D array(nkin, lx, ly, lz)that is reordered and written to file).nkinrepresents the number of different minerals. -
lbm3d.F90— programlbm3d_mpi
Main 3D LBM + solute + PFLOTRAN chemistry solver with MPI parallelization.Handles:
ptran_read&ptran_chemto read chemistry input and initialize the geochemical systemsetupMPIto set up domain decomposition and MPI derived datatypesinitialize_flow,initialize_soluteto set initial flow and concentration fields- Main time loop with calls to
collision_*,streaming_*,boundary_*,ptran_speciation, etc. - Output through routines in
output.F90as binary.rawfiles
comvar.F90— global parameters, D3Q19/D3Q7 velocity sets and weightsinitialize_flow.F90—initialize_flow, sets initial density and velocityequilf.F90,equilg.F90,collision_flow.F90,streaming_flow.F90,boundary_flow.F90— equilibrium quantities, flow collision, streaming, and BCsconcentration.F90,solve.F90,collision_solute.F90,streaming_solute.F90,boundary_solute.F90,init_solute.F90— multi-component solute advection–diffusion–reaction computationdenvel.F90,perind3d.F90,bindex3d.F90— density/velocity and index utilities
ptran_global.F90— global PFLOTRAN-style parameters (number of species/minerals, time stepping, flags likenew,iread, etc.)ptran_read.F90,pflow_read_gridsize.F90— readsptran.incontrol fileptran_dbase.F90— reads geochemical database (e.g.,hanford.dat)ptran_init.F90—ptran_chemmain initialization entry pointptran_speciation.F90,ptran_setbnd.F90,trgamdh.F90,trdynmem.F90,trionexc.F90, etc. — mass balance, activities, reaction kineticswater_eos.F90,co2eos.F90— EOS modules for water and CO₂
setup_MPI.F90— MPI topology (2D MPI grid in y and z), domain reordering, and derived datatypesMPI_comm.F90— halo exchanges for LBM distribution functions and solute fieldsfileio.F90— generic input utilities (PFLOTRAN-stylefi*read routines)output.F90— parallel output/gather routines (gather_out_*,scatter_in_*,oflow_*, etc.)inout.F90— interfaces between LBM and PFLOTRAN quantities (initialization, variable extraction, unit conversion, etc.)
expand.F90,redistri_bnd.F90— solid update tools
-
ptran.in— PFLOTRAN-style input deck. Key cards:- Grid size (must match
micromodel.F90geometry), e.g.:GRID 15 585 1440 - MPI domain decomposition, e.g. total MPI ranks =
1 × 13 × 120 = 1560:PROC 1 13 120 - Geochemical database (example):
./hanford.dat - Other sections (
FLOW,DIFF,TIME,MNRL,AQCX,GAS, etc.) define chemical/mineral properties, initial conditions, boundary conditions.
- Grid size (must match
-
hanford.dat— Geochemical database in PFLOTRAN format (aqueous species, minerals, complexes, etc.). -
wallin_small.raw— Geometry file generated bymicromodel, read bylbm3d_mpiduring initialization.
- Fortran 90 compiler (tested with
ifort) - MPI library (tested with Intel MPI)
- Unix-like environment (intended for Linux clusters / HPC systems)
Important: there are two independent programs.
micromodel(geometry generator):ifort -o geo_gen src/micromodel.F90
This work was supported by LANL's LDRD program and was supported as part of the Center on Geo-process in Mineral Carbon Storage, an Energy Frontier Research Center funded by the U.S. Department of Energy (DOE), Office of Science, Basic Energy Sciences (BES), under Award # DE-SC0023429.
© 2025. Triad National Security, LLC. All rights reserved. This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department of Energy/National Nuclear Security Administration. All rights in the program are reserved by Triad National Security, LLC, and the U.S. Department of Energy/National Nuclear Security Administration. The Government is granted for itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide license in this material to reproduce, prepare. derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.
Dr. Qinjun Kang - qkang@lanl.gov