Setting Up a Simulation

rtmf6 uses a configuration-based approach to set up simulations.

Directory setup

my_project_dir
├── mf6
|   |   <more MF6 input files>
│   └── mfsim.nam
├── phreeqcrm
│   ├── advect.pqi  # PHREEQC input file with solutions
│   ├── model.yaml  # generated by rtmf6
│   └── phreeqc.dat # PHREEQC database file
├── rtmf6
│   ├── init_conc.ic # spatial distribution of initial solutions
│   └── init_exchanges.ic # spatial distribution of initial exchanges
└── rtmf6.toml # rtm6 configuration file

MODFLOW 6 input files

The first step is to setup a MODFLOW 6 transport model. This can be done with any GUI program that supports MODFLOW 6 as well as FloPy or iMOD. Create the model and calibrate the flow and transport calculations. Once you your satisfied with the transport results, place all input files in the directory mf6.

Create a rtmf6.toml file

# general information
[project]
name = "my_model"
directory = "."  # specify a different base directory

# list models involved in chemical reactions
[models]
flow_models = ["gwf_my_model"]  # name of flow models - currently only one is supported
reaction_models = ["gwt_my_model"] # name of transport models - currently only one is supported
# exchange for all stress periods if not specified
# reaction_start_stress_period = 1  # start chemical reaction in stress period 1
# reaction_end_stress_period = 1 # end chemical reaction after stress period 1

# add non-reactive species to the database for testing purposes
[tracer]
has_tracer = true
use_tracer = true
name = 'Tracer'

# specify boundary conditions
[[bc_concentrations]]
model_name = "gwf_my_model"  # flow model
bc_type = "wel"  # infiltration wells with concentration
file_name = "mf6/gwf_my_model.wel" # file name relativ to root
# src and dst columns can be the same
src = "rtmf6_sol_number"  # solution number from PHREEQC file *.pqi
dst = "concentration" # Will be replaced

# spatial distribution of initial conditions
# use MODFLOW 6 IC files that specify a solution number instead of an actual
# concentration value
# will be used to create MODFLOW 6 input files for component models
[[initial_concentrations]]
model_name = "gwt_my_model"
file_name = "mf6/gwt_my_model.ic"

# spatial distribution of exchange species
# will be used to assing exchanges to PhreeqcRM cells
[[exchanges]]
model_name = "gwt_my_model"
file_name = "rtmf6/init_exchanges.ic"

# spatial distribution of equilibrium phases
[[equilibrium_phases]]

[[gas_phases]]

[[kinetics]]

[[solid_solutions]]

[[surfaces]]

# configure PhreeqcRM
[phreeqcrm]
number_of_threads = 1 # number of threads for parallel execution
chemistry_name = "phreeqcrm/advect.pqi"  # PHREEQC input file with solution, excganges etc.
database = "phreeqcrm/phreeqc.dat" # PHREEQC database

# will be created by rtmf6
# only used for preprocessing
intermediate_model_yaml_file = "phreeqcrm/helper.yaml"
# optional user-specified yaml that will be prepended to generated yaml
# advanced option
pre_yaml_file = "phreeqcrm/pre.yaml"
# optional user-specified yaml that will be appended to generated yaml
# advanced option
post_yaml_file = "phreeqcrm/post.yaml"
# PhreeqcRM yaml with all inputs pre + generated + post
model_yaml_file = "phreeqcrm/model.yaml"

# specify what output will be saved
# optional section, no output if not present
[output]
# save all minerals in this directory, no saving if not line not present
equilibrium_phases = "out/equilibrium_phases"
# save all concentrations in this directory, no saving if not line not present
concentrations = "out/concentrations"
# save constituents specified in `SELECTED_OUTPUT`
# currently format is `shelve`
# https://docs.python.org/3/library/shelve.html#module-shelve
selected_output = "out/selected_output"
# set to true to all constituents, attention: may create large output files
save_all = false

Example initial condition input file in MODFLOW 6 IC format.

BEGIN options
END options

BEGIN griddata
  strt
    # rtmf6_solution_number
    CONSTANT       1
END griddata

Solution 1 will be use for cells as initial condition. For example, the concentration in the components model Ca is 0.6 and Cl is 1.2. See my_model.pqi below for the numbers.

Example boundary condition file in WEL format.

BEGIN options
  auxiliary  concentration  rtmf6_sol_number
  SAVE_FLOWS
END options

BEGIN dimensions
  MAXBOUND  1
END dimensions

BEGIN period  1
  1 1 1 1 0 0
END period  1

The concentrations in the second last column will be replaced by the component concentration of the species of the solution 0 as indicated by tmf6_sol_number. For example, the initial concentration in the components model Na is 1.0 and K is 0.2. See my_model.pqi below for the numbers.

Example my_model.pqi file.

SOLUTION 0  CaCl2
   # Inflow at boundary
        units            mmol/kgw
        temp             25.0
        pH               7.0     charge
        pe               12.5    O2(g)   -0.68
        Ca               0.6
        Cl               1.2
        Tracer           0.5
SOLUTION 1
    # Initial solution
        units            mmol/kgw
        temp             25.0
        pH               7.0     charge
        pe               12.5    O2(g)   -0.68
        Na               1.0
        K                0.2
        N(5)             1.2
        Tracer           2.0
END
EXCHANGE 1
    CaX2 0.00000e+00
    NaX 5.49300e-04
    KX 5.50700e-04
    -equilibrate 1
END

Solution 0 is used for the boundary condition in WEL. Solution 1 is used as initial condition.