www.mooseframework.org
SoretDiffusion.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "SoretDiffusion.h"
11 
12 // MOOSE includes
13 #include "MooseVariable.h"
14 
15 registerMooseObject("PhaseFieldApp", SoretDiffusion);
16 
19 {
21  params.addClassDescription("Add Soret effect to Split formulation Cahn-Hilliard Kernel");
22  params.addRequiredCoupledVar("T", "Temperature");
23  params.addCoupledVar("c", "Concentration");
24  params.addRequiredParam<MaterialPropertyName>("diff_name",
25  "The diffusivity used with the kernel");
26  params.addParam<MaterialPropertyName>(
27  "Q_name", "Qheat", "The material name for the heat of transport");
28  return params;
29 }
30 
32  : Kernel(parameters),
33  _T_var(coupled("T")),
34  _T(coupledValue("T")),
35  _grad_T(coupledGradient("T")),
36  _is_coupled(isCoupled("c")),
37  _c_var(_is_coupled ? coupled("c") : _var.number()),
38  _c(_is_coupled ? coupledValue("c") : _u),
39  _D(getMaterialProperty<Real>("diff_name")),
40  _Q(getMaterialProperty<Real>("Q_name")),
41  _kB(8.617343e-5) // Boltzmann constant in eV/K
42 {
43 }
44 
45 Real
47 {
48  const Real T_term = _D[_qp] * _Q[_qp] * _c[_qp] / (_kB * _T[_qp] * _T[_qp]);
49  return T_term * _grad_T[_qp] * _grad_test[_i][_qp];
50 }
51 
52 Real
54 {
55  return (_is_coupled && _c_var != _var.number()) ? 0.0 : computeQpCJacobian();
56 }
57 
58 Real
60 {
61  // c Off-Diagonal Jacobian
62  if (_c_var == jvar)
63  return computeQpCJacobian();
64 
65  // T Off-Diagonal Jacobian
66  if (_T_var == jvar)
67  return _D[_qp] * _Q[_qp] * _c[_qp] * _grad_test[_i][_qp] *
68  (_grad_phi[_j][_qp] - 2.0 * _grad_T[_qp] * _phi[_j][_qp] / _T[_qp]) /
69  (_kB * _T[_qp] * _T[_qp]);
70 
71  return 0.0;
72 }
73 
74 Real
76 {
77  // Calculate the Jacobian for the c variable
78  return _D[_qp] * _Q[_qp] * _phi[_j][_qp] * _grad_T[_qp] / (_kB * _T[_qp] * _T[_qp]) *
79  _grad_test[_i][_qp];
80 }
static InputParameters validParams()
static InputParameters validParams()
MooseVariable & _var
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int number() const
const VariablePhiGradient & _grad_phi
SoretDiffusion adds the soret effect in the split form of the Cahn-Hilliard equation.
void addRequiredParam(const std::string &name, const std::string &doc_string)
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.
unsigned int _i
const VariableValue & _c
Variable value for the concentration.
unsigned int _c_var
int label for the Concentration
virtual Real computeQpResidual()
virtual Real computeQpJacobian()
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _j
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("PhaseFieldApp", SoretDiffusion)
const VariableTestGradient & _grad_test
const VariableValue & _T
Coupled variable for the temperature.
void addClassDescription(const std::string &doc_string)
const VariablePhiValue & _phi
const bool _is_coupled
is the kernel used in a coupled form?
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
unsigned int _qp
virtual Real computeQpCJacobian()
unsigned int _T_var
int label for temperature variable