paleolimbot / tidyphreeqc

Tidy geochemical modeling using PHREEQC
22 stars 3 forks source link

solubility-pH plot #1

Closed jia-11 closed 5 years ago

jia-11 commented 5 years ago

Firstly, thanks a lot! This is great package.

I am trying to get a solubility-pH plot like the figure below. Is it possible to generate the result like this using tidyphreeqc?

FeOH

Thanks in advance.

paleolimbot commented 5 years ago

You could probably get the "solid" region because that means SI > 0 (I think), but the "chemical reactions as lines" is something you'll have to calculate yourself. Let me know how it turns out!

jia-11 commented 5 years ago

Thanks! Those lines should be able to obtained based on the log_K values. Now the problem for me is that I do not know how to fix the pH. In PhreeqC, we need to define a new phase to fix the pH.

PHASES Fix_H+ H+ = H+ log_k 0.0

Then in the EQUILIBRIUM_PHASES, I need to add HCl or NaOH to make pH fixed.

EQUILIBRIUM_PHASES 1 Fix_H+ -5.0 HCl 100.0 Tenorite 0.0 0.0 END

Can we also do that in tidyphreeqc?

paleolimbot commented 5 years ago

It looks like I never got around to wrapping PHASES, but you can do this:

library(tidyphreeqc)

phr_input_section("PHASES", components = list(
"
Fix_H+
  H+ = H+
  log_k 0.0
"
))
#> <phr_input_section>
#> PHASES
#>     
#> Fix_H+
#>   H+ = H+
#>   log_k 0.0

phr_equilibrium_phases("Fix_H+" = "-5.0 HCl 100.0")
#> <phr_input_section>
#> EQUILIBRIUM_PHASES 1
#>     Fix_H+    -5.0 HCl 100.0

Created on 2019-06-25 by the reprex package (v0.2.1)