paleolimbot / tidyphreeqc

Tidy geochemical modeling using PHREEQC
22 stars 3 forks source link

phr_surface_item #9

Open Zhongguangbin opened 4 years ago

Zhongguangbin commented 4 years ago

Hi, Dunnington, I want to caculate form metal in solution and surface,,But I don't know how to set the sites_units and equilibrate in phr_surface_item(I used the default value, but the surface and solution form proportions add up to more than 1, which is obviously unreasonable, I guess this error may relate to the setting of these two parameters) I try to set it,just like phr_surface( Hfo_sOH = phr_surface_item(sites = 5e-6, specific_area_per_gram = 600, grams = 0.09,sites_units="absolute"), Hfo_wOH = phr_surface_item(sites = 2e-4), ), or phr_surface( Hfo_sOH = phr_surface_item(sites = 5e-6, specific_area_per_gram = 600, grams = 0.09,equilibrate=1), Hfo_wOH = phr_surface_item(sites = 2e-4), ), but it says "unused argument" Another question I would like to consult you is that the setting of sites in phr_surface_item, Is it the same as the ex19B in usgs: https://water.usgs.gov/water-resources/software/PHREEQC/documentation/phreeqc3-html/phreeqc3-81.htm

Thank you!

paleolimbot commented 4 years ago

I'll need to fix this when I get into development again, but as a workaround, phr_surface_item() just pastes its arguments together. So, as long as you can make your input section look like the one from example, you should be good to go:

tidyphreeqc::phr_surface(1, NA, name = tidyphreeqc::phr_surface_item(1, 2, 3, 4))
#> <phr_input_section>
#> SURFACE 1
#>     name    1    2    3    -Dw 4
#>     -equilibrate    1
#>     -sites_units    absolute

Created on 2020-02-06 by the reprex package (v0.3.0)

Zhongguangbin commented 4 years ago

Another question is what the default model when I used the surface_species? In phreeqc ,there are three complexation models (CD-MUSIC,DDL and No electrostatics),Can I choose these three models and set the parameters ,such as -donnan,-cd_music? Thank you !

-cd_music ; -capacitance 9.59E-03 1.00E+06
-cd_music ; -capacitance 9.59E-03 1.00E+06
paleolimbot commented 4 years ago

I have no idea! tidyphreeqc just generates a PHREEQC input file...I'm constantly looking at the docs.

Ignimbrit commented 4 years ago

Hi @Zhongguangbin , afaik, the Phreeqc-Standard SURFACE is a Dzombak & Morel DDL with no explicit diffuse layer. Using the Windows GUI "PHREEQC Interactive" is really helpful in this regard, as you can see which boxes are ticked, even if it does not lead to explicit PHREEQC-Commands in the code.

As for your CD-MUSIC problem: another potentially helpful workaround might look something like this:

tidyphreeqc::phr_input_section( type = "SURFACE", number = 1, components = list( "-equilibrate with solution 1", "Hfo_sOH 0.0002 600 600", "-capacitance 0.00959 1e+006", "Hfo_wOH 5e-006", "-cd_music" ) )

Zhongguangbin commented 4 years ago

Thank you @Ignimbrit , I think I may know a little about how to do in phreeqc or tidyphreeqc,but when I try to library(tidyverse) tidyphreeqc::phr_run( phr_surface(cd_music=1,donnan=1.44e-5,capacitance=c(0.00959,1e+006), Hfo_sOH = phr_surface_item(sites =3.7e-7, specific_area_per_gram = 600, grams = 0.1)),phr_solution_list(pH=7,Na=0.1,Cl=0.1,Cd=0.000001))%>%phr_print_output() it works, but if I added the only_counter_ions like library(tidyverse) tidyphreeqc::phr_run( phr_surface(cd_music=1,donnan=1.44e-5,capacitance=c(0.00959,1e+006),only_counter_ions=1, Hfo_sOH = phr_surface_item(sites =3.7e-7, specific_area_per_gram = 600, grams = 0.1)),phr_solution_list(pH=7,Na=0.1,Cl=0.1,Cd=0.000001))%>%phr_print_output() it saids that Too many iterations in subroutine calc_psi_avg; surface charge = 6.5053e-026; surface water = 8.6400e-001.