https://mooseframework.inl.gov
GeochemistryKineticRateCalculator.h
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 
10 #pragma once
11 
12 #include "MooseTypes.h"
13 #include "DenseMatrix.h"
14 #include "GeochemistryConstants.h"
15 
29 {
33  RAW,
35 };
36 
76 {
79  Real area_quantity,
80  bool multiply_by_mass,
84  const std::vector<std::string> & promoting_species,
85  const std::vector<Real> & promoting_indices,
86  const std::vector<Real> & promoting_monod_indices,
87  const std::vector<Real> & promoting_half_saturation,
88  Real theta,
89  Real eta,
90  Real activation_energy,
91  Real one_over_T0,
93  std::string progeny,
94  Real progeny_efficiency,
96  Real energy_captured)
108  theta(theta),
109  eta(eta),
113  progeny(progeny),
117  {
118  if (promoting_species.size() != promoting_indices.size())
119  mooseError("The promoting_species and promoting_indices vectors must be the same size");
120  if (promoting_species.size() != promoting_monod_indices.size())
121  mooseError("The promoting_species and promoting_monod_indices vectors must be the same size");
122  if (promoting_species.size() != promoting_half_saturation.size())
123  mooseError(
124  "The promoting_species and promoting_half_saturation vectors must be the same size");
125  std::unordered_map<std::string, int> check_for_repeats;
126  for (const std::string & name : promoting_species)
127  if (check_for_repeats.count(name) == 1)
128  mooseError("Promoting species ", name, " has already been provided with an exponent");
129  else
130  check_for_repeats[name] = 1;
131  };
132 
133  bool operator==(const KineticRateUserDescription & rhs) const
134  {
135  return (kinetic_species_name == rhs.kinetic_species_name) &&
145  (eta == rhs.eta) && (activation_energy == rhs.activation_energy) &&
146  (one_over_T0 == rhs.one_over_T0) && (direction == rhs.direction) &&
147  (progeny == rhs.progeny) && (progeny_efficiency == rhs.progeny_efficiency) &&
150  };
151 
152  std::string kinetic_species_name;
159  std::vector<std::string> promoting_species;
160  std::vector<Real> promoting_indices;
161  std::vector<Real> promoting_monod_indices;
162  std::vector<Real> promoting_half_saturation;
168  std::string progeny;
172 };
173 
233 {
275 void calculateRate(const std::vector<Real> & promoting_indices,
276  const std::vector<Real> & promoting_monod_indices,
277  const std::vector<Real> & promoting_half_saturation,
278  const KineticRateUserDescription & description,
279  const std::vector<std::string> & basis_species_name,
280  const std::vector<bool> & basis_species_gas,
281  const std::vector<Real> & basis_molality,
282  const std::vector<Real> & basis_activity,
283  const std::vector<bool> & basis_activity_known,
284  const std::vector<std::string> & eqm_species_name,
285  const std::vector<bool> & eqm_species_gas,
286  const std::vector<Real> & eqm_molality,
287  const std::vector<Real> & eqm_activity,
288  const DenseMatrix<Real> & eqm_stoichiometry,
289  Real kin_moles,
290  Real kin_species_molecular_weight,
291  Real log10K,
292  Real log10_activity_product,
293  const DenseMatrix<Real> & kin_stoichiometry,
294  unsigned kin,
295  Real temp_degC,
296  Real & rate,
297  Real & drate_dkin,
298  std::vector<Real> & drate_dmol);
299 }
void mooseError(Args &&... args)
KineticRateUserDescription(const std::string &kinetic_species_name, Real intrinsic_rate_constant, Real area_quantity, bool multiply_by_mass, Real kinetic_molal_index, Real kinetic_monod_index, Real kinetic_half_saturation, const std::vector< std::string > &promoting_species, const std::vector< Real > &promoting_indices, const std::vector< Real > &promoting_monod_indices, const std::vector< Real > &promoting_half_saturation, Real theta, Real eta, Real activation_energy, Real one_over_T0, DirectionChoiceEnum direction, std::string progeny, Real progeny_efficiency, Real kinetic_bio_efficiency, Real energy_captured)
void calculateRate(const std::vector< Real > &promoting_indices, const std::vector< Real > &promoting_monod_indices, const std::vector< Real > &promoting_half_saturation, const KineticRateUserDescription &description, const std::vector< std::string > &basis_species_name, const std::vector< bool > &basis_species_gas, const std::vector< Real > &basis_molality, const std::vector< Real > &basis_activity, const std::vector< bool > &basis_activity_known, const std::vector< std::string > &eqm_species_name, const std::vector< bool > &eqm_species_gas, const std::vector< Real > &eqm_molality, const std::vector< Real > &eqm_activity, const DenseMatrix< Real > &eqm_stoichiometry, Real kin_moles, Real kin_species_molecular_weight, Real log10K, Real log10_activity_product, const DenseMatrix< Real > &kin_stoichiometry, unsigned kin, Real temp_degC, Real &rate, Real &drate_dkin, std::vector< Real > &drate_dmol)
Calclates a kinetic rate and its derivative.
const std::string name
Definition: Setup.h:20
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Holds a user-specified description of a kinetic rate.
bool operator==(const KineticRateUserDescription &rhs) const
Provides a parametric description of a general kinetic rate.
std::vector< std::string > promoting_species
DirectionChoiceEnum
This controls the direction of a kinetic rate BOTH: both dissolution and precipitation are allowed PR...