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

Define the Kernel for a CoupledBEEquilibriumSub operator that looks like: delta (weight * 10^log_k * u^sto_u * v^sto_v) / delta t. More...

#include <CoupledBEEquilibriumSub.h>

Inheritance diagram for CoupledBEEquilibriumSub:
[legend]

Public Member Functions

 CoupledBEEquilibriumSub (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual () override
 
virtual Real computeQpJacobian () override
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar) override
 

Private Attributes

const Real _weight
 Weight of the equilibrium species concentration in the total primary species concentration. More...
 
const Real _log_k
 Equilibrium constant for the equilibrium species in association form. More...
 
const Real _sto_u
 Stoichiometric coefficient of the primary species. More...
 
const std::vector< Real > _sto_v
 Stoichiometric coefficients of the coupled primary species. More...
 
const MaterialProperty< Real > & _porosity
 Material property of porosity. More...
 
std::vector< unsigned int > _vars
 Coupled primary species variable numbers. More...
 
std::vector< const VariableValue * > _v_vals
 Coupled primary species concentrations. More...
 
std::vector< const VariableValue * > _v_vals_old
 Coupled old values of primary species concentrations. More...
 
const VariableValue & _u_old
 The old values of the primary species concentration. More...
 

Detailed Description

Define the Kernel for a CoupledBEEquilibriumSub operator that looks like: delta (weight * 10^log_k * u^sto_u * v^sto_v) / delta t.

Definition at line 22 of file CoupledBEEquilibriumSub.h.

Constructor & Destructor Documentation

CoupledBEEquilibriumSub::CoupledBEEquilibriumSub ( const InputParameters &  parameters)

Definition at line 30 of file CoupledBEEquilibriumSub.C.

31  : Kernel(parameters),
32  _weight(getParam<Real>("weight")),
33  _log_k(getParam<Real>("log_k")),
34  _sto_u(getParam<Real>("sto_u")),
35  _sto_v(getParam<std::vector<Real>>("sto_v")),
36  _porosity(getMaterialProperty<Real>("porosity")),
37  _u_old(valueOld())
38 {
39  const unsigned int n = coupledComponents("v");
40  _vars.resize(n);
41  _v_vals.resize(n);
42  _v_vals_old.resize(n);
43 
44  for (unsigned int i = 0; i < n; ++i)
45  {
46  _vars[i] = coupled("v", i);
47  _v_vals[i] = &coupledValue("v", i);
48  _v_vals_old[i] = &coupledValueOld("v", i);
49  }
50 }
std::vector< unsigned int > _vars
Coupled primary species variable numbers.
std::vector< const VariableValue * > _v_vals
Coupled primary species concentrations.
const MaterialProperty< Real > & _porosity
Material property of porosity.
const Real _log_k
Equilibrium constant for the equilibrium species in association form.
const Real _sto_u
Stoichiometric coefficient of the primary species.
const std::vector< Real > _sto_v
Stoichiometric coefficients of the coupled primary species.
const VariableValue & _u_old
The old values of the primary species concentration.
std::vector< const VariableValue * > _v_vals_old
Coupled old values of primary species concentrations.
const Real _weight
Weight of the equilibrium species concentration in the total primary species concentration.

Member Function Documentation

Real CoupledBEEquilibriumSub::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 67 of file CoupledBEEquilibriumSub.C.

68 {
69  Real _val_new = std::pow(10.0, _log_k) * _sto_u * std::pow(_u[_qp], _sto_u - 1.0) * _phi[_j][_qp];
70  for (unsigned int i = 0; i < _v_vals.size(); ++i)
71  _val_new *= std::pow((*_v_vals[i])[_qp], _sto_v[i]);
72 
73  return _porosity[_qp] * _test[_i][_qp] * _weight * _val_new / _dt;
74 }
std::vector< const VariableValue * > _v_vals
Coupled primary species concentrations.
const MaterialProperty< Real > & _porosity
Material property of porosity.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const Real _log_k
Equilibrium constant for the equilibrium species in association form.
const Real _sto_u
Stoichiometric coefficient of the primary species.
const std::vector< Real > _sto_v
Stoichiometric coefficients of the coupled primary species.
const Real _weight
Weight of the equilibrium species concentration in the total primary species concentration.
Real CoupledBEEquilibriumSub::computeQpOffDiagJacobian ( unsigned int  jvar)
overrideprotectedvirtual

Definition at line 77 of file CoupledBEEquilibriumSub.C.

78 {
79  // If no coupled species, return 0
80  if (_v_vals.size() == 0)
81  return 0.0;
82 
83  // If jvar is not one of the coupled species, return 0
84  if (std::find(_vars.begin(), _vars.end(), jvar) == _vars.end())
85  return 0.0;
86 
87  Real _val_new = std::pow(10.0, _log_k) * std::pow(_u[_qp], _sto_u);
88 
89  for (unsigned int i = 0; i < _vars.size(); ++i)
90  {
91  if (jvar == _vars[i])
92  _val_new *= _sto_v[i] * std::pow((*_v_vals[i])[_qp], _sto_v[i] - 1.0) * _phi[_j][_qp];
93  else
94  _val_new *= std::pow((*_v_vals[i])[_qp], _sto_v[i]);
95  }
96 
97  return _porosity[_qp] * _test[_i][_qp] * _weight * _val_new / _dt;
98 }
std::vector< unsigned int > _vars
Coupled primary species variable numbers.
std::vector< const VariableValue * > _v_vals
Coupled primary species concentrations.
const MaterialProperty< Real > & _porosity
Material property of porosity.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const Real _log_k
Equilibrium constant for the equilibrium species in association form.
const Real _sto_u
Stoichiometric coefficient of the primary species.
const std::vector< Real > _sto_v
Stoichiometric coefficients of the coupled primary species.
const Real _weight
Weight of the equilibrium species concentration in the total primary species concentration.
Real CoupledBEEquilibriumSub::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 53 of file CoupledBEEquilibriumSub.C.

54 {
55  Real _val_new = std::pow(10.0, _log_k) * std::pow(_u[_qp], _sto_u);
56  Real _val_old = std::pow(10.0, _log_k) * std::pow(_u_old[_qp], _sto_u);
57  for (unsigned int i = 0; i < _v_vals.size(); ++i)
58  {
59  _val_new *= std::pow((*_v_vals[i])[_qp], _sto_v[i]);
60  _val_old *= std::pow((*_v_vals_old[i])[_qp], _sto_v[i]);
61  }
62 
63  return _porosity[_qp] * _weight * _test[_i][_qp] * (_val_new - _val_old) / _dt;
64 }
std::vector< const VariableValue * > _v_vals
Coupled primary species concentrations.
const MaterialProperty< Real > & _porosity
Material property of porosity.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const Real _log_k
Equilibrium constant for the equilibrium species in association form.
const Real _sto_u
Stoichiometric coefficient of the primary species.
const std::vector< Real > _sto_v
Stoichiometric coefficients of the coupled primary species.
const VariableValue & _u_old
The old values of the primary species concentration.
std::vector< const VariableValue * > _v_vals_old
Coupled old values of primary species concentrations.
const Real _weight
Weight of the equilibrium species concentration in the total primary species concentration.

Member Data Documentation

const Real CoupledBEEquilibriumSub::_log_k
private

Equilibrium constant for the equilibrium species in association form.

Definition at line 37 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

const MaterialProperty<Real>& CoupledBEEquilibriumSub::_porosity
private

Material property of porosity.

Definition at line 46 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

const Real CoupledBEEquilibriumSub::_sto_u
private

Stoichiometric coefficient of the primary species.

Definition at line 40 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

const std::vector<Real> CoupledBEEquilibriumSub::_sto_v
private

Stoichiometric coefficients of the coupled primary species.

Definition at line 43 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

const VariableValue& CoupledBEEquilibriumSub::_u_old
private

The old values of the primary species concentration.

Definition at line 58 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpResidual().

std::vector<const VariableValue *> CoupledBEEquilibriumSub::_v_vals
private

Coupled primary species concentrations.

Definition at line 52 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), computeQpResidual(), and CoupledBEEquilibriumSub().

std::vector<const VariableValue *> CoupledBEEquilibriumSub::_v_vals_old
private

Coupled old values of primary species concentrations.

Definition at line 55 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpResidual(), and CoupledBEEquilibriumSub().

std::vector<unsigned int> CoupledBEEquilibriumSub::_vars
private

Coupled primary species variable numbers.

Definition at line 49 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpOffDiagJacobian(), and CoupledBEEquilibriumSub().

const Real CoupledBEEquilibriumSub::_weight
private

Weight of the equilibrium species concentration in the total primary species concentration.

Definition at line 34 of file CoupledBEEquilibriumSub.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().


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