Representing Geochemistry By Linking GoldSim Dynamically to PHREEQC



1 comment

  • Avatar

    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.

    insert1.getline(speciesName, sizeof(speciesName), '\t');

    // Note: You will need to make a choice about how to force ionic charge balance with PHREEQC.
    // The default is to make sure that all input solutions are already charge-balanced so that
    // PHREEQC can calculate the pH from the charge balance and any reactions. Please see the template file
    // under the SOLUTION keyword as an example.  However, if needed,
    // you can insert " charge" in a line like the following to allow PHREEQC to adjust the
    // charge balance by modifying the S(6) concentration.  An example would be:

    //       outfile << speciesName << '\t' << inputs[i] << '\t' << " charge" << '\n';

    // Alternatively, you could select a different major cation or anion for charge-balancing.
    // The following line is provided as an example with the specification of an ion for charge-balancing
    // left blank because pH is used for charge-balancing in the example model.

    if (strncmp(speciesName, "S(6)", 4) == 0)
            outfile << speciesName << '\t' << inputs[i] << '\t' << " " << '\n';

    else if (strncmp(speciesName, "C(4)", 4) == 0)
            outfile << speciesName << '\t' << inputs[i] << '\t' << " as HCO3 " << '\n';

    else if (strncmp(speciesName, "Si", 2) == 0)
            outfile << speciesName << '\t' << inputs[i] << '\t' << " as Si " << '\n';

            outfile << speciesName << '\t' << inputs[i] << '\n';
    Comment actions Permalink

Please sign in to leave a comment.