# Re: PHREEQC question

```
The algorithm for choosing the stable set of phases is not exactly the
sequential process you describe. Hopefully, it should be at most a two step
process, regardless of the number of linearly dependent mineral
compositions in EQUILIBRIUM_PHASES.  When PHREEQC is iterating to find the
solution to the algebraic set of equations (Newton-Raphson), it is using a
variant of the simplex algorithm that allows not only equalities, but sets
of inequalities and linear objective functions. In a nutshell, the
algorithm tries to drive SI's  of all minerals  in EQUILIBRIUM_PHASES to
zero (objective functions try to make SI=0) or less than zero (inequality
constraints require SI <=  0). If, at the end of the Newton-Raphson, all
minerals have SI = 0 or have SI < 0 and zero moles, then the problem is
solved. SI < 0 and moles > 0 should not occur, because the SI can be made
smaller by dissolving more of the mineral. However, for example, if you
include both calcite and aragonite with positive moles in
EQUILIBRIUM_PHASES, it is possible that at the end of the Newton Raphson
iterations, calcite SI = 0 and aragonite SI < 0, but both still have
positive moles in the system. In this case, PHREEQC will add all of the
aragonite to solution (setting moles of aragonite to zero) and solve the
system again. The second time through, it should put all of the CaCO3 into
calcite, so that SI calcite = 0, SI aragonite < 0, moles calcite > 0, but
this time, moles aragonite = 0. If there are multiple minerals with SI < 0
and moles > 0, then all of them are dissolved simultaneously.  I don't know
of any guarantee that it won't make some aragonite in an intermediate
calculation during the second step and then just keep repeating step 2 of
the process, but I've never had any problem so far.

David

David Parkhurst (dlpark@xxxxxxxx)
U.S. Geological Survey
Box 25046, MS 413
Denver Federal Center
Denver, CO 80225

Annett Sullivan
<4as@xxxxxxxx>           To:      dlpark@xxxxxxxx
cc:
01/02/02 01:35           Subject: PHREEQC question
PM

Hi Dr. Parkhurst-

I have a question about the way in which PHREEQC decides mineral
FAQ, and haven't seen the answer, so I thought I'd send you an email.

In some of our runs we have different minerals with similar composition
(for instance, iron oxyhydroxides, or calcite/aragonite) that are all
supersaturated, and that we allow to precipitate in EQUILIBRIUM PHASES.

How does PHREEQC decide which mineral to precipitate first?  From working
with it, I think that it chooses the mineral that is *most* supersaturated
first, and brings about precipitation to take that saturation index to 0.
Then in subsequent steps it considers whether the other
(similar-composition minerals) are still supersaturated, and if so, again
chooses to precipitate the mineral with the highest SI.  And on down the
line...  Does this explanation sound right to you?

Thanks very much, we like PHREEQC a lot!

Annett :)

---------------------------------------
Annett B. Sullivan
Environmental Sciences Division
Oak Ridge National Laboratory
P.O. Box 2008, MS-6036
Oak Ridge, TN 37831
phone: 865-574-6367  fax: 865-576-8543
---------------------------------------

```

Complete Water Resources Division Software