PhreeqcUsers Discussion Forum

Processes => Mixing => Topic started by: Snavea on March 24, 2015, 04:00:12 PM

Title: Problems simulating a reaction and after a mix step
Post by: Snavea on March 24, 2015, 04:00:12 PM
Hi,

I would like to do a reaction usings steps and with the result of each step do a mix.

I have written this script:

REACTION 1
CaCl2 1 # Reactant, followed by  stoichiometric coefficient
Br 0.001 # Tracer species
0.001 in 10 steps
use solution 2
Save solution 3
end
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
3 0.75 # adds fraction 0.75 of solution 3

Gut then I only obtain one result instead of ten.

Can someone help me?

Thanks
Title: Re: Problems simulating a reaction and after a mix step
Post by: dlparkhurst on March 24, 2015, 04:47:33 PM
Unfortunately, it is not possible to multiple MIX calculations with a single definition. Unlike REACTION, you must make each MIX explicitly.

I am not sure which solutions are supposed to be reacted and mixed, but here is an example of a couple of reaction and mix steps.


SOLUTION 1
SOLUTION 2
END
REACTION 1
CaCl2 1  # Reactant, followed by  stoichiometric coefficient
Br 0.001 # Tracer species
0.0001
END
USE solution 2
USE reaction 1
SAVE solution 3
END
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
3 0.75 # adds fraction 0.75 of solution 3
SAVE solution 2
END
USE solution 2
USE reaction 1
SAVE solution 3
END
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
3 0.75 # adds fraction 0.75 of solution 3
save solution 2
END
Title: Re: Problems simulating a reaction and after a mix step
Post by: Snavea on March 26, 2015, 02:50:20 PM
Thanks dlparkhurst,

Following your example I jhave tried to do that:
REACTION 1
CaCl2 1 # Reactant, followed by  stoichiometric coefficient
Br 0.001 # Tracer species
0.001
END
use solution 2
Save solution 3
END
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
3 0.75 # adds fraction 0.75 of solution 3
save solution 4
END

Use solution 3
Use reaction 1
Save solution 3
END
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
3 0.75 # adds fraction 0.75 of solution 3
save solution 5
END

Use solution 3
Use reaction 1
Save solution 3
END
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
3 0.75 # adds fraction 0.75 of solution 3
save solution 6
END


But the program gives me an error that solution 3 is not found.


Thanks a lot
Title: Re: Problems simulating a reaction and after a mix step
Post by: dlparkhurst on March 26, 2015, 03:41:15 PM
A solution is SAVEd only after a reaction calculation, and a reaction calculation requires a SOLUTION and another reactant.  So,

END
USE solution 2
SAVE solution 3
END

does not produce a reaction, and a solution is not saved.

Replace with
COPY solution 2 3
Title: Re: Problems simulating a reaction and after a mix step
Post by: Snavea on March 30, 2015, 10:18:47 AM
Thanks dlparkhurst.

Now I have another problem. I try to get the results in an output file but I only obtain the result of  one of te silulations. I know that the problem is something related with the position of END in -selected output command but I can't find the solution. Can you help me?

Thanks in advance,

Snavea

SOLUTION 1  A     
END
SOLUTION 2 B
END

REACTION 1
CaCl2 1 0.001# Reactant, followed by  stoichiometric coefficient
USE solution 2
END
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
2 0.75 # adds fraction 0.75 of solution 2

SELECTED_OUTPUT
-file results.dat
-selected_out true
-pH true
-solution true
-distance false
-step false
-time false
-state false
-simulation true
-totals Ca Mg Na B


REACTION 2
CaCl2 1 0.0015# Reactant, followed by  stoichiometric coefficient
USE solution 2
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
2 0.75 # adds fraction 0.75 of solution 2

REACTION 3
CaCl2 1 0.002# Reactant, followed by  stoichiometric coefficient
USE solution 2
MIX 1
1 0.25 # takes fraction 0.25 of solution 1
2 0.75 # adds fraction 0.75 of solution 2

SELECTED_OUTPUT
-file Ofrea_4.dat
-selected_out true
-pH true
-solution true
-distance false
-step false
-time false
-state false
-simulation true
-totals Ca Mg Na B
-calculate_values SAR B_ppm
END
Title: Re: Problems simulating a reaction and after a mix step
Post by: dlparkhurst on March 31, 2015, 04:12:38 AM
Put an END before REACTION 2 and before REACTION 3.

I am not sure you need two SELECTED_OUTPUT data blocks. If you keep only the first, you will get a line for each MIX calculation. I also do not think you need the "USE solution" (except the first one) if you are using MIX; the MIX takes precedence anyway.