USER_PUNCH/USER_GRAPH > SELECTED_OUTPUT
Selected Output for Reactions Only
(1/1)
sestes:
Hello All,
I am attempting to couple PHREEQC with PEST for the purposes of simultaneously optimizing log K and enthalpy values for various reactions using experimental isothermal titration calorimetry data. To do this, I need PHREEQC to calculate and print (selected output) the calculated cumulative heat for each step of a reaction. I can do this with USER_PUNCH and the new BASIC command DELTA_H_SPECIES("x"), see example code. However, for systems with exchange or surface complexation reactions, the selected output also prints the initial solution conditions and the initial exchange conditions, which makes it difficult to directly use the selected output from PHREEQC as the model input for PEST. Does anyone know how to omit these initial conditions from the selected output? I've put a working PHREEQC example and the selected output from that example in the code boxes below. Basically, I need to remove the first two rows of output (i.e., "i_soln" and "i_exch" rows). Thanks for your help!
PHREEQC Example:
--- Code: ---#Cation Exchange Example
EXCHANGE_SPECIES
X- = X-
log_k 0.0
Na+ + X- = NaX
log_k 0.0
-llnl_gamma 4.0
delta_h 0.0
K+ + X- = KX
log_k 1.0
-llnl_gamma 3.0
delta_h -1.24 # Jardine & Sparks, 1984
SOLUTION 1
temp 25
pH 7 charge
pe 4
redox pe
units mol/kgw
Cl 0.1
Na 0.1
-water 6.0E-04 # kg
EXCHANGE 1
NaX 0.00000764
KX 0
-equilibrate with solution 1
REACTION 1
KCl 1
H2O 555
40 micromoles in 16 steps
CALCULATE_VALUES
mol_NaX(i)
-start
10 PUT(MOL("NaX")*TOT("water") , (STEP_NO))
-end
SELECTED_OUTPUT
-file Na-K_Exchange w Dilution.sel
-reset false
-step true
-state true
-user_punch true
#-totals K Na Cl X
#-molalities Na+ NaCl K+ KCl KX NaX
USER_PUNCH
-start
-headings cumulative_heat
10 PUNCH ((((MOL("NaX")*TOT("water"))- 7.640e-06)* DELTA_H_SPECIES("NaX") * -1000)+(((MOL("KX")*TOT("water"))- 0)* DELTA_H_SPECIES("KX")))
-end
END
--- End code ---
Selected Output Example:
--- Code: --- state step cumulative_heat
i_soln -99 -7.4401e-103
i_exch -99 -7.4401e-103
react 1 -1.5854e-06
react 2 -2.8699e-06
react 3 -3.8903e-06
react 4 -4.6946e-06
react 5 -5.3299e-06
react 6 -5.8358e-06
react 7 -6.2433e-06
react 8 -6.5760e-06
react 9 -6.8511e-06
react 10 -7.0814e-06
react 11 -7.2764e-06
react 12 -7.4434e-06
react 13 -7.5877e-06
react 14 -7.7136e-06
react 15 -7.8241e-06
react 16 -7.9220e-06
--- End code ---
dlparkhurst:
I think the best way would be to add END statements after each data block. And then add the following to the end of the script.
--- Code: ---RUN_CELLS
-cell 1
--- End code ---
Adding ENDs eliminates all the default reaction calculations, which bring together a SOLUTION (or USE solution or MIX) and all other reactants defined from one END to the next END. With your current script, all keyword data blocks are defined within the same "simulation", because there is only one END. Thus SELECTED_OUTPUT and USER_PUNCH are defined at the point that the initial SOLUTION and initial EXCHANGE calculations are performed, and so, they are written to the selected output file. By adding ENDs, SELECTED_OUTPUT and USER_PUNCH are not defined until after the initial solution and initial exchange calculations have already been performed.
RUN_CELLS; -cell 1 will bring together all the reaction entities defined with user number 1--SOLUTION 1, EXCHANGE 1, and REACTION 1--and perform the reaction calculation. In your case, RUN_CELLS is equivalent to
--- Code: ---USE solution 1
USE exchange 1
USE reaction 1
SAVE solution 1
SAVE exchange 1
--- End code ---
Once you split up calculations with ENDs, you can also turn SELECTED_OUTPUT/USER_PUNCH off/on with
--- Code: ---SELECTED_OUTPUT 1
-active false/true
--- End code ---
sestes:
Thank you, thank you, Dr. Parkhurst! I really appreciate your rapid responses in this forum. I'm still a PHREEQC newbie, but I'm very quickly becoming appreciative of the power and versatility of this software.
Your simple solution exactly did the trick. Onwards to optimizing enthalpy values! Woo!
Navigation
[0] Message Index
Go to full version