PhreeqcUsers Discussion Forum

Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • SELECTED_OUTPUT »
  • select output when calculating alkalinity
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: select output when calculating alkalinity  (Read 260 times)

Ran He

  • Contributor
  • Posts: 1
select output when calculating alkalinity
« on: 28/04/25 19:31 »
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: [Select]
      '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
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4000
Re: select output when calculating alkalinity
« Reply #1 on: 29/04/25 05:05 »
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: [Select]
SELECTED_OUTPUT; -alkalinity trueThe 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: [Select]
PRINT; -alkalinity true
An additional block will appear in the output file that lists all of the species and their contribution to the alkalinity.


Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • SELECTED_OUTPUT »
  • select output when calculating alkalinity
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2