Programming PHREEQC calculations with C++ and Python a comparative study

By: , and 



The new IPhreeqc module provides an application programming interface (API) to facilitate coupling of other codes with the U.S. Geological Survey geochemical model PHREEQC. Traditionally, loose coupling of PHREEQC with other applications required methods to create PHREEQC input files, start external PHREEQC processes, and process PHREEQC output files. IPhreeqc eliminates most of this effort by providing direct access to PHREEQC capabilities through a component object model (COM), a library, or a dynamically linked library (DLL). Input and calculations can be specified through internally programmed strings, and all data exchange between an application and the module can occur in computer memory.

This study compares simulations programmed in C++ and Python that are tightly coupled with IPhreeqc modules to the traditional simulations that are loosely coupled to PHREEQC. The study compares performance, quantifies effort, and evaluates lines of code and the complexity of the design. The comparisons show that IPhreeqc offers a more powerful and simpler approach for incorporating PHREEQC calculations into transport models and other applications that need to perform PHREEQC calculations. The IPhreeqc module facilitates the design of coupled applications and significantly reduces run times. Even a moderate knowledge of one of the supported programming languages allows more efficient use of PHREEQC than the traditional loosely coupled approach.

Additional publication details

Publication type Conference Paper
Publication Subtype Conference Paper
Title Programming PHREEQC calculations with C++ and Python a comparative study
Year Published 2011
Language English
Contributing office(s) National Research Program - Central Branch, Toxic Substances Hydrology Program
Description 5 p.
Larger Work Type Book
Larger Work Subtype Conference publication
Larger Work Title Proceedings for MODFLOW and More 2011: Integrated Hydrologic Modeling
First page 632
Last page 636
Conference Title MODFLOW and More 2011: Integrated Hydrologic Modeling
Conference Location Golden, Colorado
Conference Date June 5-8, 2011