mf6rtm.config package¶
Submodules¶
mf6rtm.config.config module¶
Configuration schema and (de)serialization for mf6rtm runs.
Defines MF6RTMConfig, the container for reactive-transport run
settings, with helpers to load from and save to TOML and dictionary form.
- class mf6rtm.config.config.ConfigSchema(group, toml_name=None)¶
Bases:
objectSchema definition for configuration grouping.
- group: str¶
- toml_name: str | None = None¶
- class mf6rtm.config.config.MF6RTMConfig(**kwargs)¶
Bases:
objectMF6RTM Configuration class similar to FloPy package structure. This class provides a FloPy-style interface for configuring MF6RTM reaction timing parameters.
- Parameters:
reaction_timing (str, optional) – Controls when reactions are calculated. Options: - ‘all’ : Calculate reactions at all time steps (default) - ‘user’ : Calculate reactions only at user-specified time steps - ‘adaptive’ : Use adaptive timing based on convergence criteria
tsteps (List[Tuple[int, int]], optional) – List of (kper, kstp) tuples specifying when reactions should be calculated. Only used when reaction_timing=’user’. Default is empty list. kper is stress period (1-based), kstp is time step (1-based).
- reaction_timing¶
Current reaction timing strategy.
- Type:
str
- tsteps¶
List of time steps for reaction calculations.
- Type:
List[Tuple[int, int]]
- add_new_configuration(**kwargs)¶
Add new configuration parameters dynamically.
- Parameters:
**kwargs – Configuration parameters to set as attributes on the instance.
- classmethod from_dict(config_dict)¶
Build a configuration from a nested dictionary.
- Parameters:
config_dict (
Dict[str,Any]) – Nested configuration mapping. Thereactiveandemulatorsections are handled explicitly; remaining sections are flattened.- Return type:
- classmethod from_toml_file(filepath)¶
Load configuration from TOML file.
- Parameters:
filepath (
str) – Path to TOML configuration file.- Returns:
New configuration instance loaded from file.
- Return type:
- get_tsteps_for_period(kper)¶
Get time steps for a specific stress period.
- Parameters:
kper (
int) – Stress period number (1-based).- Returns:
List of time step numbers for the given stress period.
- Return type:
List[int]
Examples
>>> config = MF6RTMConfig(reactive_timing='user', ... reactive_tsteps=[(1, 1), (1, 10), (2, 5)]) >>> config.get_tsteps_for_period(1) [1, 10]
- is_reaction_tstep(kper, kstp)¶
Check if reactions should be calculated at a specific time step.
- Parameters:
kper (
int) – Stress period number (1-based).kstp (
int) – Time step number (1-based).
- Returns:
True if reactions should be calculated at this time step.
- Return type:
bool
Examples
>>> config = MF6RTMConfig(reaction_timing='user', tsteps=[(1, 1)]) >>> config.is_reaction_tstep(1, 1) True >>> config.is_reaction_tstep(1, 2) False
- save_to_file(filepath)¶
Save configuration to TOML file.
- Parameters:
filepath (
str) – Path where TOML file should be saved.
- to_dict()¶
Convert the configuration to a nested dictionary for TOML output.
- Returns:
Nested mapping with category groups (
reactive,emulator), phase sections, and remaining keys, ordered for TOML serialization.- Return type:
Dict[str,Any]
mf6rtm.config.yaml_reader module¶
Helpers to reconstruct a YAMLPhreeqcRM instance from a YAML file.
- mf6rtm.config.yaml_reader.load_yaml_to_phreeqcrm(yaml_file_path)¶
Load a YAML file and reconstruct a YAMLPhreeqcRM instance.
- Parameters:
yaml_file_path (str) – Path to the YAML file.
- Returns:
Reconstructed instance.
- Return type:
YAMLPhreeqcRM