https://mooseframework.inl.gov
GeochemistryActivityCalculators.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "libmesh/utility.h"
12 #include "GeochemistryConstants.h"
13 
15 {
16 Real
17 log10ActCoeffDHBdot(Real charge, Real ion_size, Real sqrt_ionic_strength, Real A, Real B, Real Bdot)
18 {
19  if (sqrt_ionic_strength <= 0.0)
20  return 0.0; // guard against unphysical inputs that might occur during a Newton process
21  return -A * Utility::pow<2>(charge) * sqrt_ionic_strength /
22  (1.0 + ion_size * B * sqrt_ionic_strength) +
23  Bdot * Utility::pow<2>(sqrt_ionic_strength);
24 }
25 
26 Real
27 log10ActCoeffDHBdotNeutral(Real ionic_strength, Real a, Real b, Real c, Real d)
28 {
29  if (ionic_strength <= 0.0)
30  return 0.0; // guard against unphysical inputs that might occur during a Newton process
31  return a * ionic_strength + b * Utility::pow<2>(ionic_strength) +
32  c * Utility::pow<3>(ionic_strength) + d * Utility::pow<4>(ionic_strength);
33 }
34 
35 Real
36 log10ActCoeffDHBdotAlternative(Real ionic_strength, Real Bdot)
37 {
38  if (ionic_strength <= 0.0)
39  return 0.0; // guard against unphysical inputs that might occur during a Newton process
40  return Bdot * ionic_strength;
41 }
42 
43 Real
44 log10ActCoeffDavies(Real charge, Real sqrt_ionic_strength, Real A)
45 {
46  if (sqrt_ionic_strength <= 0.0)
47  return 0.0; // guard against unphysical inputs that might occur during a Newton process
48  return -A * Utility::pow<2>(charge) *
49  (sqrt_ionic_strength / (1.0 + sqrt_ionic_strength) -
50  0.3 * Utility::pow<2>(sqrt_ionic_strength));
51 }
52 
53 Real
55  Real stoichiometric_ionic_strength, Real A, Real atilde, Real btilde, Real ctilde, Real dtilde)
56 {
57  if (stoichiometric_ionic_strength <= 0.0)
58  return 0.0; // guard against unphysical inputs that might occur during a Newton process
59  const Real bhat = 1.0 + atilde * std::sqrt(stoichiometric_ionic_strength);
60  const Real inner = bhat - 2.0 * std::log(bhat) - 1.0 / bhat;
61  const Real outer = 1.0 -
62  A * GeochemistryConstants::LOGTEN / Utility::pow<3>(atilde) /
63  stoichiometric_ionic_strength * inner +
64  0.5 * btilde * stoichiometric_ionic_strength +
65  2.0 * ctilde * Utility::pow<2>(stoichiometric_ionic_strength) / 3.0 +
66  0.75 * dtilde * Utility::pow<3>(stoichiometric_ionic_strength);
67  return -2.0 * stoichiometric_ionic_strength * outer / GeochemistryConstants::MOLES_PER_KG_WATER;
68 }
69 
70 } // namespace GeochemistryActivityCalculators
constexpr Real MOLES_PER_KG_WATER
Real log10ActCoeffDavies(Real charge, Real sqrt_ionic_strength, Real A)
log10(activity coefficient) according to the Davies model
Real log10ActCoeffDHBdotNeutral(Real ionic_strength, Real a, Real b, Real c, Real d)
log10(activity coefficient) for neutral species according to the Debye-Huckel B-dot model ...
Calculators to compute activity coefficients.
Real log10ActCoeffDHBdotAlternative(Real ionic_strength, Real Bdot)
log10(activity coefficient) alternative expression that is sometimes used in conjunction with the Deb...
Real lnActivityDHBdotWater(Real stoichiometric_ionic_strength, Real A, Real atilde, Real btilde, Real ctilde, Real dtilde)
ln(activity of water) according to the Debye-Huckel B-dot model
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real log10ActCoeffDHBdot(Real charge, Real ion_size, Real sqrt_ionic_strength, Real A, Real B, Real Bdot)
log10(activity coefficient) according to the Debye-Huckel B-dot model