LCOV - code coverage report
Current view: top level - src/utils - GeochemistryActivityCalculators.C (source / functions) Hit Total Coverage
Test: idaholab/moose geochemistry: 602416 Lines: 28 28 100.0 %
Date: 2025-07-18 11:37:48 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "GeochemistryActivityCalculators.h"
      11             : #include "libmesh/utility.h"
      12             : #include "GeochemistryConstants.h"
      13             : 
      14             : namespace GeochemistryActivityCalculators
      15             : {
      16             : Real
      17     1088451 : log10ActCoeffDHBdot(Real charge, Real ion_size, Real sqrt_ionic_strength, Real A, Real B, Real Bdot)
      18             : {
      19     1088451 :   if (sqrt_ionic_strength <= 0.0)
      20             :     return 0.0; // guard against unphysical inputs that might occur during a Newton process
      21     1086379 :   return -A * Utility::pow<2>(charge) * sqrt_ionic_strength /
      22     1086379 :              (1.0 + ion_size * B * sqrt_ionic_strength) +
      23     1086379 :          Bdot * Utility::pow<2>(sqrt_ionic_strength);
      24             : }
      25             : 
      26             : Real
      27       41126 : log10ActCoeffDHBdotNeutral(Real ionic_strength, Real a, Real b, Real c, Real d)
      28             : {
      29       41126 :   if (ionic_strength <= 0.0)
      30             :     return 0.0; // guard against unphysical inputs that might occur during a Newton process
      31       41112 :   return a * ionic_strength + b * Utility::pow<2>(ionic_strength) +
      32       41112 :          c * Utility::pow<3>(ionic_strength) + d * Utility::pow<4>(ionic_strength);
      33             : }
      34             : 
      35             : Real
      36           7 : log10ActCoeffDHBdotAlternative(Real ionic_strength, Real Bdot)
      37             : {
      38           7 :   if (ionic_strength <= 0.0)
      39             :     return 0.0; // guard against unphysical inputs that might occur during a Newton process
      40           5 :   return Bdot * ionic_strength;
      41             : }
      42             : 
      43             : Real
      44           3 : log10ActCoeffDavies(Real charge, Real sqrt_ionic_strength, Real A)
      45             : {
      46           3 :   if (sqrt_ionic_strength <= 0.0)
      47             :     return 0.0; // guard against unphysical inputs that might occur during a Newton process
      48           1 :   return -A * Utility::pow<2>(charge) *
      49           1 :          (sqrt_ionic_strength / (1.0 + sqrt_ionic_strength) -
      50           1 :           0.3 * Utility::pow<2>(sqrt_ionic_strength));
      51             : }
      52             : 
      53             : Real
      54       47631 : lnActivityDHBdotWater(
      55             :     Real stoichiometric_ionic_strength, Real A, Real atilde, Real btilde, Real ctilde, Real dtilde)
      56             : {
      57       47631 :   if (stoichiometric_ionic_strength <= 0.0)
      58             :     return 0.0; // guard against unphysical inputs that might occur during a Newton process
      59       47119 :   const Real bhat = 1.0 + atilde * std::sqrt(stoichiometric_ionic_strength);
      60       47119 :   const Real inner = bhat - 2.0 * std::log(bhat) - 1.0 / bhat;
      61       47119 :   const Real outer = 1.0 -
      62       47119 :                      A * GeochemistryConstants::LOGTEN / Utility::pow<3>(atilde) /
      63       47119 :                          stoichiometric_ionic_strength * inner +
      64       47119 :                      0.5 * btilde * stoichiometric_ionic_strength +
      65       47119 :                      2.0 * ctilde * Utility::pow<2>(stoichiometric_ionic_strength) / 3.0 +
      66       47119 :                      0.75 * dtilde * Utility::pow<3>(stoichiometric_ionic_strength);
      67       47119 :   return -2.0 * stoichiometric_ionic_strength * outer / GeochemistryConstants::MOLES_PER_KG_WATER;
      68             : }
      69             : 
      70             : } // namespace GeochemistryActivityCalculators

Generated by: LCOV version 1.14