mf6rtm.mup3d package¶
Submodules¶
mf6rtm.mup3d.base module¶
Base module of the mup3d package
- class mf6rtm.mup3d.base.Block(data, ic=None)¶
Bases:
objectBase class for PHREEQC input “keyword data blocks”.
- data¶
Dictionary of geochemical components (keys) and their total concentrations (list) and other parameters, indexed by block number, similar to a .pqi file.
- Type:
dict
- names¶
List of names of geochemical components that serve as keys to the data.
- Type:
list
- ic¶
Initial condition.
- Type:
array
- eq_solutions¶
List of equilibrium solutions.
- Type:
list
- options¶
List of options.
- Type:
list
- get_names()¶
Get the names of geochemical components or phases specified in the block.
- Returns:
List of names of geochemical components that serve as keys to the data.
- Return type:
list
- ic¶
None means no initial condition (-1)
- set_equilibrate_solutions(eq_solutions)¶
Set the equilibrium solutions for the exchange phases. Array where index is the exchange phase number and value is the solution number to equilibrate with.
- Parameters:
eq_solutions – List of equilibrium solution indices for each exchange phase.
- Return type:
None
- set_ic(ic)¶
Set the initial condition for the block.
- Parameters:
ic (
Union[int,float,ndarray]) – Initial condition concentrations. Can be an int, float, or ndarray.- Return type:
None
- set_options(options)¶
Set the options for the block.
- Parameters:
options – List of options for the block.
- Return type:
None
- class mf6rtm.mup3d.base.ChemStress(packnme, type='aux')¶
Bases:
objectThe ChemStress class for handling stress period data.
- packnme¶
Name of the package.
- Type:
str
- type¶
Boundary coupling type:
'aux'(GWF stress package + GWT SSM),'cnc'(GWT constant-concentration), or'src'(GWT mass-loading). Default is'aux'.- Type:
str
- sol_spd¶
List of solution indices (one per boundary cell). Default is None.
- Type:
list, optional
- cells¶
List of cellids — required for cnc/src; for aux the cells come from the GWF package SPD. Default is None.
- Type:
list, optional
Notes
# TODO: advanced MF6 transport packages (LKT, MVT, UZT, SFT, MWT, IST) are # not yet supported. These require per-component re-equilibration analogous # to the aux/cnc path and will be added in a future release.
- set_cells(cells)¶
Set the boundary cell ids.
Required for
'cnc'and'src'types; for'aux'the cells are taken from the GWF package stress period data.- Parameters:
cells (list of tuple) – Cell ids, e.g.
(layer, row, col)for DIS or(layer, cell2d)for DISV.
- set_spd(sol_spd)¶
Set the solution stress period data.
- Parameters:
sol_spd (list of int) – Solution indices, one per boundary cell, mapping each cell to a PHREEQC solution number.
- set_type(type)¶
Set the boundary coupling type.
- Parameters:
type ({'aux', 'cnc', 'src'}) – Boundary coupling type:
'aux'(GWF stress package + GWT SSM),'cnc'(GWT constant-concentration), or'src'(GWT mass-loading).
- class mf6rtm.mup3d.base.EquilibriumPhases(data)¶
Bases:
BlockThe EquilibriumPhases Block.
- parameters¶
Dictionary of parameters for the equilibrium phases. Default is None.
- Type:
dict, optional
- class mf6rtm.mup3d.base.ExchangePhases(data)¶
Bases:
BlockThe ExchangePhases Block.
- parameters¶
Dictionary of parameters for the exchange phases. Default is None.
- Type:
dict, optional
- class mf6rtm.mup3d.base.GasPhase(data)¶
Bases:
BlockThe GasPhase Block.
- parameters¶
Dictionary of parameters for the gas phase. Default is None.
- Type:
dict, optional
- class mf6rtm.mup3d.base.KineticPhases(data)¶
Bases:
BlockThe KineticPhases Block.
- parameters¶
Dictionary of parameters for the kinetic phases. Default is None.
- Type:
dict, optional
- set_parameters(parameters)¶
Set the kinetic phase parameters.
- Parameters:
parameters (dict) – Parameters for the kinetic phases, keyed by mineral/phase name.
- class mf6rtm.mup3d.base.Mup3d(name=None, solutions=None, nlay=None, nrow=None, ncol=None, ncpl=None, nxyz=None)¶
Bases:
objectThe Mup3d class wrapper and extension for a PhreeqcRM model class.
This class extends the PhreeqcRM class to include additional methods that facilitate the coupling to Modflow6 via ModflowAPI.
- name¶
Name of the model.
- Type:
str
- wd¶
Working directory path.
- Type:
str
- charge_offset¶
Charge offset, initialized to 0.0.
- Type:
float
- database¶
Path to the PHREEQC database file.
- Type:
str
- init_temp¶
Initial temperature. Default is 25.0.
- Type:
float, optional
- equilibrium_phases¶
Equilibrium phases in the model.
- Type:
- kinetic_phases¶
Kinetic phases in the model.
- Type:
- exchange_phases¶
Exchange phases in the model.
- Type:
- postfix¶
Postfix for the output files.
- Type:
str
- phreeqc_rm¶
PHREEQC reactive transport model instance.
- Type:
object
- init_conc_array_phreeqc¶
1D array of concentrations (mol/L) structured for PhreeqcRM, with each component concentration for each grid cell ordered by model.components.
- Type:
ndarray
- sconc¶
Dictionary of concentrations in units of moles per m^3 and structured to match the shape of Modflow’s grid.
- Type:
dict[str, np.ndarray]
- phinp¶
PHREEQC input instance.
- Type:
object
- components¶
List of chemical components.
- Type:
list
- fixed_components¶
List of fixed components.
- Type:
list
- nlay¶
Number of layers in the model grid.
- Type:
int
- nrow¶
Number of rows in the model grid.
- Type:
int
- ncol¶
Number of columns in the model grid.
- Type:
int
- nxyz¶
Total number of cells in the model grid, either (nlay * nrow * ncol) if DIS or (nlay * ncpl) if DISV or (nxyz) if DISU.
- Type:
int
- grid_shape¶
Shape of the model grid, either (nlay, nrow, ncol) if DIS or (nlay, ncpl) if DISV or (nxyz) if DISU.
- Type:
tuple
- classmethod from_mf6(sim, solutions, name=None, gwf_name=None, gwt_name=None)¶
Create a Mup3d instance from an existing flopy MFSimulation.
Grid dimensions are extracted automatically from the GWF model. The conservative tracer GWT model is stored as a template and will be cloned into N reactive GWT models (one per PHREEQC component) when
write_simulation()is called.- Parameters:
sim (flopy.mf6.MFSimulation) – Loaded flopy simulation containing at least one GWF and one GWT model.
solutions (Solutions) – Geochemical solutions for the reactive transport model.
name (str, optional) – Model name. Defaults to None.
gwf_name (str, optional) – Name of the GWF model. Defaults to the first model in sim.
gwt_name (str, optional) – Name of the conservative tracer GWT model to use as template. Required when the simulation contains more than one GWT model.
- Return type:
- generate_phreeqc_script(add_charge_flag=False)¶
Generates the phinp file for the MF6RTM model.
- Parameters:
add_charge_flag (bool or str, optional) – Add the PHREEQC
chargebalancing flag to one component in every SOLUTION block.False(default) disables it.Trueapplies it to"pH"(legacy behavior). Pass a single component name (e.g."Cl") to balance on that component instead. Only one component may carry the flag.- Returns:
The generated PHREEQC script as a string.
- Return type:
str
- get_componenth2o()¶
Get componenth2o flag
- Returns:
The value of the componenth2o flag.
- Return type:
bool
- get_config()¶
Retrieve config object
- Returns:
Configuration parameters as a dictionary.
- Return type:
dict
- initialize(nthreads=1, add_charge_flag=False)¶
Initialize a PhreeqcRM object and calculate initial concentrations.
This method initializes a PhreeqcRM object using PHREEQC inputs and adds several key attributes to the Mup3d object for reactive transport modeling.
- Parameters:
nthreads (int, optional) – Number of threads for parallel processing. Default is 1.
add_charge_flag (bool or str, optional) – Add the PHREEQC
chargebalancing flag to one component.False(default) disables it,Trueapplies it to"pH", and a single component name (e.g."Cl") balances on that component instead.Added (Attributes)
---------------
components (list) – List of transportable chemical components.
init_conc_array_phreeqc (ndarray) – 1D array of concentrations (mol/L) structured for PhreeqcRM, with each component concentration for each grid cell ordered by model.components.
sconc (dict) – Dictionary with components as keys and concentration arrays (mol/m^3) as values, structured to match the shape of the Modflow6 model domain grid.
phreeqc_rm (PhreeqcRM) – Initialized PhreeqcRM object.
nchem (int) – Number of chemistry cells.
- Return type:
None
Notes
This method performs several key initialization steps: 1. Generates PHREEQC input script 2. Initializes PhreeqcRM object 3. Sets up initial conditions 4. Calculates initial concentrations 5. Converts concentrations to proper units and grid structure
- initialize_chem_stress(attr, nthreads=1)¶
Initialize a PhreeqcRM object with boundary condition chemical concentrations for the specified Modflow Stress Period and Package.
- Parameters:
attr (
str) – The Modflow 6 Package name.nthreads (
int) – Number of threads to use for PhreeqcRM (default is 1).
- Returns:
Dictionary with component names as keys and concentration arrays in moles/m3 as values.
- Return type:
dict
Notes
This function initializes a PhreeqcRM object, loads a database, runs a Phreeqc input file, and transfers solutions and reactants to the reaction-module workers. It then equilibrates the cells, gets the concentrations, and converts them to moles/m3.
See also
phreeqcrm.PhreeqcRMPhreeqcRM class documentation.
- classmethod load_mup3d(filename='mup3d.pkl', wd='.')¶
Load a Mup3d object from a pickle file (class method). This creates a new Mup3d instance from a saved pickle file.
- Parameters:
filename (str, optional) – Name of the pickle file. Default is ‘mup3d.pkl’.
working_dir (str, optional) – Directory containing the pickle file. Default is current directory.
- Returns:
A new Mup3d instance loaded from the pickle file.
- Return type:
Examples
>>> # Create a new model from pickle file >>> model = Mup3d.load_mup3d('my_model.pkl', '/path/to/model/dir')
- run(reactive=None, nthread=1, libname=None, output_format=None, **kwargs)¶
Wrapper function to run the MF6RTM model
- Parameters:
reactive (bool, optional) – Whether to run the model in reactive mode. If None, uses the value from the config.
nthread (int, optional) – Number of threads to use for the simulation. Default is 1.
libname (str, optional) – Name of the MF6 shared library. If None, uses the default.
output_format (str, optional) – Output format: “csv” (default) or “hdf5”. Overrides mf6rtm.toml [output]. Output file is named “sout.csv” or “sout.h5” accordingly.
**kwargs – Additional keyword arguments set as attributes on the Mf6RTM instance before solving. Valid keys are any settable attribute of Mf6RTM, e.g.:
threshold,min_concentration,charge_offset,fixed_components.
- Returns:
True if the model ran successfully, False otherwise.
- Return type:
bool
- save_config()¶
Save config toml file
- Returns:
Path to the saved configuration file.
- Return type:
Path
- save_mup3d(filename='mup3d.pkl')¶
Save the Mup3d object to a pickle file.
This method saves all non-private, non-callable attributes of the Mup3d object to a pickle file for later restoration using load_mup3d().
- Parameters:
filename (str, optional) – Name of the pickle file. Default is ‘mup3d.pkl’.
- set_charge_offset(charge_offset)¶
Sets the charge offset for the MF6RTM model to handle negative charge values
- Parameters:
charge_offset (float) – The charge offset value to be added to the charge concentration.
- Return type:
None
- set_chem_stress(chem_stress)¶
Sets the ChemStress instance for the MF6RTM model.
- Parameters:
chem_stress (
ChemStress) – Instance of the ChemStress class containing stress period data.- Return type:
None
- set_componenth2o(flag)¶
Set the component H2O to be True or False. if False Total H and Total O are transported if True H2O, Excess H and Excess O are transported
- Parameters:
flag (bool) – True to include H2O as a component, False otherwise.
- Returns:
The value of the componenth2o flag.
- Return type:
bool
- Raises:
AssertionError – If flag is not a boolean.
- set_config(**kwargs)¶
Create and store a config object.
- Parameters:
**kwargs (dict) – Configuration parameters for MF6RTMConfig.
- Returns:
The created configuration object.
- Return type:
- set_database(database)¶
Set the database for the MF6RTM model.
Copies the database file into the working directory for self-containment.
- Parameters:
database (str) – The path to the database file.
- set_diffusion_coeff(diffusion_coeff)¶
Set molecular diffusion coefficients per PHREEQC component.
- Parameters:
diffusion_coeff (
dict) – Mapping of component name to diffusion coefficient in m²/s, e.g.{'Ca': 0.792e-9, 'Cl': 2.032e-9}. Components not listed default to 0 (no diffusion) with a warning at write time.- Return type:
None
- set_equilibrium_phases(eq_phases)¶
Sets the equilibrium phases for the MF6RTM model.
- Parameters:
eq_phases (EquilibriumPhases) – Instance of the EquilibriumPhases class containing geochemical data.
- Return type:
None
- set_exchange_phases(exchanger)¶
Sets the exchange phases for the MF6RTM model.
- Parameters:
exchanger (ExchangePhases) – Instance of the ExchangePhases class containing geochemical data.
- Return type:
None
- set_fixed_components(fixed_components)¶
Set the fixed components for the MF6RTM model. These are the components that are not transported during the simulation.
- Parameters:
fixed_components (list) – List of component names to be fixed (not transported).
- Return type:
None
- set_initial_temp(temp)¶
Sets the initial temperature for the MF6RTM model.
- Parameters:
temp (int, float, or list) – Initial temperature value(s). Can be a single value (int or float) for homogeneous temperature or a list for spatially variable temperature.
- Return type:
None
- set_phases(phase)¶
Sets the phases for the MF6RTM model.
- Parameters:
phase (KineticPhases, ExchangePhases, EquilibriumPhases, or Surfaces) – Instance of one of the phase classes containing geochemical data.
- Return type:
None
- set_postfix(postfix)¶
Set the postfix file for the MF6RTM model.
- Parameters:
postfix (str) – The path to the postfix file.
- Raises:
AssertionError – If the postfix file does not exist.
- set_reaction_temp()¶
Sets the reaction temperature for the MF6RTM model.
- Returns:
List of reaction temperatures for each grid cell.
- Return type:
list
- set_wd(wd)¶
Set the working directory for the MF6RTM model.
The directory is created if it does not already exist.
- Parameters:
wd (str) – The path to the working directory.
- write_external_files_layered(internals=['exchange_phases', 'equilibrium_phases', 'kinetic_phases'], property_to_write=['m0'])¶
Write layered external text files for selected geochemical phases and properties.
For each specified geochemical phase (e.g., exchange, equilibrium, kinetic), this method extracts the given properties (e.g., ‘m0’) for all defined species and writes a separate file per layer in the simulation domain. The files are saved in the model’s working directory and follow the naming convention:
{phase}.{species}.{property}.layer{n}.txt
- Parameters:
internals (list of str, optional) – List of model attributes containing geochemical phase data. Default is [“exchange_phases”, “equilibrium_phases”, “kinetic_phases”].
property_to_write (list of str, optional) – List of property names to extract and write per species and layer. Default is [‘m0’].
- Return type:
None
- write_internal_parameters(internals={'equilibrium_phases': ['si'], 'exchange_phases': ['dummy'], 'kinetic_phases': ['parms', 'formula', 'steps']})¶
Add non-external attributes to the config object.
- Parameters:
internals (dict) –
Dictionary with phase names as keys and list of attributes to add as values. Default is {
”equilibrium_phases”: [“si”], “kinetic_phases”: [“parms”, “formula”, “steps”], “exchange_phases”: [“dummy”]
}.
- Return type:
None
- write_simulation()¶
Write phreqcrm simulation and configuration files.
When the instance was created via from_mf6(), also clones the conservative tracer GWT into reactive GWT models, wires stress package auxiliary variables, and writes the full MF6 simulation to self.wd.
- Return type:
None
- class mf6rtm.mup3d.base.Solutions(data)¶
Bases:
BlockThe Solutions Block.
- parameters¶
Dictionary of parameters for the solutions. Default is None.
- Type:
dict, optional
- class mf6rtm.mup3d.base.Surfaces(data)¶
Bases:
BlockThe Surfaces Block.
- parameters¶
Dictionary of parameters for the surfaces. Default is None.
- Type:
dict, optional
- mf6rtm.mup3d.base.working_dir(path)¶
Context manager for changing the current working directory.
- Parameters:
path (str) – Path to the directory to change to.
- Yields:
None
Module contents¶
The mup3d module provides function to write input files for phreeqcrm and adds functionality to write files externally in a modflow-like fashion.
History: The Model Utility Preprocessor 3D (MUP3D) was envisioned by Mr. Beaker as a successor to PHT3D.
- class mf6rtm.mup3d.Mup3d(name=None, solutions=None, nlay=None, nrow=None, ncol=None, ncpl=None, nxyz=None)¶
Bases:
objectThe Mup3d class wrapper and extension for a PhreeqcRM model class.
This class extends the PhreeqcRM class to include additional methods that facilitate the coupling to Modflow6 via ModflowAPI.
- name¶
Name of the model.
- Type:
str
- wd¶
Working directory path.
- Type:
str
- charge_offset¶
Charge offset, initialized to 0.0.
- Type:
float
- database¶
Path to the PHREEQC database file.
- Type:
str
- init_temp¶
Initial temperature. Default is 25.0.
- Type:
float, optional
- equilibrium_phases¶
Equilibrium phases in the model.
- Type:
- kinetic_phases¶
Kinetic phases in the model.
- Type:
- exchange_phases¶
Exchange phases in the model.
- Type:
- postfix¶
Postfix for the output files.
- Type:
str
- phreeqc_rm¶
PHREEQC reactive transport model instance.
- Type:
object
- init_conc_array_phreeqc¶
1D array of concentrations (mol/L) structured for PhreeqcRM, with each component concentration for each grid cell ordered by model.components.
- Type:
ndarray
- sconc¶
Dictionary of concentrations in units of moles per m^3 and structured to match the shape of Modflow’s grid.
- Type:
dict[str, np.ndarray]
- phinp¶
PHREEQC input instance.
- Type:
object
- components¶
List of chemical components.
- Type:
list
- fixed_components¶
List of fixed components.
- Type:
list
- nlay¶
Number of layers in the model grid.
- Type:
int
- nrow¶
Number of rows in the model grid.
- Type:
int
- ncol¶
Number of columns in the model grid.
- Type:
int
- nxyz¶
Total number of cells in the model grid, either (nlay * nrow * ncol) if DIS or (nlay * ncpl) if DISV or (nxyz) if DISU.
- Type:
int
- grid_shape¶
Shape of the model grid, either (nlay, nrow, ncol) if DIS or (nlay, ncpl) if DISV or (nxyz) if DISU.
- Type:
tuple
- classmethod from_mf6(sim, solutions, name=None, gwf_name=None, gwt_name=None)¶
Create a Mup3d instance from an existing flopy MFSimulation.
Grid dimensions are extracted automatically from the GWF model. The conservative tracer GWT model is stored as a template and will be cloned into N reactive GWT models (one per PHREEQC component) when
write_simulation()is called.- Parameters:
sim (flopy.mf6.MFSimulation) – Loaded flopy simulation containing at least one GWF and one GWT model.
solutions (Solutions) – Geochemical solutions for the reactive transport model.
name (str, optional) – Model name. Defaults to None.
gwf_name (str, optional) – Name of the GWF model. Defaults to the first model in sim.
gwt_name (str, optional) – Name of the conservative tracer GWT model to use as template. Required when the simulation contains more than one GWT model.
- Return type:
- generate_phreeqc_script(add_charge_flag=False)¶
Generates the phinp file for the MF6RTM model.
- Parameters:
add_charge_flag (bool or str, optional) – Add the PHREEQC
chargebalancing flag to one component in every SOLUTION block.False(default) disables it.Trueapplies it to"pH"(legacy behavior). Pass a single component name (e.g."Cl") to balance on that component instead. Only one component may carry the flag.- Returns:
The generated PHREEQC script as a string.
- Return type:
str
- get_componenth2o()¶
Get componenth2o flag
- Returns:
The value of the componenth2o flag.
- Return type:
bool
- get_config()¶
Retrieve config object
- Returns:
Configuration parameters as a dictionary.
- Return type:
dict
- initialize(nthreads=1, add_charge_flag=False)¶
Initialize a PhreeqcRM object and calculate initial concentrations.
This method initializes a PhreeqcRM object using PHREEQC inputs and adds several key attributes to the Mup3d object for reactive transport modeling.
- Parameters:
nthreads (int, optional) – Number of threads for parallel processing. Default is 1.
add_charge_flag (bool or str, optional) – Add the PHREEQC
chargebalancing flag to one component.False(default) disables it,Trueapplies it to"pH", and a single component name (e.g."Cl") balances on that component instead.Added (Attributes)
---------------
components (list) – List of transportable chemical components.
init_conc_array_phreeqc (ndarray) – 1D array of concentrations (mol/L) structured for PhreeqcRM, with each component concentration for each grid cell ordered by model.components.
sconc (dict) – Dictionary with components as keys and concentration arrays (mol/m^3) as values, structured to match the shape of the Modflow6 model domain grid.
phreeqc_rm (PhreeqcRM) – Initialized PhreeqcRM object.
nchem (int) – Number of chemistry cells.
- Return type:
None
Notes
This method performs several key initialization steps: 1. Generates PHREEQC input script 2. Initializes PhreeqcRM object 3. Sets up initial conditions 4. Calculates initial concentrations 5. Converts concentrations to proper units and grid structure
- initialize_chem_stress(attr, nthreads=1)¶
Initialize a PhreeqcRM object with boundary condition chemical concentrations for the specified Modflow Stress Period and Package.
- Parameters:
attr (
str) – The Modflow 6 Package name.nthreads (
int) – Number of threads to use for PhreeqcRM (default is 1).
- Returns:
Dictionary with component names as keys and concentration arrays in moles/m3 as values.
- Return type:
dict
Notes
This function initializes a PhreeqcRM object, loads a database, runs a Phreeqc input file, and transfers solutions and reactants to the reaction-module workers. It then equilibrates the cells, gets the concentrations, and converts them to moles/m3.
See also
phreeqcrm.PhreeqcRMPhreeqcRM class documentation.
- classmethod load_mup3d(filename='mup3d.pkl', wd='.')¶
Load a Mup3d object from a pickle file (class method). This creates a new Mup3d instance from a saved pickle file.
- Parameters:
filename (str, optional) – Name of the pickle file. Default is ‘mup3d.pkl’.
working_dir (str, optional) – Directory containing the pickle file. Default is current directory.
- Returns:
A new Mup3d instance loaded from the pickle file.
- Return type:
Examples
>>> # Create a new model from pickle file >>> model = Mup3d.load_mup3d('my_model.pkl', '/path/to/model/dir')
- run(reactive=None, nthread=1, libname=None, output_format=None, **kwargs)¶
Wrapper function to run the MF6RTM model
- Parameters:
reactive (bool, optional) – Whether to run the model in reactive mode. If None, uses the value from the config.
nthread (int, optional) – Number of threads to use for the simulation. Default is 1.
libname (str, optional) – Name of the MF6 shared library. If None, uses the default.
output_format (str, optional) – Output format: “csv” (default) or “hdf5”. Overrides mf6rtm.toml [output]. Output file is named “sout.csv” or “sout.h5” accordingly.
**kwargs – Additional keyword arguments set as attributes on the Mf6RTM instance before solving. Valid keys are any settable attribute of Mf6RTM, e.g.:
threshold,min_concentration,charge_offset,fixed_components.
- Returns:
True if the model ran successfully, False otherwise.
- Return type:
bool
- save_config()¶
Save config toml file
- Returns:
Path to the saved configuration file.
- Return type:
Path
- save_mup3d(filename='mup3d.pkl')¶
Save the Mup3d object to a pickle file.
This method saves all non-private, non-callable attributes of the Mup3d object to a pickle file for later restoration using load_mup3d().
- Parameters:
filename (str, optional) – Name of the pickle file. Default is ‘mup3d.pkl’.
- set_charge_offset(charge_offset)¶
Sets the charge offset for the MF6RTM model to handle negative charge values
- Parameters:
charge_offset (float) – The charge offset value to be added to the charge concentration.
- Return type:
None
- set_chem_stress(chem_stress)¶
Sets the ChemStress instance for the MF6RTM model.
- Parameters:
chem_stress (
ChemStress) – Instance of the ChemStress class containing stress period data.- Return type:
None
- set_componenth2o(flag)¶
Set the component H2O to be True or False. if False Total H and Total O are transported if True H2O, Excess H and Excess O are transported
- Parameters:
flag (bool) – True to include H2O as a component, False otherwise.
- Returns:
The value of the componenth2o flag.
- Return type:
bool
- Raises:
AssertionError – If flag is not a boolean.
- set_config(**kwargs)¶
Create and store a config object.
- Parameters:
**kwargs (dict) – Configuration parameters for MF6RTMConfig.
- Returns:
The created configuration object.
- Return type:
- set_database(database)¶
Set the database for the MF6RTM model.
Copies the database file into the working directory for self-containment.
- Parameters:
database (str) – The path to the database file.
- set_diffusion_coeff(diffusion_coeff)¶
Set molecular diffusion coefficients per PHREEQC component.
- Parameters:
diffusion_coeff (
dict) – Mapping of component name to diffusion coefficient in m²/s, e.g.{'Ca': 0.792e-9, 'Cl': 2.032e-9}. Components not listed default to 0 (no diffusion) with a warning at write time.- Return type:
None
- set_equilibrium_phases(eq_phases)¶
Sets the equilibrium phases for the MF6RTM model.
- Parameters:
eq_phases (EquilibriumPhases) – Instance of the EquilibriumPhases class containing geochemical data.
- Return type:
None
- set_exchange_phases(exchanger)¶
Sets the exchange phases for the MF6RTM model.
- Parameters:
exchanger (ExchangePhases) – Instance of the ExchangePhases class containing geochemical data.
- Return type:
None
- set_fixed_components(fixed_components)¶
Set the fixed components for the MF6RTM model. These are the components that are not transported during the simulation.
- Parameters:
fixed_components (list) – List of component names to be fixed (not transported).
- Return type:
None
- set_initial_temp(temp)¶
Sets the initial temperature for the MF6RTM model.
- Parameters:
temp (int, float, or list) – Initial temperature value(s). Can be a single value (int or float) for homogeneous temperature or a list for spatially variable temperature.
- Return type:
None
- set_phases(phase)¶
Sets the phases for the MF6RTM model.
- Parameters:
phase (KineticPhases, ExchangePhases, EquilibriumPhases, or Surfaces) – Instance of one of the phase classes containing geochemical data.
- Return type:
None
- set_postfix(postfix)¶
Set the postfix file for the MF6RTM model.
- Parameters:
postfix (str) – The path to the postfix file.
- Raises:
AssertionError – If the postfix file does not exist.
- set_reaction_temp()¶
Sets the reaction temperature for the MF6RTM model.
- Returns:
List of reaction temperatures for each grid cell.
- Return type:
list
- set_wd(wd)¶
Set the working directory for the MF6RTM model.
The directory is created if it does not already exist.
- Parameters:
wd (str) – The path to the working directory.
- write_external_files_layered(internals=['exchange_phases', 'equilibrium_phases', 'kinetic_phases'], property_to_write=['m0'])¶
Write layered external text files for selected geochemical phases and properties.
For each specified geochemical phase (e.g., exchange, equilibrium, kinetic), this method extracts the given properties (e.g., ‘m0’) for all defined species and writes a separate file per layer in the simulation domain. The files are saved in the model’s working directory and follow the naming convention:
{phase}.{species}.{property}.layer{n}.txt
- Parameters:
internals (list of str, optional) – List of model attributes containing geochemical phase data. Default is [“exchange_phases”, “equilibrium_phases”, “kinetic_phases”].
property_to_write (list of str, optional) – List of property names to extract and write per species and layer. Default is [‘m0’].
- Return type:
None
- write_internal_parameters(internals={'equilibrium_phases': ['si'], 'exchange_phases': ['dummy'], 'kinetic_phases': ['parms', 'formula', 'steps']})¶
Add non-external attributes to the config object.
- Parameters:
internals (dict) –
Dictionary with phase names as keys and list of attributes to add as values. Default is {
”equilibrium_phases”: [“si”], “kinetic_phases”: [“parms”, “formula”, “steps”], “exchange_phases”: [“dummy”]
}.
- Return type:
None
- write_simulation()¶
Write phreqcrm simulation and configuration files.
When the instance was created via from_mf6(), also clones the conservative tracer GWT into reactive GWT models, wires stress package auxiliary variables, and writes the full MF6 simulation to self.wd.
- Return type:
None