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 : #pragma once 11 : 12 : #include "GeochemistryActivityCoefficients.h" 13 : #include "GeochemistryIonicStrength.h" 14 : #include "EquilibriumConstantInterpolator.h" 15 : 16 : struct DebyeHuckelParameters 17 : { 18 : Real A; 19 : Real B; 20 : Real Bdot; 21 : Real a_water; 22 : Real b_water; 23 : Real c_water; 24 : Real d_water; 25 : Real a_neutral; 26 : Real b_neutral; 27 : Real c_neutral; 28 : Real d_neutral; 29 : 30 : DebyeHuckelParameters() 31 1209 : : A(0.5092), 32 1209 : B(0.3283), 33 1209 : Bdot(0.035), 34 1209 : a_water(1.45397), 35 1209 : b_water(0.022357), 36 1209 : c_water(0.0093804), 37 1209 : d_water(-0.0005262), 38 1209 : a_neutral(0.1127), 39 1209 : b_neutral(-0.01049), 40 1209 : c_neutral(0.001545), 41 1209 : d_neutral(0.0) 42 : { 43 : } 44 : 45 : bool operator==(const DebyeHuckelParameters & rhs) const 46 : { 47 : return (A == rhs.A) && (B == rhs.B) && (Bdot == rhs.Bdot) && (a_water == rhs.a_water) && 48 : (b_water == rhs.b_water) && (c_water == rhs.c_water) && (d_water == rhs.d_water) && 49 : (a_neutral == rhs.a_neutral) && (b_neutral == rhs.b_neutral) && 50 : (c_neutral == rhs.c_neutral) && (d_neutral == rhs.d_neutral); 51 : }; 52 : }; 53 : 54 : /** 55 : * Computes activity coefficients for non-minerals and non-gases (since these species do not have 56 : * activity coefficients). Also computes the activity of water. Uses a Debye-Huckel model 57 : */ 58 : class GeochemistryActivityCoefficientsDebyeHuckel : public GeochemistryActivityCoefficients 59 : { 60 : public: 61 : /** 62 : * @param method Method used by this class to compute activity coefficients and activity of water 63 : * @param is_calculator Calculates ionic strengths 64 : * @param db Original geochemistry database: used to find the temperature interpolation type, 65 : * Debye-Huckel params, etc 66 : */ 67 : GeochemistryActivityCoefficientsDebyeHuckel(const GeochemistryIonicStrength & is_calculator, 68 : const GeochemicalDatabaseReader & db); 69 : 70 : void setInternalParameters(Real temperature, 71 : const ModelGeochemicalDatabase & mgd, 72 : const std::vector<Real> & basis_species_molality, 73 : const std::vector<Real> & eqm_species_molality, 74 : const std::vector<Real> & kin_species_molality) override; 75 : 76 : Real waterActivity() const override; 77 : 78 : void buildActivityCoefficients(const ModelGeochemicalDatabase & mgd, 79 : std::vector<Real> & basis_activity_coef, 80 : std::vector<Real> & eqm_activity_coef) const override; 81 : 82 : /** 83 : * @return the Debye-Huckel parameters 84 : */ 85 : const DebyeHuckelParameters & getDebyeHuckel() const; 86 : 87 : /// Return the current value of ionic strength 88 : Real getIonicStrength() const; 89 : 90 : /// Return the current value of stoichiometric ionic strength 91 : Real getStoichiometricIonicStrength() const; 92 : 93 : private: 94 : /// number of temperature points in the database file 95 : const unsigned _numT; 96 : 97 : /// Debye-Huckel parameters found in the database 98 : const GeochemistryDebyeHuckel _database_dh_params; 99 : 100 : /// Debye-Huckel parameters found in the database for computing the water activities 101 : const GeochemistryNeutralSpeciesActivity _database_dh_water; 102 : 103 : /// Debye-Huckel parameters found in the database for computing the neutral (CO2) activities 104 : const GeochemistryNeutralSpeciesActivity _database_dh_neutral; 105 : 106 : /// ionic-strength calculator 107 : const GeochemistryIonicStrength & _is_calculator; 108 : 109 : /// current value of ionic strength 110 : Real _ionic_strength; 111 : 112 : /// current value of sqrt(ionic strength) 113 : Real _sqrt_ionic_strength; 114 : 115 : /// current value of stoichiometric ionic strength 116 : Real _stoichiometric_ionic_strength; 117 : 118 : /// number of basis species 119 : unsigned _num_basis; 120 : 121 : /// number of equilibrium species 122 : unsigned _num_eqm; 123 : 124 : /// Debye-Huckel parameters 125 : DebyeHuckelParameters _dh; 126 : 127 : /// Interpolator object for the Debye-Huckel parameter A 128 : EquilibriumConstantInterpolator _interp_A; 129 : 130 : /// Interpolator object for the Debye-Huckel parameter B 131 : EquilibriumConstantInterpolator _interp_B; 132 : 133 : /// Interpolator object for the Debye-Huckel parameter Bdot 134 : EquilibriumConstantInterpolator _interp_Bdot; 135 : 136 : /// Interpolator object for the Debye-Huckel parameter a_water 137 : EquilibriumConstantInterpolator _interp_a_water; 138 : 139 : /// Interpolator object for the Debye-Huckel parameter b_water 140 : EquilibriumConstantInterpolator _interp_b_water; 141 : 142 : /// Interpolator object for the Debye-Huckel parameter c_water 143 : EquilibriumConstantInterpolator _interp_c_water; 144 : 145 : /// Interpolator object for the Debye-Huckel parameter d_water 146 : EquilibriumConstantInterpolator _interp_d_water; 147 : 148 : /// Interpolator object for the Debye-Huckel parameter a_neutral 149 : EquilibriumConstantInterpolator _interp_a_neutral; 150 : 151 : /// Interpolator object for the Debye-Huckel parameter b_neutral 152 : EquilibriumConstantInterpolator _interp_b_neutral; 153 : 154 : /// Interpolator object for the Debye-Huckel parameter c_neutral 155 : EquilibriumConstantInterpolator _interp_c_neutral; 156 : 157 : /// Interpolator object for the Debye-Huckel parameter d_neutral 158 : EquilibriumConstantInterpolator _interp_d_neutral; 159 : };