USGS PHREEQC Aqueous Geochemistry & Speciation (.pqi, .dat)
@modelscript/phreeqc (languages/phreeqc) provides native WebAssembly GLR parsing, ionic strength and Davies / Extended Debye-Hückel activity coefficient calculation, aqueous carbonate/redox speciation, mineral Saturation Index (DAEBuilder lowering, and Modelica 3.x projection for USGS PHREEQC hydrogeochemical, brine scaling, carbon mineralization, and water treatment models.
Supported Extensions & Standards
| Extension | Format | Description |
|---|---|---|
.pqi | PHREEQC Input Deck | Keyword data blocks (TITLE, SOLUTION, EQUILIBRIUM_PHASES, REACTION, KINETICS, MIX, SELECTED_OUTPUT, END) |
.dat | Thermodynamic Database | Aqueous species (SOLUTION_SPECIES) and mineral solubility (PHASES) database definitions |
Key Capabilities
1. Ionic Strength & Activity Coefficients
- Computes solution ionic strength
, charge balance error (% CBE), and ion activity coefficients using the Davies or WATEQ Extended Debye-Hückel equation:
2. Mineral Saturation Indices ( ) & Equilibrium Phases
- Evaluates Ion Activity Products (
) and mineral Saturation Indices across carbonate, sulfate, and silicate phases ( Calcite,Dolomite,Gypsum,Anhydrite,Barite,Halite,Quartz):identifying supersaturated scaling hazards ( ) and undersaturated dissolution regimes ( ).
3. DAE Arena Lowering & Modelica Projection
- Lowers aqueous mass-action, charge-balance, and kinetic mineral dissolution/precipitation equations into
@modelscript/runtime'sDAEBuilderarena and projects them into Modelica 3.x hydrochemical blocks.
Pre-Flight Diagnostics
10 rules8 error2 warning
| Code | Rule | Severity | Message |
|---|---|---|---|
M9551 | ph-out-of-physical-bounds | error | SOLUTION '<solutionNumber>' specifies pH '<pH>' outside standard aqueous bounds [0, 14]. |
M9552 | pe-out-of-redox-stability-bounds | warning | SOLUTION '<solutionNumber>' specifies redox potential pe '<pe>' outside water stability bounds [-15, 25]. |
M9553 | non-physical-temperature | error | SOLUTION '<solutionNumber>' specifies non-physical aqueous temperature '<tempC>' °C (valid range: [0, 350] °C). |
M9554 | negative-solute-concentration | error | Solute '<element>' in SOLUTION '<solutionNumber>' specifies negative concentration '<concentration>'. |
M9555 | charge-imbalance-exceeded | warning | SOLUTION '<solutionNumber>' exhibits relative electrical charge imbalance '<value>%' (> 5%) without a 'charge' balance element. |
M9556 | unknown-aqueous-master-species | error | SOLUTION '<solutionNumber>' references unrecognized aqueous master species '<element>'. |
M9557 | unknown-equilibrium-mineral-phase | error | EQUILIBRIUM_PHASES '<blockNumber>' references unrecognized mineral phase '<mineralName>'. |
M9558 | negative-mineral-moles | error | Equilibrium mineral phase '<mineralName>' specifies negative initial moles '<initialMoles>'. |
M9559 | unresolved-mix-solution | error | MIX '<mixNumber>' references undefined SOLUTION '<solutionNumber>'. |
M9560 | empty-phreeqc-deck | error | PHREEQC deck contains no SOLUTION, EQUILIBRIUM_PHASES, REACTION, KINETICS, MIX, or database definitions. |
Generated from languages/phreeqc/src/errors.ts. All languages →
CLI Usage
bash
# Validate electrical charge balance, pH/pe bounds, and phase blocks
msx lint GeothermalBrine.pqi
# Parse and inspect PHREEQC keyword blocks
msx parse GeothermalBrine.pqi
