PhreeqcUsers Discussion Forum

Processes => Mixing => Topic started by: Flopi on November 25, 2016, 09:15:39 PM

Title: Incremental mixing
Post by: Flopi on November 25, 2016, 09:15:39 PM
I'm quite new to Phreeqc so the answer might be obvious...

I am studying the effect of mixing of two solution on the different equilibriums. Currently my solution is to copy paste the block :
     1     0.2
     2     0.8
    barite    0.8    10
    pyrite       0    10

The only problem is that when I want to change the equilibrium saturation of barite, or if I want to add another mineral, I have to do it to all the blocks (and I have quite a lot).
Is there a way to create a loop, or to store the saturation indexes in a variable a do something like that ?

for i = 1 to 20
      1   0.05 * i
      2   1-0.05 * i
barite x y
pyrite a b

Thank you for your suggestions,

Title: Re: Incremental mixing
Post by: dlparkhurst on November 26, 2016, 01:30:51 AM
No, there is no looping capability for mix.

You have a few choices:

(1) You can generate the input file in Excel or a scripting language, and then run it.

(2) You can program the input in USER_PUNCH and then use INSERT$ to run the generated file. See example 8 (or 21).


(3) You can use IPhreeqc in a scripting or programming language. IPhreeqcCOM will work with Visual Basic in Excel, Matlab, or Python. IPhreeqc can be compiled into C, C++, or Fortran.
Title: Re: Incremental mixing
Post by: Flopi on November 28, 2016, 08:06:28 PM
Thank you for the quick answer. I used Python to generate the input file. Works perfectly. I join the .py file if anybody is interested.