PhreeqcUsers Discussion Forum
Click here to donate to keep PhreeqcUsers open

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • Converting from molality (mol/kgw) to mg/l for high solubility minerals
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Converting from molality (mol/kgw) to mg/l for high solubility minerals  (Read 13760 times)

Tom

  • Admin
  • Posts: 123
Converting from molality (mol/kgw) to mg/l for high solubility minerals
« on: April 29, 2014, 04:13:59 PM »
I read on the PHREEQC Q+A thread that the conversion from molality (mol/kgw) to mg/l for dissolved species requires a correction for the density of the final solution and mass of the solutes.

(here: http://wwwbrr.cr.usgs.gov/projects/GWC_coupled/phreeqc/mail/msg00054.html)

Rewritten here, where X is the molar mass of the phase

mg/L = (mol/kgw) * (X g/mol) * (1000 mg/g) * (1 kgw/L)

For most solutions where the solubility of dissolving phases is low, I imagine the correction is only minor and could even be ignored. For very soluble minerals I would guess the density would change.

Is it possible to output the density of a solution? Or is the mass of water considered to represent the density (ie mass of water (in kg) per litre)?

I have attempted to print density in SELECTED_OUTPUT without any luck. Alternatively could it be output using a BASIC command in USER_PUNCH?

Thanks!
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #1 on: April 29, 2014, 09:52:40 PM »
Version 3 will calculate density when using the Amm.dat, phreeqc.dat, or pitzer.dat databases. The density is printed in the output section "Description of solution". In Basic, the function RHO returns the density (kg/L).
Logged

Tom

  • Admin
  • Posts: 123
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #2 on: April 30, 2014, 09:42:38 AM »
Thanks David, that's a great tip.

I had been using version 2.18 for MacOS so will experiment a little with V3 on a Windows PC.

The Basic command worked fine with the MacOS version.

For anyone else looking to output density, I used the following to output to the SELECTED_OUTPUT file:

USER_PUNCH
-headings density
-start
10 punch RHO
-end

Logged

Tom

  • Admin
  • Posts: 123
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #3 on: May 02, 2014, 06:24:31 PM »
Quick tip for output of mg/l without a density consideration (assumes 1kgw/litre):

Examples below for sulfate (S(6)) with molecular mass 96.06 g/mol.

Calculation in BASIC is:

mol/kgw * g/mol * 1000mg/g

The following writes to the SELECTED_OUTPUT file:

USER_PUNCH
-heading sulfate_mg/l
-start
10 PUNCH TOT("S(6)")*96.06*1000
-end

Alternatively the following writes to the general output file:

USER_PRINT
-start
10 PRINT "mg SO4/l", TOT("S(6)")*96.06*1000
-end
« Last Edit: May 02, 2014, 06:36:39 PM by Charlie »
Logged

Tom

  • Admin
  • Posts: 123
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #4 on: May 04, 2014, 03:34:28 PM »
For anyone looking to compare the effect of a density correction here is a partial script that may help.

The USER_PUNCH data block outputs density (BASIC 10), then converts mol SO4/kgw to mgSO4/l without a density correction (BASIC 20), then converts mol SO4/kgw to mgSO4/l with a density correction (BASIC 30), then outputs the difference between the uncorrected and corrected value (in mgSO4/l) (BASIC 40). Finally, the percentage difference is calculated (BASIC 50).
--------------
#llnl.dat

SELECTED_OUTPUT
-file out1.xls

USER_PUNCH
-headings density mgSO4/l_uncorrected mgSO4/l_corrected diff %diff
-start
10 PUNCH RHO
20 PUNCH TOT("S(6)")*96.06*1000
30 PUNCH TOT("S(6)")*96.06*1000*RHO
40 PUNCH (TOT("S(6)")*96.06*1000)-(TOT("S(6)")*96.06*1000*RHO)
50 PUNCH (((TOT("S(6)")*96.06*1000)-(TOT("S(6)")*96.06*1000*RHO))/(TOT("S(6)")*96.06*1000*RHO))*100
-end

-----------------
Please let me know if you spot any errors for correction or identify any simplifications that could be made.

I suppose the BASIC could be simplified by defining each punch as a variable? But it probably helps with explanation to leave it written in full...
« Last Edit: May 04, 2014, 03:36:59 PM by Tom »
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #5 on: May 05, 2014, 04:33:14 PM »
To do this calculation correctly, you will need to use pitzer.dat, phreeqc.dat, or Amm.dat. These databases have the molar volume information to calculate density accurately. The following gives the molality, mol/L, and mol/kgs concentrations for a solution saturated with gypsum at 25 C.

SOLUTION
END
USE solution 1
EQUILIBRIUM_PHASES 1
   Gypsum 0 10
USER_PRINT
10 PRINT "Density:   ", RHO
20 PRINT "SO4, mol/kgw (molality): ", TOT("S(6)")
30 PRINT "SO4, mol/L:              ", TOTMOL("S(6)") / SOLN_VOL
40 PRINT "SO4, mol/kgs:            ", (TOTMOL("S(6)") / SOLN_VOL) * RHO

Results:

Density:      9.9908e-01
SO4, mol/kgw (molality):    1.5085e-02
SO4, mol/L:                 1.5040e-02
SO4, mol/kgs:               1.5026e-02
Logged

Tom

  • Admin
  • Posts: 123
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #6 on: May 06, 2014, 08:55:57 AM »
Great! Thanks David, that is a considerable improvement which will certainly help myself and hopefully others.


For clarification, am I right in thinking this BASIC line would give mg SO4/L ?

50 PRINT "SO4, mg/l:            ", (TOTMOL("S(6)") * 96.06) / SOLN_VOL


and then this line would give mg SO4/kgs ?

60 PRINT "SO4, mg/kgs:        ', ((TOTMOL("S(6)") * 96.06) / SOLN_VOL) * RHO

Thanks
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #7 on: May 06, 2014, 10:03:32 PM »
Yes. Note that TOT("S(6)") is the sum of all SO4-2 species (SO4-2, NaSO4-, CaSO4, etc), not just the bare ion SO4-2 (which would be MOL("SO4-2").
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #8 on: May 07, 2014, 06:02:26 PM »
Think you also need a factor of 1000 mg/g. 96 is g/mol, and you want mg.

Note you can use GFW("SO4") to calculate the gram formula weight of sulfate.
Logged

Tom

  • Admin
  • Posts: 123
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #9 on: May 08, 2014, 08:00:02 AM »
Ahh yes, great spot, thanks.

I had copied it from the file where I was after simply g/l.

Logged

John

  • Contributor
  • Posts: 1
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #10 on: May 12, 2015, 02:43:51 PM »
Thanks for making these conversions - they are helpful. It's unclear to me why you are multiplying by density, instead of 1/density. Shouldn't the conversion be:

(mol/kgw) x (1kgw/L) x (1L/kgs) = mol/kgs

What am I missing?
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #11 on: May 12, 2015, 03:30:19 PM »
You're right. Should divide by rho.

60 PRINT "SO4, mg/kgs:        ', ((TOTMOL("S(6)") * 96.06) * 1000 / SOLN_VOL) / RHO
« Last Edit: May 12, 2015, 04:05:46 PM by dlparkhurst »
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #12 on: March 10, 2020, 08:09:49 AM »
Dear All,

Related to the problem of molality, I think I have missed something basic: If I choose for a seawater solution a total C(4) concentration of 2.4 mmol/kg solution the sum of all species of inorganic carbon gives a concentration larger than 2.4 mmol/kg. Why does this happen?

In contrast, if the input C(4) is given in mmol/kg pure water, the result is correct, even though the concentration per kg pure water should be smaller than molality, as molality should be concentration in the total solution.

In the user manual it says that density of the total solution is not known before the calculation. I understand this problem. And yet in the latter case, the  concentration was calculated correctly.

Best wishes,
GeeqC



Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #13 on: March 10, 2020, 02:47:45 PM »
If you take a kilogram of solution, the mass of water is 1 kg minus the sum of the solutes. So if you have 2.4 mmol/kgs you need to divide by kgw/kgs, which is a number less than 1.0. mmol/kgw will be a number greater than 2.4.

I'm not sure what you mean by per kilogram pure water. The definition of molality is moles per kilogram water. Note that the following receipe does not make a 1 molal solution of calcium, even though you take 1 kilogram of water and add 1 mole of Ca. The reaction 2CaO + H2O = 2Ca+2 + 2OH- consumes water, so that the molality of Ca is 1.018 in the reacted solution.

SOLUTION
REACTION
CaO 1
1 mole
END
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #14 on: March 12, 2020, 11:12:30 AM »
Dear Dr. Parkhurst,

Thanks! This explains parts of the problem. Now the question is, how I can proceed with the following:

I would like to use the output solution from a reaction-transport model as input for PhreeqC. The concentrations are given in Molarity (i.e. mmol per liter of solution). Phreeqc should then do the speciation, but leave the concentrations unchanged, as otherwise this would create a runaway effect in the reaction-transport model. Is there a way to solve this problem?

Best wishes,
GeeqC

Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #15 on: March 12, 2020, 02:32:37 PM »
No Dr.

PhreeqcRM is a version of PHREEQC intended to run chemistry for reactive transport models. It requires that H, O, charge, and each additional element in the system be transported by the transport code. (Alternatively, H2O, total H - 2*H2O, and total O - H2O can be transported instead of total H and total O.)

Three options are available for concentration units used by the transport code: mg/L, mol/L, or mass fraction, kg/kgs. PHREEQC uses moles of H, O, charge, and each element in its underlying solution definition (see PHREEQC manual SOLUTION_RAW and SOLUTION_MODIFY in the appendix). Here is the documentation from PhreeqcRM.

SetUnitsSolution

Solution concentration units used by the transport model. Options are 1, mg/L; 2 mol/L; or 3, mass fraction, kg/kgs. PHREEQC defines solutions by the number of moles of each element in the solution.

To convert from mg/L to moles of element in the representative volume of a reaction cell, mg/L is converted to mol/L and multiplied by the solution volume, which is the product of porosity (SetPorosity), saturation (SetSaturation), and representative volume (SetRepresentativeVolume). To convert from mol/L to moles of element in the representative volume of a reaction cell, mol/L is multiplied by the solution volume. To convert from mass fraction to moles of element in the representative volume of a reaction cell, kg/kgs is converted to mol/kgs, multiplied by density (SetDensity) and multiplied by the solution volume.

To convert from moles of element in the representative volume of a reaction cell to mg/L, the number of moles of an element is divided by the solution volume resulting in mol/L, and then converted to mg/L. To convert from moles of element in a cell to mol/L, the number of moles of an element is divided by the solution volume resulting in mol/L. To convert from moles of element in a cell to mass fraction, the number of moles of an element is converted to kg and divided by the total mass of the solution. Two options are available for the volume and mass of solution that are used in converting to transport concentrations: (1) the volume and mass of solution are calculated by PHREEQC, or (2) the volume of solution is the product of porosity (SetPorosity), saturation (SetSaturation), and representative volume (SetRepresentativeVolume), and the mass of solution is volume times density as defined by SetDensity. Which option is used is determined by UseSolutionDensityVolume.
« Last Edit: March 12, 2020, 02:34:12 PM by dlparkhurst »
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #16 on: March 13, 2020, 12:16:57 PM »
Thank you for the detailed information.
If I understand you correctly, this is about the reaction module. However, I still use my own reaction-transport code and IphreeqCOM for data transfer.

But let's consider a more simple example: I would like to know the saturation index of halite in a 500 mmol/L NaCl solution. The following information is entered into the input file:

SOLUTION_SPREAD
    -units    mmol/l
  Cl     Na   
 500    500

The following appears in the output file:

Molality: 5.151e-1
Density (g/cm3): 1.01761
Volume (L): 1.01228

I assume the Molarity can be calculated by dividing the Molality by the volume and multiplying it with the density, which yields 0.518 mol/L. In other words, the speciation was calculated for a 518 mmol/L NaCl solution, i.e. the saturation index for a 500 mmol/L NaCl solution would not be correct. Where does the excess NaCl come from? And how can I modify the input so that the concentration in the resulting solution is 500 mmol/L?
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #17 on: March 13, 2020, 02:14:43 PM »
The conversions are the same whether you use PhreeqcRM or not, so you should look at the response more carefully. The point is to use SOLUTION_RAW or SOLUTION_MODIFY in IPhreeqcCOM to define the new solutions so that you avoid the issues you are having with SOLUTION and SOLUTION_SPREAD.

A necessary condition is to have the correct density for the solution to convert from /L to /kgw with SOLUTION or SOLUTION_SPREAD. There will still be approximations involved with calculating the mass of solutes, so that for more complicated solutions, say with carbonates, you will not be able to make an exact conversion. The option "calc" will iterate on the density so that the density used in conversions is the same as the density calculated in the initial solution calculation.
 
Code: [Select]
SOLUTION
-units mmol/L
-density 1 calc
Na 500
Cl 500
USER_PRINT
10 PRINT "Na, mol/L: ", TOTMOL("Na")/soln_vol
20 PRINT "Cl, mol/L: ", TOTMOL("Cl")/soln_vol
« Last Edit: March 13, 2020, 03:33:23 PM by dlparkhurst »
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #18 on: March 16, 2020, 11:00:27 AM »
Thanks for the explanations. I think there was an error in my calculation above. With the density and volume indeed the correct concentration of 500 mmol/l can be calculated. But as you say, it may not work for more complex solutions.

I tried "-density 1 calc", and it works. However, in the output file now the Molality (not the Molarity) is 0.5.

As far as I understand, SOLUTION_RAW and SOLUTION_MODIFY are written to a "dump" file. The question is then, how these data can be retrieved through IPhreeqCOM, as they are probably not accessible through "GetSelectedOutputArray"?

Having now two different options for renewing the parameters in the reaction-transport model, I wonder what the advantage of "SOLUTION_RAW/SOLUTION_MODIFY" is over "-density 1 calc" (The latter slows down the model run by ca. 30%, perhaps due to the additional iterations?).
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #19 on: March 16, 2020, 03:01:10 PM »
The script in the previous post produces molality of 0.5061 mol/kgw corresponding to 0.5 mol/L using phreeqc.dat.

Total moles of each element can be written with USER_PUNCH, for example for hydrogen, with either the TOTMOL("H") function, or TOT("H")*TOT("water") [oops, previous version of this post had SOLN_VOL].

SOLUTION_RAW/SOLUTION_MODIFY does not require an estimate of the mass of solutes. If density and solution volumes are known, then the conversions should be exact. With SOLUTION, you still need to know density, but the conversion also requires an inexact estimate of solute mass. Further, it is not easy to define a SOLUTION with a given volume; the default is 1 kg water or some fraction of a kilogram of water.
« Last Edit: March 16, 2020, 09:10:41 PM by dlparkhurst »
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #20 on: March 18, 2020, 09:48:22 AM »
Thanks for the helpful comments. The user punch was successful. For Molarity I assume it should say "TOTMOL/soln_vol" (?)

Now, there is one issue that I did not mention yet: for the reaction-transport model I would also need the molar concentrations of the carbonate species. However, I cannot find any output option for the molarity of a species, neither in "selected output" nor in "user punch".
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #21 on: March 18, 2020, 03:39:01 PM »
Molarity of HCO3- is MOL("HCO3-") * TOT("water") / SOLN_VOL

Not sure what you are doing with your transport model, but, unless you are doing multicomponent diffusion, it is only necessary to transport H, O, charge, and each element.
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #22 on: March 19, 2020, 02:53:35 PM »
Yes, this works! The molarities of partially dissociated species (e.g. CO3-2, HCO3-, CO2) are needed, because these species have different diffusion coefficients and are calculated separately in the reaction-transport model.

Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #23 on: March 19, 2020, 08:09:10 PM »
Still think you should take a look at PhreeqcRM. It does all of these conversions, and there is an option to get all aqueous species to allow for multicomponent diffusion. In addition, there is built-in parallelization. Much simpler than writing it all with IPhreeqc.
Logged

GeeqC

  • Top Contributor
  • Posts: 62
Re: Converting from molality (mol/kgw) to mg/l for high solubility minerals
« Reply #24 on: March 20, 2020, 12:11:40 PM »
Thanks for the advice. I will consider PhreeqcRM for further modelling.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • PHREEQC basics »
  • Converting from molality (mol/kgw) to mg/l for high solubility minerals
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2