www.mooseframework.org
CoupledBEKinetic.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "CoupledBEKinetic.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addRequiredParam<std::vector<Real>>("weight",
15  "The weight of kinetic species concentration");
16  params.addCoupledVar("v", "List of kinetic species being coupled by concentration");
17  params.addClassDescription("Derivative of kinetic species concentration wrt time");
18  return params;
19 }
20 
21 CoupledBEKinetic::CoupledBEKinetic(const InputParameters & parameters)
22  : Kernel(parameters),
23  _porosity(getMaterialProperty<Real>("porosity")),
24  _weight(getParam<std::vector<Real>>("weight"))
25 {
26  const unsigned int n = coupledComponents("v");
27  _vals.resize(n);
28  _vals_old.resize(n);
29 
30  for (unsigned int i = 0; i < n; ++i)
31  {
32  _vals[i] = &coupledValue("v", i);
33  _vals_old[i] = &coupledValueOld("v", i);
34  }
35 }
36 
37 Real
39 {
40  Real assemble_conc = 0.0;
41  for (unsigned int i = 0; i < _vals.size(); ++i)
42  assemble_conc += _weight[i] * ((*_vals[i])[_qp] - (*_vals_old[i])[_qp]) / _dt;
43 
44  return _porosity[_qp] * _test[_i][_qp] * assemble_conc;
45 }
CoupledBEKinetic(const InputParameters &parameters)
virtual Real computeQpResidual() override
std::vector< const VariableValue * > _vals
Coupled kinetic mineral concentrations.
const std::vector< Real > _weight
Weight of the kinetic mineral concentration in the total primary species concentration.
InputParameters validParams< CoupledBEKinetic >()
const MaterialProperty< Real > & _porosity
Material property of porosity.
std::vector< const VariableValue * > _vals_old
Coupled old values of kinetic mineral concentrations.