PhreeqcUsers Discussion Forum

Beginners => PHREEQC basics => Topic started by: Charlie on February 05, 2020, 02:56:56 PM

Title: Skipping non converging solutions in Solution spread
Post by: Charlie on February 05, 2020, 02:56:56 PM
We have a list of 10,000 solutions (combinations of Alkalinity as HCO3, Si, Ca, Mg, with Cl charge  (iterating through mmol concs of 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100)). However, some of these wont converge and PHREEQC stops. We suspect that this is due to the calculations for alkalinity from the Ca and Mg concentrations, however it isn't exactly clear. If we could understand the issue we could filter out the particular solutions before running in PHREEQC).  Here are two combinations from the spread which we have pulled out to look at in detail. Input also attached.

Alternatively - is there a means to bypass solutions defined in a solution spread block, that are non converging? that way we can at lease proceed. Thanks
 
#EXAMPLES FROM SOLUTION SPREAD LIST

SOLUTION 1 # CONVERGES

units mmol/kgw
Alkalinity 0.1 as HCO3
Ca 100
Si 20
Mg 100
Cl 10 charge


END



SOLUTION 3 # DOESNT CONVERGE

units mmol/kgw
Alkalinity 0.1 as HCO3
Ca 100
Si 50
Mg 0.2
Cl 10 charge

END
Title: Re: Skipping non converging solutions in Solution spread
Post by: dlparkhurst on February 05, 2020, 03:51:40 PM
PHREEQC is trying to adjust the carbon concentration to attain the specified alkalinity. In your system, H3SiO4- and OH- contribute to the alkalinity. In the cases that do not converge, the alkalinity contribution from these two species is greater than the Alkalinity specified in SOLUTION. So, PHREEQC drives the carbon concentration to zero, but still can't match the specified alkalinity.

You have a few options:

(1) You could eliminate the species H3SiO4-. At pH 7, it is a small fraction of the total Si.
Code: [Select]
SOLUTION_SPECIES
H4SiO4 = H3SiO4- + H+
# -log_k -9.83
-log_k -20

(2) The problem occurs at the smallest alkalinity and largest Si, so you could try to figure out how to avoid the offending combinations.

(3) You could use IPhreeqc  with C, Fortran, or C++; IPhreeqcCOM with Excel (Visual Basic) or Matlab; or the R version of PHREEQC to script the calculations. You would have to generate each solution as a string and use RunString to do the calculation. You would check the return code to determine whether the calculation was successful or not.