https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SoretDiffusion.C
Go to the documentation of this file.
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 "SoretDiffusion.h"
11
12// MOOSE includes
13#include "MooseVariable.h"
14
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
45Real
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
52Real
57
58Real
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
74Real
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]) *
80}
registerMooseObject("PhaseFieldApp", SoretDiffusion)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
MooseVariable & _var
const VariablePhiValue & _phi
static InputParameters validParams()
const VariablePhiGradient & _grad_phi
const VariableTestGradient & _grad_test
unsigned int number() const
SoretDiffusion adds the soret effect in the split form of the Cahn-Hilliard equation.
unsigned int _T_var
int label for temperature variable
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const VariableValue & _T
Coupled variable for the temperature.
virtual Real computeQpResidual()
const MaterialProperty< Real > & _D
Diffusivity material property.
static InputParameters validParams()
const MaterialProperty< Real > & _Q
Heat of transport material property.
virtual Real computeQpCJacobian()
const VariableValue & _c
Variable value for the concentration.
const VariableGradient & _grad_T
Variable gradient for temperature.
SoretDiffusion(const InputParameters &parameters)
const Real _kB
Boltzmann constant.
unsigned int _c_var
int label for the Concentration
virtual Real computeQpJacobian()
const bool _is_coupled
is the kernel used in a coupled form?