Skip to content

Querying solutions

After each calculation you can read bulk properties, totals, speciation, and saturation indices on a Solution, with no SELECTED_OUTPUT block.

You can run these examples

Click Run (or Ctrl+Enter), or Run all to execute every editor in order. The first run loads Pyodide and can take a few seconds. Editors on this page share a session.

Create a solution first (see Adding solutions), then read properties from the object:

Editor (session: querying)Run
from phreeqpython import PhreeqPython

pp = PhreeqPython()
solution = pp.add_solution({
    'units': 'ppm',
    'pH': 8.22,
    'temp': 25.0,
    'Ca': 412.3,
    'Mg': 1291.8,
    'Na': 10768.0,
    'K': 399.1,
    'Cl': 19353.0,
    'Alkalinity': '141.682 as HCO3',
    'S(6)': 2712.0,
})

print('pH', round(solution.pH, 2))
print('SC', round(solution.sc, 2), 'uS/cm')
print('T', solution.temperature, 'C')
print('Cl mmol', solution.total_element('Cl'))
print('HCO3 mg', round(solution.total('HCO3', units='mg'), 2))
print('SI Calcite', round(solution.si('Calcite'), 2))
print('HCO3- mmol', round(solution.species['HCO3-'], 4))
OutputClear

Useful accessors (Solution):

See the API reference for Solution for every property.