Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "ThermoDiffusion.h" 11 : 12 : registerMooseObject("MiscApp", ThermoDiffusion); 13 : 14 : InputParameters 15 38 : ThermoDiffusion::validParams() 16 : { 17 38 : InputParameters params = Kernel::validParams(); 18 76 : params.addRequiredCoupledVar("temp", "Coupled temperature"); 19 76 : params.addParam<Real>("gas_constant", 8.3144621, "Gas constant"); 20 76 : params.addParam<std::string>( 21 : "heat_of_transport", "heat_of_transport", "Property name for the heat of transport."); 22 76 : params.addParam<std::string>( 23 : "mass_diffusivity", "mass_diffusivity", "Property name for the diffusivity."); 24 : 25 38 : params.addClassDescription("Kernel for thermo-diffusion (Soret effect, thermophoresis, etc.)"); 26 38 : return params; 27 0 : } 28 : 29 20 : ThermoDiffusion::ThermoDiffusion(const InputParameters & parameters) 30 : : Kernel(parameters), 31 20 : _temperature(coupledValue("temp")), 32 20 : _grad_temperature(coupledGradient("temp")), 33 40 : _mass_diffusivity(getMaterialProperty<Real>(getParam<std::string>("mass_diffusivity"))), 34 40 : _heat_of_transport(getMaterialProperty<Real>(getParam<std::string>("heat_of_transport"))), 35 40 : _gas_constant(getParam<Real>("gas_constant")), 36 40 : _temperature_index(coupled("temp")) 37 : { 38 20 : } 39 : 40 : RealGradient 41 130800 : ThermoDiffusion::thermoDiffusionVelocity() const 42 : { 43 : // The thermo-diffusion term looks like grad( v * C ) where v is like a diffusive 44 : // velocity. If the concentration C does not couple back into the heat equation, 45 : // then the one-way coupling of temperature means that thermo-diffusion of C 46 : // behaves like advection. Then v is the velocity: 47 : // 48 : // v = D Qstar grad(T) / ( R T^2 ) 49 : // 50 130800 : Real coeff = _mass_diffusivity[_qp] * _heat_of_transport[_qp] / 51 130800 : (_gas_constant * _temperature[_qp] * _temperature[_qp]); 52 130800 : return coeff * _grad_temperature[_qp]; 53 : } 54 : 55 : Real 56 105200 : ThermoDiffusion::computeQpResidual() 57 : { 58 105200 : return thermoDiffusionVelocity() * _u[_qp] * _grad_test[_i][_qp]; 59 : } 60 : 61 : Real 62 25600 : ThermoDiffusion::computeQpJacobian() 63 : { 64 25600 : return thermoDiffusionVelocity() * _phi[_j][_qp] * _grad_test[_i][_qp]; 65 : } 66 : 67 : Real 68 0 : ThermoDiffusion::computeQpOffDiagJacobian(unsigned int jvar) 69 : { 70 0 : if (jvar == _temperature_index) 71 : { 72 0 : Real coeff = _mass_diffusivity[_qp] * _heat_of_transport[_qp] / 73 0 : (_gas_constant * _temperature[_qp] * _temperature[_qp]); 74 0 : return coeff * _grad_test[_i][_qp] * _u[_qp] * 75 0 : (_grad_phi[_j][_qp] - 2 * _phi[_j][_qp] * _grad_temperature[_qp] / _temperature[_qp]); 76 : } 77 : return 0; 78 : }