www.mooseframework.org
CHSplitFlux.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 "CHSplitFlux.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addClassDescription("Computes flux $j$ as nodal variable $j = -M\\nabla\\mu$");
15  params.addRequiredParam<unsigned int>("component", "Flux component");
16  params.addRequiredParam<MaterialPropertyName>("mobility_name", "Mobility property name");
17  params.addRequiredCoupledVar("mu", "Chemical Potential");
18  params.addCoupledVar("c", "Concentration");
19  return params;
20 }
21 
22 CHSplitFlux::CHSplitFlux(const InputParameters & parameters)
23  : DerivativeMaterialInterface<Kernel>(parameters),
24  _component(getParam<unsigned int>("component")),
25  _mu_var(coupled("mu")),
26  _grad_mu(coupledGradient("mu")),
27  _mobility(getMaterialProperty<RealTensorValue>("mobility_name")),
28  _has_coupled_c(isCoupled("c")),
29  _c_var(_has_coupled_c ? coupled("c") : 0),
30  _dmobility_dc(_has_coupled_c
31  ? &getMaterialPropertyDerivative<RealTensorValue>("mobility_name",
32  getVar("c", 0)->name())
33  : NULL)
34 {
35 }
36 
37 Real
39 {
40  return _test[_i][_qp] * (_u[_qp] + _mobility[_qp].row(_component) * _grad_mu[_qp]);
41 }
42 
43 Real
45 {
46  return _test[_i][_qp] * _phi[_j][_qp];
47 }
48 
49 Real
51 {
52  if (jvar == _mu_var)
53  return _test[_i][_qp] * _mobility[_qp].row(_component) * _grad_phi[_j][_qp];
54  else if (_has_coupled_c && jvar == _c_var)
55  return _test[_i][_qp] * (*_dmobility_dc)[_qp].row(_component) * _grad_mu[_qp] * _phi[_j][_qp];
56  else
57  return 0.0;
58 }
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: CHSplitFlux.C:50
const unsigned int _component
Definition: CHSplitFlux.h:34
const VariableGradient & _grad_mu
Definition: CHSplitFlux.h:36
const bool _has_coupled_c
Definition: CHSplitFlux.h:39
virtual Real computeQpResidual()
Definition: CHSplitFlux.C:38
virtual Real computeQpJacobian()
Definition: CHSplitFlux.C:44
CHSplitFlux(const InputParameters &parameters)
Definition: CHSplitFlux.C:22
const MaterialProperty< RealTensorValue > & _mobility
Definition: CHSplitFlux.h:37
const unsigned int _mu_var
Definition: CHSplitFlux.h:35
const unsigned int _c_var
Definition: CHSplitFlux.h:40
InputParameters validParams< CHSplitFlux >()
Definition: CHSplitFlux.C:11