This is one of six different example models (all developed by Ted Eary of Enchemica) that illustrate how GoldSim can be used to carry out mixing and geochemical calculations. The models proceed from the simplest to the most complex. You can see an overview of all six models here.
The purpose of this example model is to provide an example of an approach for using an External element to link a GoldSim model to the geochemical model PHREEQC. The External element allows complex calculations not easily implemented directly in GoldSim by connecting to functions that have been developed in another software language and compiled as a dynamic link library (DLL). In this case, those external functions are written in C++ and are designed to facilitate the transfer of chemical concentrations from GoldSim to PHREEQC, where they can be modified by PHREEQC by the effects of specified chemical processes with the results of the PHREEQC calculations returned to GoldSim. This transfer of information occurs for each timestep of the GoldSim simulation.
The model considers two streams (one acidic and one alkaline) flowing into a Pond where they mix. The input flow rates of the two streams can vary with time. Chemical equilibrium is assumed to be instantaneously achieved at the point of mixing of the two streams. Unlike the example in which the geochemistry is represented using Lookup Tables, the chemical compositions of the two streams that mix can vary with time. Hence, this is the most powerful and flexible way to integrate GoldSim with PHREEQC.
Note, however, that to use this approach, it is important that the user have a good working knowledge of PHREEQC and GoldSim. It will also be very useful to have at least a basic understand of how to re-compile the C++ code into a DLL, because the C++ code will need to be slightly modified for to make it applicable to each model application. Before using this approach, it is strongly recommended that you consider the points discussed in this article.
Contact:
Experience Level:
Advanced
Download the Model File:
Comments
1 comment
Version Update (by Ted Eary):
Removed the modification of the ionic-charge balancing in phreeqcLinkFunctions.cpp, so that the use of pH for charge balancing defined in the phreeqc template file (phreeqc_input_template.txt) gets used as the default. That default is to use pH. No changes are needed to phreeqc_input_template.txt.
Added in the following comment to the phreeqcLinkFunctions.cpp to make it clear that selection of an ionic charge-balancing approach needs to be determined by the user; something that is not always obvious. Below is the chunk of code where changes were made.
Please sign in to leave a comment.