Beginners > SELECTED_OUTPUT
select output when calculating alkalinity
(1/1)
Ran He:
Hi Parkhurst,
I was trying to use the package in R to calculate the alkalinity using the equation HCO3 + 2*CO3 + OH - H
I have writen as this way, is it right for the output of these four species? Thank you
--- Code: --- 'SELECTED_OUTPUT ',
' -high precision TRUE',
' -molalities HCO3- CO3-2 H+ OH-' # Track carbonate species for alkalinity calculation
)
phrRunString(input)
output <- phrGetSelectedOutput()
# Calculate alkalinity from carbonate species (carb_alk = [HCO3-] + 2[CO3-2])
hco3 <- output$n1$m_HCO3.
co3 <- output$n1$m_CO3.2
H <- output$n1$m_H.
OH <- output$n1$m_OH
# Calculate alkalinity in mmol/kgw
# Note: Converting from molalities to mmol/kgw
Alkalinity[nn, mm] <- hco3 * 1000 + 2 * co3 * 1000 - H *1000+OH*1000
--- End code ---
dlparkhurst:
I don't know R well enough to know if your code is correct. It looks like you have the right concept.
However, the alkalinity may contain more species than you have specified, for instance H3SiO4, or H2BO3-. The complete alkalinity is available with
--- Code: ---SELECTED_OUTPUT; -alkalinity true
--- End code ---
The column name will be Alk.
In addition, you can print all of the species that contribute to alkalinity in a solution with the following:
--- Code: ---PRINT; -alkalinity true
--- End code ---
An additional block will appear in the output file that lists all of the species and their contribution to the alkalinity.
Navigation
[0] Message Index
Go to full version