www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AqueousEquilibriumRxnAux Class Reference

Calculates equilibrium species concentration according to the mass action law. More...

#include <AqueousEquilibriumRxnAux.h>

Inheritance diagram for AqueousEquilibriumRxnAux:
[legend]

Public Member Functions

 AqueousEquilibriumRxnAux (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeValue () override
 

Protected Attributes

const VariableValue & _log_k
 Equilibrium constant. More...
 
const std::vector< Real > _sto_v
 Stoichiometric coefficients of coupled primary species. More...
 
std::vector< const VariableValue * > _vals
 Coupled primary species. More...
 
std::vector< const VariableValue * > _gamma_v
 Activity coefficients of coupled primary species. More...
 
const VariableValue & _gamma_eq
 Activity coefficient of equilibrium species. More...
 

Detailed Description

Calculates equilibrium species concentration according to the mass action law.

Definition at line 23 of file AqueousEquilibriumRxnAux.h.

Constructor & Destructor Documentation

◆ AqueousEquilibriumRxnAux()

AqueousEquilibriumRxnAux::AqueousEquilibriumRxnAux ( const InputParameters &  parameters)

Definition at line 30 of file AqueousEquilibriumRxnAux.C.

31  : AuxKernel(parameters),
32  _log_k(coupledValue("log_k")),
33  _sto_v(getParam<std::vector<Real>>("sto_v")),
34  _gamma_eq(coupledValue("gamma"))
35 {
36  const unsigned int n = coupledComponents("v");
37 
38  // Check that the correct number of stoichiometric coefficients have been provided
39  if (_sto_v.size() != n)
40  mooseError("The number of stoichiometric coefficients in sto_v is not equal to the number of "
41  "coupled species in ",
42  _name);
43 
44  // Check that the correct number of activity coefficients have been provided (if applicable)
45  if (isCoupled("gamma_v"))
46  if (coupledComponents("gamma_v") != n)
47  mooseError("The number of activity coefficients in gamma_v is not equal to the number of "
48  "coupled species in ",
49  _name);
50 
51  _vals.resize(n);
52  _gamma_v.resize(n);
53 
54  for (unsigned int i = 0; i < n; ++i)
55  {
56  _vals[i] = &coupledValue("v", i);
57  // If gamma_v has been supplied, use those values, but if not, use the default value
58  _gamma_v[i] = (isCoupled("gamma_v") ? &coupledValue("gamma_v", i) : &coupledValue("gamma_v"));
59  }
60 }
const std::vector< Real > _sto_v
Stoichiometric coefficients of coupled primary species.
std::vector< const VariableValue * > _gamma_v
Activity coefficients of coupled primary species.
const VariableValue & _gamma_eq
Activity coefficient of equilibrium species.
std::vector< const VariableValue * > _vals
Coupled primary species.
const VariableValue & _log_k
Equilibrium constant.

Member Function Documentation

◆ computeValue()

Real AqueousEquilibriumRxnAux::computeValue ( )
overrideprotectedvirtual

Definition at line 63 of file AqueousEquilibriumRxnAux.C.

64 {
65  Real conc_product = 1.0;
66 
67  for (unsigned int i = 0; i < _vals.size(); ++i)
68  conc_product *= std::pow((*_gamma_v[i])[_qp] * (*_vals[i])[_qp], _sto_v[i]);
69 
70  mooseAssert(_gamma_eq[_qp] > 0.0, "Activity coefficient must be greater than zero");
71  return std::pow(10.0, _log_k[_qp]) * conc_product / _gamma_eq[_qp];
72 }
const std::vector< Real > _sto_v
Stoichiometric coefficients of coupled primary species.
std::vector< const VariableValue * > _gamma_v
Activity coefficients of coupled primary species.
const VariableValue & _gamma_eq
Activity coefficient of equilibrium species.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
std::vector< const VariableValue * > _vals
Coupled primary species.
const VariableValue & _log_k
Equilibrium constant.

Member Data Documentation

◆ _gamma_eq

const VariableValue& AqueousEquilibriumRxnAux::_gamma_eq
protected

Activity coefficient of equilibrium species.

Definition at line 40 of file AqueousEquilibriumRxnAux.h.

Referenced by computeValue().

◆ _gamma_v

std::vector<const VariableValue *> AqueousEquilibriumRxnAux::_gamma_v
protected

Activity coefficients of coupled primary species.

Definition at line 38 of file AqueousEquilibriumRxnAux.h.

Referenced by AqueousEquilibriumRxnAux(), and computeValue().

◆ _log_k

const VariableValue& AqueousEquilibriumRxnAux::_log_k
protected

Equilibrium constant.

Definition at line 32 of file AqueousEquilibriumRxnAux.h.

Referenced by computeValue().

◆ _sto_v

const std::vector<Real> AqueousEquilibriumRxnAux::_sto_v
protected

Stoichiometric coefficients of coupled primary species.

Definition at line 34 of file AqueousEquilibriumRxnAux.h.

Referenced by AqueousEquilibriumRxnAux(), and computeValue().

◆ _vals

std::vector<const VariableValue *> AqueousEquilibriumRxnAux::_vals
protected

Coupled primary species.

Definition at line 36 of file AqueousEquilibriumRxnAux.h.

Referenced by AqueousEquilibriumRxnAux(), and computeValue().


The documentation for this class was generated from the following files: