phr_solution_master_species: Define a solution master species

Description Usage Arguments See Also Examples

View source: R/phreeqc_input_helpers.R

Description

Most master species are defined in the databases. Some are not (e.g., Hg in the default database), and require specification in the input. This is also a good way to specify components of a solution that do not dissociate (e.g., Cyanide in the minteq database). Solution master species must have an associated phr_solution_species() identity reaction (e.g., Hg+2 = Hg+2). The identity reaction must have a log_k of 0, but can specify other parameters such as gamma (relationship between activity, concentration, and ionic strength).

Usage

1
2
3
phr_solution_master_species(element_name, master_species, alkalinity = 0,
  gram_formula_weight = element_gram_formula_weight,
  element_gram_formula_weight = NA)

Arguments

element_name

An element name (e.g., As). Can also have a valence state (e.g., Hg(2)). If it does have a valence state, the original element must already be defined as a phr_solution_master_species. This is the name that will get used to specify concentrations in phr_solution(). Can be any name that starts with a capital letter (e.g., "EDTA").

master_species

The representative species of the element. This is the name that will end up in a phr_solution_species() reaction (or any other reaction).

alkalinity

The contribution of this species to Alkalinity.

gram_formula_weight

Weight used for unit conversion from the master species. Usually this is the gram formula weight of the element (safest bet), not of the dominant aequeous species. The exception of this appears to be SO4 in the databases. Use NA to calculate automatically; use NULL to omit.

element_gram_formula_weight

Weight used for unit conversion from the element. Use NA to calculate automatically; use NULL to omit.

A phr_input_section().

See Also

https://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/html/final-57.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# define Hg as a species assuming it is Hg+2 in solution.
phr_input(
  phr_solution_master_species("Hg", "Hg+2"),
  phr_solution_species("Hg+2 = Hg+2"),
  phr_solution(Hg = 0.2, units = "mol/L")
) %>%
  phr_run() %>%
  phr_print_output()

# Species that are partially included already are harder to implement.
# To implement a concentration of "Perchlorate" (ClO4-), it's necessary to
# include a balanced reaction to convert the previously defined
# primary master species Cl- to ClO4. Realistically, this would be
# done using Cl2, which could be created using Na+ and Cl-. Basically,
# this is a bit of a rabbit hole. Log K values should be included with any
# non-identity reaction to ensure the result is somewhat realistic. You could
# use very low log_k values to suggest that maybe this reaction is unlikely.
phr_input(
  phr_solution_master_species("Cl(0)", "Cl2"),
  phr_solution_master_species("Cl(-1)", "Cl-"),
  phr_solution_master_species("Cl(7)", "ClO4-"),
  phr_solution_species("Cl2 = Cl2"),
  phr_solution_species("2Cl- + 2H2O = Cl2 + H2 + 2OH-", log_k = -20),
  phr_solution_species("ClO4- = ClO4-"),
  phr_solution_species("0.5Cl2 + 4H2O = ClO4- + 8H+ + 7e-", log_k = -20),
  phr_solution("Cl(7)" = 0.2, units = "mol/L")
) %>%
  phr_run() %>%
  phr_print_output()

# A better way to do this would be to implement Perchlorate as a
# primary master species, since this doesn't make any assumptions about
# how it might react with water.
phr_input(
  phr_solution_master_species(
    "Perchlorate", "Perchlorate-",
    element_gram_formula_weight = chemr::mass("ClO4-")
  ),
  phr_solution_species("Perchlorate- = Perchlorate-"),
  phr_solution("Perchlorate" = 0.2, units = "mol/L")
) %>%
  phr_run() %>%
  phr_print_output()

paleolimbot/tidyphreeqc documentation built on Aug. 29, 2019, 11:14 p.m.