python scripts implementing a MODFLOW-API workflow that incorporates electrostatic coupling effects into multispecies solute transport simulations with MODFLOW
Electrostatic coupling occurs while simulating the transport of ionic (charged) chemical species. The condition of electroneutrality leads to a coupled nonlinear solute transport equation, where the transport of one chemical species is influenced by the concentrations (and gradients) of all the other species in solution, their dispersion coefficients, and their electric charges.
The main part of the python scripts is based on flopy, configuring a MODFLOW groundwater flow model (GWF), and as many solute transport models (GWT) as ionic species in solution.
Electrostatic coupling effects are calculated with python, and with the modflowapi, this effect is then given as a source term (via the SRC package) to each GWT model. The simulation workflow is based on a lagged-one-time-step approach.
Initialize a python environment and install the major dependencies included in requirements.txt:
pip install -r requirements.txt
After this, be sure to configure your simulation environment in the configuration file, defining the variables that make sense for your operative system, folder structure and executables.
The example simulations are included in the folder src and can be run directly with python. Please follow the execution instructions for each example script. In general, the simulations consider a steady-state groundwater flow model, so one needs to first run the flow model and then the transport simulation. For example, for the script mf6_mm2014_heta_nacl_.py the execution is as follows:
-
First run the flow model
python mf6_mm2014_heta_nacl_.py --writeflow --runflow -
And then run the coupled multispecies ionic solute transport simulation
python mf6_mm2014_heta_nacl_.py --write --run
The coupling strategy relies on specifying the additional dispersive fluxes due to electrostatic interactions to the source package of each transported species. During the development of the code with the MODFLOW-API version 6.5.x, the memory address for this was {GWTMODELi}/CONCENTRATION/BOUND, however, it was observed that in the most recent versions of the MODFLOW-API the working address is {GWTMODELi}/SRC_0/SMASSRATE. The code has been updated to make this distinction.
The most recent versions of the MODFLOW-API library and executables for the different operative systems are included in this repository, in the folders lib and exe, respectively. These were downloaded from the MODFLOW executables repository. Users can specify the path to their own executables and libraries by modifying the environment configuration file.
MIT License
