PhreeqcUsers Discussion Forum

Registrations currently disabled due to excessive spam. Please email phreeqcusers at gmail.com to request an account.
Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC  (Read 1527 times)

CHENTing

  • Contributor
  • Posts: 3
Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« on: 19/07/24 15:35 »
EXPERTS of PHREEQC Community:

I am currently working with PHREEQC and have encountered a discrepancy in the molarity to molality transformation. Despite my efforts to manually verify these values, I consistently find a difference between my calculations and those reported by PHREEQC. And I have observed this discrepancy across all databases provided by PHREEQC.

FOR EXAMPLE:

Here are the details of my input:
Quote
SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mmol/l
    Cl        500
    Na        500
    water     1 # kg
Quote

The output provided by PHREEQC is:
Quote
pH  =   7.000   
                                       pe  =   4.000   
                          Density (g/cm3)  =   1.01761
                               Volume (L)  =   1.01228
                        Activity of water  =   0.983
                 Ionic strength (mol/kgw)  =   5.151e-01
                       Mass of water (kg)  =   1.000e+00
                 Total alkalinity (eq/kg)  =   4.100e-08
                         Temperature (癈)  =  25.00
                  Electrical balance (eq)  =  -4.101e-08
 Percent error, 100*(Cat-|An|)/(Cat+|An|)  =  -0.00
                               Iterations  =   5
                         Gamma iterations  =   3
                      Osmotic coefficient  =   0.92220
                         Density of water  =   0.99704
                                  Total H  = 1.110124e+02
                                  Total O  = 5.550622e+01

Solution composition:
Elements           Molality       Moles

    Cl                5.151e-01   5.151e-01
    Na                5.151e-01   5.151e-01
Quote

Based on my manual calculations, the molality of Na and Cl should be approximately 0.50587 mol/kg?H2O, yet PHREEQC reports it as 5.151e-01 mol/kg?H2O.

Could you please help me understand the following:

1. How does PHREEQC calculate the molality values, and what factors might account for the discrepancy between my manual calculations and the results from PHREEQC?

2. Are there any common mistakes or considerations I might have overlooked when inputting data into PHREEQC or interpreting the results?

I appreciate any guidance or insights you can provide to help me resolve this issue.

Thank you very much for your time and support.
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4035
Re: Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« Reply #1 on: 19/07/24 21:22 »
You need to define the density of the solution to make a better calculation (-density).

There is a feature to iterate to find the density that is consistent with the analytical data by adding "calc" on the -density line. This produces a density such that, if it were used in the SOLUTION definition, it wouldproduces an equal calculated density in the output. However, only phreeqc.dat, Amm.dat, and pitzer.dat databases have the molar volume definitions necessary to calculate density.

Code: [Select]
SOLUTION 1
    -density 1  calc
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mmol/l
    Cl        500
    Na        500
    water     1 # kgs
USER_PRINT
10 PRINT "Cl, mmol/L: ", STR_F$(1e3*TOTMOL("Cl")/[SOLN_VOL], 10, 1)
20 PRINT "Na, mmol/L: ", STR_F$(1e3*TOTMOL("Na")/[SOLN_VOL], 10, 1)
END

The calculation first converts /L to /kg solution by dividing by the density. A density of 1.0 is
assumed if no density is defined, which accounts for most of the discrepancy that you observed. Next
the sum of solutes is subtracted from 1 kg solution to obtain the mass of water. Molality is
calculated from the moles of solute (in a kg of solution) divided by the mass of water (in a kg of solution).

There is an improvement to the calculation in version 3.8.0 (https://github.com/usgs-coupled) that
more accurately accounts for the mass of the solutes. Previously, mass of solutes was based on the
gram formula weight defined for each analyte. This could lead to an error when the aqueous species
are not consistent with the assigned gfw, for example if the solute species was actually NO3-, but
the gfw of N(5) was set to N (14 g/L), as is common in reporting from U.S. labs. In the recent
version, when the "calc" option is used, the mass of solutes is determined from the masses of species
in the distribution of species, which is revised iteratively.
Logged

CHENTing

  • Contributor
  • Posts: 3
Re: Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« Reply #2 on: 20/07/24 04:49 »
Thanks for your suggestions.

However, I have encountered an issue: version 3.8.0 does not have a UI interactive executable, which makes it challenging for me to utilize these improvements effectively.Could you please provide guidance on how I can leverage these improvements in version 3.8.0 without the UI interactive executable? Are there any alternative ways to achieve the same accuracy in solute mass calculations using an older version with a UI, or any plans to release a UI interactive executable for version 3.8.0?

Your assistance in understanding this matter would be greatly appreciated.

Thank you very much for your time and support.
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4035
Re: Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« Reply #3 on: 20/07/24 13:31 »
If you are using PhreeqcI, simply type " calc" at the end of the -density definition.

The new version of PhreeqcI is available at https://github.com/usgs-coupled/phreeqci/releases/download/v3.8.0/phreeqci-3.8.0-16920.msi. The previous version of PhreeqcI also has the calculate option and will work adequately in almost all situations. The new version offers improvement in some situations where the gfw defined for an element or element redox state differs significantly from the gram formula weight for the aqueous species of the element.

Alternatively, you can use the Notepad++ interface found at hydrochemistry.eu.

Logged

CHENTing

  • Contributor
  • Posts: 3
Re: Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« Reply #4 on: 20/07/24 14:57 »
I would like to express my gratitude for your guidance and assistance. I fully understand your instructions and have been able to obtain the solution composition data in PHREEQC by add density calc.

However, when using the command line to run PHREEQC version 3.8.0, I keep encountering the error "ERROR: Cannot open file." Despite having added the path to PHREEQC to the environment variables, and ensuring that both the input and output files are in the same directory as phreeqc.exe, the issue persists. I am quite perplexed by this situation.

I apologize for the trouble caused due to my limited programming background and sincerely appreciate your generous help and support.

Looking forward to your further guidance.
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4035
Re: Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
« Reply #5 on: 20/07/24 18:14 »
If you have installed PhreeqcI (https://github.com/usgs-coupled/phreeqci/releases/download/v3.8.0/phreeqci-3.8.0-16920.msi), you can execute PhreeqcI and open the file through File->Open at the top-left of the page. You should then be able to run the file with the Run icon. If you do not have write permission in the directory in which the file is located, you must save it in a directory where you do have write permission. You can save the file during the Run operation, and you can choose the database file that you want to use. By default, output files will be written in the directory containing the input file.

If you have installed the batch version of PHREEQC (https://github.com/usgs-coupled/phreeqc3/releases/download/v3.8.0/phreeqc-3.8.0-16920-x64.msi), you will be able to run phreeqc from a CMD or PowerShell prompt. Simply navigate to the directory with the file (in a writable directory), and type "phreeqc input_file". If there is no DATABASE keyword at the beginning of the file, you must either (1) have a file named phreeqc.dat in the directory, which will be used as the database by default, or (2) you must use more arguments in the command to enter the input file, output file, and database file:

Code: [Select]
Usage:  phreeqc [input [output [database [screen_output]]]]

If you do not use additional arguments, PHREEQC will prompt you for the files.

By default, the batch file that runs the PHREEQC executable is installed as c:/Program Files/USGS/phreeqc-3.8.0-16920-x64/bin/phreeqc.bat.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • Discrepancy in Na and Cl Molality Calculation Across All Databases in PHREEQC
 

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