Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 3.54 KB

README.md

File metadata and controls

67 lines (51 loc) · 3.54 KB

Phreeqpython Logo

PhreeqPython is an object oriented wrapper around the (VIPhreeqc) extension of the Phreeqc chemical calculation engine (Parkhurst&Appello), written in Python.

Features

PhreeqPython greatly simplifies adding solutions and querying their properties:

pp = PhreeqPython()
# add a solution consisting of 1 mmol CaCl2 and 2 mmol NaHCO3
solution = pp.add_solution_simple({'CaCl2':1.0,'NaHCO3':2.0})
print(solution.pH)               # 8.12
print(solution.sc)               # 427.32
print(solution.si('Calcite'))    # 0.38
print(solution.species['HCO3-']) # 0.0019
print(solution.elements['Cl'])   # 0.002 mol

Allows for simple chemical and precipitation/dissolution reactions:

solution.add('NaOH',0.5)
print(solution.pH)              # 9.47
solution.desaturate('Calcite')  # desaturate to SI 0
print(solution.total('Ca'))     # 0.497 mmol

And even allows for addition, devision and multiplication of solutions to form new mixtures:

solution2 = pp.add_solution_simple({'KCl':1.0})
# create mixture of 50% solution and 50% solution2
solution3 = solution * 0.5 + solution2 * 0.5
print(solution3.total('K','mol'))     # 0.0005 mol

For more examples, take a look at the examples folder.

Installation

  • pip install -U phreeqpython

Requirements

Unit Tests

Mac/Linux Windows Coverage
Build Status Build status codecov

Acknowledgements

This project makes use of the (Phreeqc) (David Parkhurst & Tony Apello) calcution engine and is (partly) derived from the (PhreeqPy) extension for IPhreeqc (Mike Müller)

About Vitens

Vitens is the largest drinking water company in The Netherlands. We deliver top quality drinking water to 5.6 million people and companies in the provinces Flevoland, Fryslân, Gelderland, Utrecht and Overijssel and some municipalities in Drenthe and Noord-Holland. Annually we deliver 350 million m³ water with 1,400 employees, 100 water treatment works and 49,000 kilometres of water mains.

One of our main focus points is using advanced water quality, quantity and hydraulics models to further improve and optimize our treatment and distribution processes.

Licence

Copyright 2021 Vitens

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.