Processes > Inverse modelling
How to add Fertilizer formular in the Phreeqc.dat Database for Inverse modelling
dlparkhurst:
I'm not sure what you are trying to do, but I will explain a bit how exchange works.
The following definition determines the exchange composition that is in equilibrium with SOLUTION 1. Solution 1 does not change, only the exchange composition is calculated.
--- Code: ---EXCHANGE 1
equilibrate 1
X 0.015
--- End code ---
When you use EXCHANGE 1 in a reaction as follows:
--- Code: ---USE Solution 3
EXCHANGE 1 ## ----- Ion exchange reaction
equilibrate 1
X 0.015 ## Exchange capacity estimated (currently, there is no value from literature)
SAVE Solution 4
END
--- End code ---
then new equilibrium solution and exchange compositions are calculated and printed to the output file. The new solution composition is saved as solution 4. However, the new exchange composition is not saved. So, EXCHANGE 1 remains the same composition that is in equilibrium with solution 1. Depending on your conceptual model, you could include SAVE exchange 4 and the exchange calculated exchange composition would be saved as EXCHANGE 4, and it would be in equilibrium with solution 4.
When you define the following:
--- Code: ---USE Solution 5
EXCHANGE 2
equilibrate 2
X 0.015 #working 0.015
SAVE Solution 6
END
--- End code ---
you define exchange 2 to be in equilibrium with solution 2 and then react it with solution 5. So, during the reaction, both the solution and the exchanger react to equilibrium. You save the solution, but not the exchanger, so EXCHANGE 2 is still in equilibrium with solution 2.
You seem to have used only one reactant (EXCHANGE, REACTION, or EQUILIBRIUM_PHASES) in each reaction definition. It is possible to use multiple reactants. For instance, a reaction with REACTION with saved solution followed by reacting the solution with EQUILIBRIUM_PHASES would produce the same solution composition as reacting with REACTION and EQUILIBRIUM_PHASES in one reaction (before the same END).
evansmanu:
Dear David,
Thanks very much for your reply. Your write-up has provided me with much information on ion exchange. In my previous post, I just wanted to implement an exchange where my saved solution is brought into equilibrium with the exchanger and the final solution saved for the subsequent reaction. I do not intend to react with the exchanger again with the preceding solution, which has been saved.
for instance (refer to the script below), after the first Equilibrium Phase 1, I saved the solution under Solution 1. Then used the keyword USE Solution as the new input solution to react with the organic, and the final solution was saved as Solution 2
Solution 2 was then used as the input solution for the Equilibrium Phase 2, and the final reaction was saved as Solution 3.
Then I wanted to equilibrate Solution 3 with the exchanger. which I wrote like this;
USE Solution 3 ## is it correct to have this line if I just want to equilibrate the solution with the exchanger without reacting with the solution again?
EXCHANGE 1 ## ----- Ion exchange reaction
equilibrate 3 # equilibrate solution 3 with the exchanger
X 0.00009 ## Exchange capacity estimated
SAVE Solution 4
END
This is how I implemented the exchanger. But reading your writeup, I may be wrong if I use the keyword USE Solution 3 then followed by the equilibrate 3. It means that Solution 3 will then react again with the final equilibrated Solution 3 with the exchanger.
Below is the updated script considering the exchanger after each reaction
TITLE Simulation of groundwater chemical evolution along the flow path considering mineral reactions (evaporated rainwater as the initial solution)
SOLUTION 0 Precipitation from the literature (evaporation until groundwater Cl concentration is matched)
temp 25
pH 3.749
pe 4
redox O(0)/O(-2)
redox pe
units mol/kgw
density 1
O(0) 0.01 O2(g) -0.7
C(4) 1.147e-03 as HCO3 #CO2(g) -3.5
Ca 1.504e-03 charge
Cl 1.321e-03
K 1.559e-04
Mg 1.081e-04
Na 1.692e-04
S(6) 1.216e-03
EQUILIBRIUM_PHASES 1 ##----------- equilibrated with the potential phases in the unsaturated zone (Saprolite)
Kaolinite 0.0
Hematite 0.0
SAVE Solution 1
END
SELECTED_OUTPUT
-file organic_matter.dat
-reaction true
-totals C(4) S(6) Fe
-molalities SO4-2 Ca+2 Na+ Cl- Mg+2 K+
USE Solution 1
REACTION 1 ## --------- decomposition of organic matter
Organic_matter 1
2.680e-03 moles ##0.004 moles in 100 steps #2.800e-03 moles (1.56E-05) ## --------- manual input through try and error
SAVE Solution 2
END
USE Solution 2 ## --------- Equilibration with mineral phases identified from the combinatorial inverse model in the Northern Zone.
EQUILIBRIUM PHASES 2
CO2(g) -1.7 ## -------- considered for soil zone CO2
Albite 0 #8.017e-02
# Anorthite 0 0
# Phlogopite 0 1.669e-02
# Pyrite 0 #2.166e-04
# K-feldspar 0
# K-mica 0 0
# Kaolinite 0 0
Fe(OH)3(a) 0
Chalcedony 0
# Calcite 0 0
pe_Fix -4.9 O2(g) 0.5 ## ---- for redox optimization derived from the combinatorial inverse calculation
SAVE Solution 3
SAVE Solution 3
END
USE Solution 3
EXCHANGE 1 ## ----- Ion exchange reaction
equilibrate 3
X 0.00009 ## Exchange capacity estimated (currently, there are no value from literature)
SAVE Solution 4
END
TITLE Simulation of evolution from Northern zone through Central zone ---------------------------------------------------------
USE Solution 4
EQUILIBRIUM_PHASES 3 ## Potential phase assemblages from the Combinatorial inverse calculation in the Central zone
CO2(g) -1.75 ## considered for soil zone CO2 (estimated)
Chalcedony 0 #2.806e-04
# Anorthite 0 0
# Pyrite 0 #1.38e-08
K-mica 0 2.044e-04
# K-feldspar 0 0
# Fe(OH)3(a) 0 0
Goethite 0 0
Kaolinite 0 0
pe_Fix -1.900623 O2(g) 0.5
SAVE Solution 5
END
USE Solution 5
EXCHANGE 2
equilibrate 5
X 0.015 #working 0.015
SAVE Solution 6
END
TITLE Simulation of evolution from Central zone to Southern zone -- here we equilibrate with the aquifer mineralogy --------------------
USE Solution 6
EQUILIBRIUM_PHASES 3 ##----- Mineral assemblages from the combinatorial inverse model in the Southern zone
# CO2(g) -1.7
Calcite 0
# Pyrite 0
# K-feldspar 0
K-mica 0
Phlogopite 0 10
Chalcedony 0 2.82e6-04
Fe(OH)3(a) 0
# pe_Fix -1.7 O2(g) 0.5 #-4.35
SAVE Solution 7
END
USE Solution 7
EXCHANGE 3
equilibrate 7
X 0.00009 #0.015
SAVE Solution 8
END
dlparkhurst:
I'll only add one comment.
--- Code: ---USE Solution 3
EXCHANGE 1 ## ----- Ion exchange reaction
equilibrate 3 # equilibrate solution 3 with the exchanger
X 0.00009 ## Exchange capacity estimated
SAVE Solution 4
END
--- End code ---
This snippet causes two calculations to be made. (1) The composition of the given amount of exchanger in equilibrium with solution 3 is calculated (initial exchange calculation). (2) The exchanger is then brought together with solution 3 and reacted to equilibrium. However, because the exchanger is in equilibrium with solution 3 by the initial exchange calculation, the reaction calculation changes neither the solution nor the exchange composition. So, solution 3 and solution 4 are equivalent.
You will need to look closely at the output to see if the calculations are doing what you expect.
evansmanu:
Dear David,
Thanks again,
From your suggestion so far, I want to have the composition of the exchanger equilibrated with Solution 3 without bringing it further into reaction with the same solution. In that regard, my code should rather be like this by removing USE Solution 3. Then Solution 4 will be the composition ofter equilibrating Solution 3 with the exchanger
I then use the Solution 4 as the input for the next reaction
However, including USE Solution 3 gives me what am looking for. The modelled concentrations match well with the observed. I was not sure if it was a good coding practice to implement the ion exchange
#USE Solution 3
EXCHANGE 1 ## ----- Ion exchange reaction
equilibrate 3 # equilibrate solution 3 with the exchanger
X 0.00009 ## Exchange capacity estimated
SAVE Solution 4
END
dlparkhurst:
If this is your code, then there is only one calculation--finding the composition of the exchanger in equilibrium with solution 3. There is no reaction calculation, and without a reaction calculation, there is no solution to save; "SAVE solution 4" does not save a solution, so solution 4 will not exist in subsequent simulations (assuming it did not exist before this simulation).
--- Code: ---[b]END[/b]
#USE Solution 3
EXCHANGE 1 ## ----- Ion exchange reaction
equilibrate 3 # equilibrate solution 3 with the exchanger
X 0.00009 ## Exchange capacity estimated
SAVE Solution 4
END
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version