USER_PUNCH/USER_GRAPH > BASIC functions

High Ammonia and Sulphate

(1/3) > >>

magan.govender:
Good day, i am new to the forum and seek advise in modelling the sample chem below. any assistance would be greatly appreciated. I would like to remove the ammonia first then precipitate the sulphate

Solution 1
pH    13.02
pe    10
temp    20
redox pe
-units mg/L
Na     738.8
Ca       515.8
Mg       9.2
Cl      0.0
S(6)      28500.0
Si      1.0
#Alkalinity  8099.0 as HCO3
Amm  9025.88
Ba     0.22
B      19.2
Mn     2624.0
Sr        1.44

MichaelZ20:
You may want to remove ammonia by struvite precipitation. Add MgCl2 and NaH2PO4 by using REACTION.
Alternative method - air stripping.

dlparkhurst:
Michael's approach to precipitating Struvite is easier to model because you can add the REACTION in multiple increments.

With gas stripping, I have set up the calculation to sequentially equilibrate the solution with 100 liters of air. The total volume of air required to remove the ammonia is fairly large, ~1e5 liters.  I have used SELECTED_OUTPUT and USER_PUNCH to write a file to simulate 100 gas/water equilibrations. It's a little messy, so you could simply cut and paste the following 100 times:

--- Code: ---USE solution 1
USE gas_phase 1
SAVE solution 1
END

--- End code ---

Here is the script that does the gas stripping followed by precipitation of barite incrementally.

--- Code: ---Solution 1
pH    13.02
pe    10 O2(g) -5
temp    20
redox pe
-units mg/L
Na     738.8
Ca       515.8
Mg       9.2
Cl      0.0
S(6)      28500.0
Si      1.0
#Alkalinity  8099.0 as HCO3
Amm  9025.88
Ba     0.22
B      19.2
Mn     2624.0
Sr        1.44
SELECTED_OUTPUT 2
-file sparge.pqi
USER_PUNCH 2
10 FOR i = 1 to 100
20   s\$ = s\$ + "USE solution 1" + EOL\$
30   s\$ = s\$ + "USE gas_phase 1" + EOL\$
40   s\$ = s\$ + "SAVE solution 1" + EOL\$
50   s\$ = s\$ + "END" + EOL\$
60 NEXT I
70 PUNCH s\$
END
SELECTED_OUTPUT 2
-active false
GAS_PHASE 1
-fixed_pressure
-volume 100
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.2
CO2(g)  0.0004
SAVE solution 2
END
USER_PRINT
10 PUT(GET(0)+100, 0)
USER_GRAPH 1
-axis_titles            "Volume of air, in liters" "Amm concentration, in molality" ""
10 liters = GET(0)
30 GRAPH_X liters
40 GRAPH_Y TOT("Amm")
50 END
END
INCLUDE\$ sparge.pqi
END
USER_GRAPH 1
-active                 false
USER_PRINT
10 REM
END
USE solution 1
REACTION
BaCl2 1
0.5 in 10 steps
EQUILIBRIUM_PHASES
Barite 0 0
USER_GRAPH 2
-axis_titles            "BaCl2 added, moles" "Total sulfate, in molality" ""
-initial_solutions      false
-connect_simulations    true
-plot_concentration_vs  x
-start
10 GRAPH_X RXN
20 GRAPH_Y TOT("S(6)")
-end
END

--- End code ---

MichaelZ20:
Hi David!
I tried to use the 1-st method. From an unknown reason I have got much higher remainder of ammonia.
Where am I wrong?
--- Code: ---SOLUTION 0
-units mg/L
temp    20
pH    13.02
pe    10 O2(g) -5
redox pe
Na     738.8
Ca       515.8
Mg       9.2
Cl      0.0
S(6)      28500.0
Si      1.0
#Alkalinity  8099.0 as HCO3
Amm  9025.88
Ba     0.22
B      19.2
Mn     2624.0
Sr        1.44
END

USER_GRAPH 1
-axis_titles            "Volume of air, L" "Amm concentration, mol/kgw" ""
-start
10 GRAPH_X GAS_VM * (GAS("Amm(g)") + GAS("Ntg(g)") + GAS("Oxg(g)") + GAS("CO2(g)") + GAS("H2O(g)"))
20 GRAPH_Y TOT("Amm")
-end

USE solution 0
GAS_PHASE 1
-fixed_pressure
#-pressure 1  # default
-volume 500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 2
-fixed_pressure
-volume 1000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 3
-fixed_pressure
-volume 1500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
SAVE SOLUTION 3
END

USE solution 0
GAS_PHASE 4
-fixed_pressure
-volume 2000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 5
-fixed_pressure
-volume 2500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 6
-fixed_pressure
-volume 3000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 7
-fixed_pressure
-volume 3500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 8
-fixed_pressure
-volume 4000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 9
-fixed_pressure
-volume 4500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 10
-fixed_pressure
-volume 5000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 11
-fixed_pressure
-volume 5500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 12
-fixed_pressure
-volume 6000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 13
-fixed_pressure
-volume 6500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 14
-fixed_pressure
-volume 7000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 15
-fixed_pressure
-volume 7500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 16
-fixed_pressure
-volume 8000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 17
-fixed_pressure
-volume 8500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 18
-fixed_pressure
-volume 9000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 19
-fixed_pressure
-volume 9500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 20
-fixed_pressure
-volume 10000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 21
-fixed_pressure
-volume 10500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 22
-fixed_pressure
-volume 11000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 23
-fixed_pressure
-volume 11500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 24
-fixed_pressure
-volume 12000
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END

USE solution 0
GAS_PHASE 25
-fixed_pressure
-volume 12500
Amm(g) 0
Ntg(g)  0.78
Oxg(g)  0.22
CO2(g)  0.0004
END
--- End code ---

dlparkhurst:
You need to SAVE solution 0 after each step.