www.mooseframework.org
SoretDiffusion.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 "SoretDiffusion.h"
8 
9 // MOOSE includes
10 #include "MooseVariable.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<Kernel>();
17  params.addClassDescription("Add Soret effect to Split formulation Cahn-Hilliard Kernel");
18  params.addRequiredCoupledVar("T", "Temperature");
19  params.addCoupledVar("c", "Concentration");
20  params.addRequiredParam<MaterialPropertyName>("diff_name",
21  "The diffusivity used with the kernel");
22  params.addParam<MaterialPropertyName>(
23  "Q_name", "Qheat", "The material name for the heat of transport");
24  return params;
25 }
26 
27 SoretDiffusion::SoretDiffusion(const InputParameters & parameters)
28  : Kernel(parameters),
29  _T_var(coupled("T")),
30  _T(coupledValue("T")),
31  _grad_T(coupledGradient("T")),
32  _is_coupled(isCoupled("c")),
33  _c_var(_is_coupled ? coupled("c") : _var.number()),
34  _c(_is_coupled ? coupledValue("c") : _u),
35  _D(getMaterialProperty<Real>("diff_name")),
36  _Q(getMaterialProperty<Real>("Q_name")),
37  _kB(8.617343e-5) // Boltzmann constant in eV/K
38 {
39 }
40 
41 Real
43 {
44  const Real T_term = _D[_qp] * _Q[_qp] * _c[_qp] / (_kB * _T[_qp] * _T[_qp]);
45  return T_term * _grad_T[_qp] * _grad_test[_i][_qp];
46 }
47 
48 Real
50 {
51  return _is_coupled ? 0.0 : computeQpCJacobian();
52 }
53 
54 Real
56 {
57  // c Off-Diagonal Jacobian
58  if (_c_var == jvar)
59  return computeQpCJacobian();
60 
61  // T Off-Diagonal Jacobian
62  if (_T_var == jvar)
63  return _D[_qp] * _Q[_qp] * _c[_qp] * _grad_test[_i][_qp] *
64  (_grad_phi[_j][_qp] - 2.0 * _grad_T[_qp] * _phi[_j][_qp] / _T[_qp]) /
65  (_kB * _T[_qp] * _T[_qp]);
66 
67  return 0.0;
68 }
69 
70 Real
72 {
73  // Calculate the Jacobian for the c variable
74  return _D[_qp] * _Q[_qp] * _phi[_j][_qp] * _grad_T[_qp] / (_kB * _T[_qp] * _T[_qp]) *
75  _grad_test[_i][_qp];
76 }
InputParameters validParams< SoretDiffusion >()
const MaterialProperty< Real > & _D
Diffusivity material property.
SoretDiffusion(const InputParameters &parameters)
const Real _kB
Boltzmann constant.
const VariableGradient & _grad_T
Variable gradient for temperature.
const MaterialProperty< Real > & _Q
Heat of transport material property.
const VariableValue & _c
Variable value for the concentration.
unsigned int _c_var
int label for the Concentration
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
const VariableValue & _T
Coupled variable for the temperature.
const bool _is_coupled
is the kernel used in a coupled form?
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
virtual Real computeQpCJacobian()
unsigned int _T_var
int label for temperature variable