Python for Hydro-Geo-Chemical Modeling
log in to bookmark this presentaton
Abstract
Mine water drainage, landfill drainage, or abandoned industrial plants cause many environmental problems. To solve these problems complicated chemical processes in the subsurface have to be examined.
Numerical modeling has been established as viable method to describe and predict the hydro-geo-chemistry of complex systems. PHREEQC, a Public Domain program by the United States Geological Survey, is probably the worldwide most used software for this type of modeling. The reasons for its popularity are the numerous processes it can handle as well as the very flexible text-based input format.
Python is very powerful when it comes to string processing and hence can be used to programmatically generate input files for PHREEQC. After running PHREEQC with help of the module subprocess the modeling results can be easily read with Python. This simple technique opens up the possibility for a wide range of new applications.
Previously nearly impossible tasks become simple. Hydro-geo-chemists with only a little Python experience can quickly automatically assemble input files and run hundreds or thousands of calculations without any manual effort. Phase diagrams can easily be constructed using this technique. Multi-dimensional, reactive transport modeling is surprisingly simple using Python. Two programs, a flow-and-transport software and PHREEQC are sequentially run with Python. Constructing input files and reading output files combined with the appropriate conversions of data in Python can be used to create a new model without changing the original programs. Even though this involves some more programming and demands more Python expertise, it is much less laborious than coupling the models with compiled languages.
Publication-quality diagrams can be generated from the modeling results with matplotlib. Once automated, the workflow of changing input values, rerunning the calculations, and displaying the results is much faster than the traditional spreadsheet-base approach.