www.mooseframework.org
ThermoDiffusion.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 "ThermoDiffusion.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addRequiredCoupledVar("temp", "Coupled temperature");
15  params.addParam<Real>("gas_constant", 8.3144621, "Gas constant");
16  params.addParam<std::string>(
17  "heat_of_transport", "heat_of_transport", "Property name for the heat of transport.");
18  params.addParam<std::string>(
19  "mass_diffusivity", "mass_diffusivity", "Property name for the diffusivity.");
20 
21  params.addClassDescription("Kernel for thermo-diffusion (Soret effect, thermophoresis, etc.)");
22  return params;
23 }
24 
25 ThermoDiffusion::ThermoDiffusion(const InputParameters & parameters)
26  : Kernel(parameters),
27  _temperature(coupledValue("temp")),
28  _grad_temperature(coupledGradient("temp")),
29  _mass_diffusivity(getMaterialProperty<Real>(getParam<std::string>("mass_diffusivity"))),
30  _heat_of_transport(getMaterialProperty<Real>(getParam<std::string>("heat_of_transport"))),
31  _gas_constant(getParam<Real>("gas_constant")),
32  _temperature_index(coupled("temp"))
33 {
34 }
35 
36 RealGradient
38 {
39  // The thermo-diffusion term looks like grad( v * C ) where v is like a diffusive
40  // velocity. If the concentration C does not couple back into the heat equation,
41  // then the one-way coupling of temperature means that thermo-diffusion of C
42  // behaves like advection. Then v is the velocity:
43  //
44  // v = D Qstar grad(T) / ( R T^2 )
45  //
46  Real coeff = _mass_diffusivity[_qp] * _heat_of_transport[_qp] /
47  (_gas_constant * _temperature[_qp] * _temperature[_qp]);
48  return coeff * _grad_temperature[_qp];
49 }
50 
51 Real
53 {
54  return thermoDiffusionVelocity() * _u[_qp] * _grad_test[_i][_qp];
55 }
56 
57 Real
59 {
60  return thermoDiffusionVelocity() * _phi[_j][_qp] * _grad_test[_i][_qp];
61 }
62 
63 Real
65 {
66  if (jvar == _temperature_index)
67  {
68  Real coeff = _mass_diffusivity[_qp] * _heat_of_transport[_qp] /
69  (_gas_constant * _temperature[_qp] * _temperature[_qp]);
70  return coeff * _grad_test[_i][_qp] * _u[_qp] *
71  (_grad_phi[_j][_qp] - 2 * _phi[_j][_qp] * _grad_temperature[_qp] / _temperature[_qp]);
72  }
73  return 0;
74 }
const VariableGradient & _grad_temperature
RealGradient thermoDiffusionVelocity() const
const MaterialProperty< Real > & _heat_of_transport
virtual Real computeQpJacobian()
const MaterialProperty< Real > & _mass_diffusivity
virtual Real computeQpResidual()
const Real _gas_constant
const VariableValue & _temperature
ThermoDiffusion(const InputParameters &parameters)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Computes contribution from grad( T ) / T^2 term.
const unsigned int _temperature_index
InputParameters validParams< ThermoDiffusion >()