Beginners > BASIC functions

fix pH, equi_delta with user_graph

(1/1)

Ardenis:
Hello,

I would like to show the number of moles of HNO3 consumed to reach the fixed pH at each pH on my graph. However when I used the equi_delta function in the USER_GRAPH block, it doesn't work (0 moles are consumed on the graph but more in the output file). Do you have any idea to solve this problem? (script below). Thank you in advance for your answer!

Title sorption of F on VA


SURFACE_MASTER_SPECIES
Edg_al Edg_alOH # aluminol and Fe edge sites

SURFACE_SPECIES

Edg_alOH = Edg_alOH
log_k 0.0

Edg_alOH + H+ = Edg_alOH2+
#log_k 7.23 # Dzomback, 1990 et 2010,
log_k 8.01214 # manuel

Edg_alOH = Edg_alO- + H+
#log_k -10.05 # Dzomback, 1990 et 2010,
log_k -7.7901 # manuel

Edg_alOH + F- + H+ = Edg_alF + H2O
#log_k 8.78 # dzomback 2010
log_k 12.0369 # manuel

Edg_alOH + F- = Edg_alOHF-
#log_k 2.88 # dzombak 2010
log_k 4.01716 # manuel


SURFACE 1 edge sites on VA soil

#Edg_alOH 0.000943719 26.59 38.32
#Edg_alOH  0.001954272 26.59 38.32
#Edg_alOH 0.003908545 26.59 38.32
#Edg_alOH  0.026155319 50.06 36.08
#Edg_alOH  0.0035692345 50.06 36.08
Edg_alOH  0.001016265 50.06 36.08

PHASES

fix_pH
H+ = H+
log_k 0
fix_pe
e- = e-
log_k 0


END

SOLUTION 1

    temp      20
    pH        2.8
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         378.5
    F         23.54
    Al        38.18
       

SAVE SOLUTION 1
END

SOLUTION 2

 temp      20
    pH        3.5
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         382.03
    F         24.36
    Al        18.89
   

SAVE SOLUTION 2
END

SOLUTION 3

 temp      20
    pH        4
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         384.68
    F         24.53
    Al        11.23

SAVE SOLUTION 3
END

SOLUTION 4

 temp      20
    pH        5
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         385.53
    F         24.58
    Al        5.33
   

SAVE SOLUTION 4
END

SOLUTION 5

    temp      20
    pH        6
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         379.49
    F         24.07
    Al        1.15

SAVE SOLUTION 5
END

SOLUTION 6

 temp      20
    pH        7
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         386.3
    F         24.63
    Al        0.23

SAVE SOLUTION 6
END

SOLUTION 7

 temp      20
    pH        8
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         361.88
    F         23.08
    Al        0.13

SAVE SOLUTION 7
END



SELECTED_OUTPUT; -file C:\Users\ardenis\Documents\Doctorat\codes\Test BA PEST avec 4K\BA.prn; -reset false; -high_p true
USER_PUNCH
-start
10 q_sorb = mol("Edg_alF") + mol("Edg_alOHF-")
20 punch q_sorb #*100/1.317e-3
-end




USER_GRAPH 1
-headings sw F_ads SF SOHF- F AlF+2 ALF2+ ALF3 F- Al+3 HNO3
-axis_titles "pH" "F adsorbed (mol/L)" "HNO3 consumed (mol/L)"
-chart_title "Fluoride adsorption enveloppe of VA"
-plot_concentration_vs x

-start
10 graph_x -LA("H+")
20 graph_y SURF("F", "Edg"),MOL("Edg_alF"), MOL("Edg_alOHF-"), TOT("F"), MOL("AlF+2"), MOL("AlF2+")*2, MOL("ALF3"), MOL("F-"), MOL("Al+3")
30 graph_sy equi_delta("HNO3")

end

use solution 1; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -2.8 HNO3 100; end
use solution 2; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -3.5 HNO3 100; end
use solution 3; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -4.0 HNO3 100; end
use solution 4; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -5.0 HNO3 100; end
use solution 5; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -6.0 HNO3 100; end
use solution 6; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -7.0 HNO3 100; end
use solution 7; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -8.0 HNO3 100; end

END

dlparkhurst:
Please simplify to two solutions and pH to make it easier for me.

And use the # button at the top of the text input box for code input.

Ardenis:
Here is a simplified version of the script with only 2 solutions. Thank you in advance for your answer !


--- Code: ---
Title sorption of F on VA


SURFACE_MASTER_SPECIES
Edg_al Edg_alOH # aluminol and Fe edge sites

SURFACE_SPECIES

Edg_alOH = Edg_alOH
log_k 0.0

Edg_alOH + H+ = Edg_alOH2+
log_k 8.01214 # manuel

Edg_alOH = Edg_alO- + H+
log_k -7.7901 # manuel

Edg_alOH + F- + H+ = Edg_alF + H2O
log_k 12.0369 # manuel

Edg_alOH + F- = Edg_alOHF-
log_k 4.01716 # manuel


SURFACE 1 edge sites on VA soil

Edg_alOH  0.001016265 50.06 36.08

PHASES

fix_pH
H+ = H+
log_k 0
fix_pe
e- = e-
log_k 0


END

SOLUTION 1

    temp      20
    pH        2.8
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         378.5
    F         23.54
    Al        38.18
       

SAVE SOLUTION 1
END

SOLUTION 2

 temp      20
    pH        3.5
    pe        4
    redox     pe
    units     mg/l
    density   1
    N(5)      135.577 charge
    K         382.03
    F         24.36
    Al        18.89
   

SAVE SOLUTION 2
END


USER_GRAPH 1
-headings sw F_ads SF SOHF- F AlF+2 ALF2+ ALF3 F- Al+3 HNO3
-axis_titles "pH" "F adsorbed (mol/L)" "HNO3 consumed (mol/L)"
-chart_title "Fluoride adsorption enveloppe of VA"
-plot_concentration_vs x

-start
10 graph_x -LA("H+")
20 graph_y SURF("F", "Edg"),MOL("Edg_alF"), MOL("Edg_alOHF-"), TOT("F"), MOL("AlF+2"), MOL("AlF2+")*2, MOL("ALF3"), MOL("F-"), MOL("Al+3")
30 graph_sy equi_delta("HNO3")

end

use solution 1; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -2.8 HNO3 100; end
use solution 2; use surface 1; EQUILIBRIUM_PHASES 1; fix_pH -3.5 HNO3 100; end
END


--- End code ---

dlparkhurst:
You need to use "fix_pH" in the EQUI_DELTA function, instead of "HNO3". Otherwise, I think the script is doing what you want.

dlparkhurst:
P.S. Generally, I would not fix the pe. If you need to control redox conditions, it is better to fix the partial pressure of O2(g). That way, it is less likely that you will wander outside the stability field of water.

Navigation

[0] Message Index

Go to full version