crunchflow.input
The crunchflow.input subpackage provides tools for reading, writing, and modifying CrunchFlow input files using Python classes that mirror the structure of these files.
CrunchFlow input files are divided into keyword blocks (e.g., RUNTIME, FLOW, TRANSPORT, CONDITION), each of which controls a specific aspect of the simulation setup. This subpackage offers Python representations for each of these blocks and supports programmatic workflows for creating or editing .in files.
- Some notable features include:
The InputFile class represents an entire CrunchFlow input file, with one attribute per block (e.g., .runtime, .flow, .output, etc.).
Each block is implemented as a dedicated class (e.g., Flow, Transport, Condition) and inherits from a shared KeywordBlock base class.
Input files can be generated from scratch, modified in memory, or parsed from existing files.
The ThermoDatabase class provides a way to read and represent CrunchFlow thermodynamic databases, including species and phases.
Most blocks in a CrunchFlow input file correspond directly to attributes of the InputFile class. For example, the FLOW block is accessible via InputFile.flow, and the RUNTIME block via InputFile.runtime. Similarly, most keywords within a block (e.g., calculate_flow, time_units, or permeability_x) are represented as attributes of that block’s class. For example, InputFile.flow.calculate_flow or InputFile.runtime.time_units.
- Two notable exceptions to this structure are:
Conditions: Because multiple CONDITION blocks can be defined in a single input file, they are stored as a dictionary in InputFile.conditions, with each key representing the name of a different condition.
Species in Conditions: Within a CONDITION block, any number of species can be specified, with arbitrary names (e.g., Na+, Cl-, HCO3-). These are stored as key-value pairs in the concentrations dictionary of the Condition object, rather than as fixed attributes.
Subpackages
Submodules
Classes
Condition block for the input file |
|
Base class for all keyword blocks in a CrunchFlow input file |
|
Standalone aqueous database with two entry types: |
|
One &Aqueous entry (reaction stoichiometry) from an aqueous kinetics database. |
|
In-memory representation of a CrunchFlow-style thermodynamic database. |
|
Exchange reaction from the 'Begin exchange' block. |
|
Gas entry in the 'gases' block; represented by its formation/dissolution |
|
Mineral kinetics entry from the thermodynamic database. |
|
Mineral entry in the 'minerals' block; dissolution reaction and logK(T). |
|
Entry from the 'primary' block |
|
Secondary aqueous complex: |
|
Surface complex from the 'surface complexation' block. |
|
Surface complexation parameters from the thermodynamic database. |
|
The main class for creating and saving CrunchFlow input files. |