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 1197788 : log10ActCoeffDHBdot(Real charge, Real ion_size, Real sqrt_ionic_strength, Real A, Real B, Real Bdot) 18 : { 19 1197788 : if (sqrt_ionic_strength <= 0.0) 20 : return 0.0; // guard against unphysical inputs that might occur during a Newton process 21 1195436 : return -A * Utility::pow<2>(charge) * sqrt_ionic_strength / 22 1195436 : (1.0 + ion_size * B * sqrt_ionic_strength) + 23 1195436 : Bdot * Utility::pow<2>(sqrt_ionic_strength); 24 : } 25 : 26 : Real 27 44837 : log10ActCoeffDHBdotNeutral(Real ionic_strength, Real a, Real b, Real c, Real d) 28 : { 29 44837 : if (ionic_strength <= 0.0) 30 : return 0.0; // guard against unphysical inputs that might occur during a Newton process 31 44823 : return a * ionic_strength + b * Utility::pow<2>(ionic_strength) + 32 44823 : 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 54034 : lnActivityDHBdotWater( 55 : Real stoichiometric_ionic_strength, Real A, Real atilde, Real btilde, Real ctilde, Real dtilde) 56 : { 57 54034 : if (stoichiometric_ionic_strength <= 0.0) 58 : return 0.0; // guard against unphysical inputs that might occur during a Newton process 59 53452 : const Real bhat = 1.0 + atilde * std::sqrt(stoichiometric_ionic_strength); 60 53452 : const Real inner = bhat - 2.0 * std::log(bhat) - 1.0 / bhat; 61 53452 : const Real outer = 1.0 - 62 53452 : A * GeochemistryConstants::LOGTEN / Utility::pow<3>(atilde) / 63 53452 : stoichiometric_ionic_strength * inner + 64 53452 : 0.5 * btilde * stoichiometric_ionic_strength + 65 53452 : 2.0 * ctilde * Utility::pow<2>(stoichiometric_ionic_strength) / 3.0 + 66 53452 : 0.75 * dtilde * Utility::pow<3>(stoichiometric_ionic_strength); 67 53452 : return -2.0 * stoichiometric_ionic_strength * outer / GeochemistryConstants::MOLES_PER_KG_WATER; 68 : } 69 : 70 : } // namespace GeochemistryActivityCalculators