A PHREEQC GEOCHEMISTRY MODULE FOR WATERSHED, SURFACE-WATER, AND GROUNDWATER MODELS
A transport model interacts with a PHREEQC module through a limited set of methods, which constitute an API (applications programming interface). The methods allow PHREEQC input to be submitted to the module and specified results to be returned from the module. The format of the input is exactly the same format as PHREEQC, and can be defined either through strings or files. Any calculation within the capabilities of PHREEQC can be run by the module. The results returned from the module are in a table of user-selected model quantities—for example, concentrations, saturation indices, or moles of reactants remaining. Additional methods control module output and error handling.
PHREEQC modules are used to simulate geochemical reactions in WEBMOD (Water, Energy, and Biogeochemical Model), a watershed model based on TOPMODEL that was developed by Richard Webb, and in an unsaturated-zone reactive-transport model published by Laurin Wissmeier. Transport models in Fortran, C, or C++ can implement PHREEQC modules by linking to a PHREEQC library. A COM (Component Object Model) version of the module also is available, which can be invoked from Excel, Python, or MATLAB. Multiple PHREEQC modules can be defined by a program, and it is possible to implement parallel processing by using a PHREEQC module in each of multiple processes and passing messages among the processes.