https://mooseframework.inl.gov
SideSetHeatTransferKernel.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 
11 
13 
16 {
18  params.addClassDescription(
19  "Modeling conduction, convection, and radiation across internal side set.");
20  params.addParam<MaterialPropertyName>("conductance",
21  "gap_conductance",
22  "Conductivity of gap divided by effective gap width,"
23  "conductance ignored if not provided");
24  params.addCoupledVar("Tbulk_var", "Bulk temperature of gap as variable");
25  params.addParam<MaterialPropertyName>(
26  "Tbulk_mat", "gap_Tbulk", "Bulk temperature of gap as material property");
27  params.addParam<MaterialPropertyName>(
28  "h_primary",
29  "gap_h_primary",
30  "Convective heat transfer coefficient (primary face), convection ignored if not provided");
31  params.addParam<MaterialPropertyName>(
32  "h_neighbor",
33  "gap_h_neighbor",
34  "Convective heat transfer coefficient (neighbor face), convection ignored if not provided");
35  params.addParam<MaterialPropertyName>(
36  "emissivity_eff_primary",
37  "gap_emissivity_eff_primary",
38  "Effective emmissivity of primary face, radiation ignored if not provided. "
39  "This value contains contributions from reflectivity, see SideSetHeatTransferMaterial "
40  "for details.");
41  params.addParam<MaterialPropertyName>(
42  "emissivity_eff_neighbor",
43  "gap_emissivity_eff_neighbor",
44  "Effective emmissivity of neighbor face, radiation ignored if not provided. "
45  "This value contains contributions from reflectivity, see SideSetHeatTransferMaterial "
46  "for details.");
47  return params;
48 }
49 
51  : InterfaceKernel(parameters),
52  _cond(getMaterialProperty<Real>("conductance")),
53  _Tbulk_var(isParamValid("Tbulk_var") ? &coupledValue("Tbulk_var") : nullptr),
54  _Tbulk_mat(_Tbulk_var ? nullptr : &getMaterialProperty<Real>("Tbulk_mat")),
55  _hp(getMaterialProperty<Real>("h_primary")),
56  _hm(getMaterialProperty<Real>("h_neighbor")),
57  _eps_p(getMaterialProperty<Real>("emissivity_eff_primary")),
58  _eps_m(getMaterialProperty<Real>("emissivity_eff_neighbor"))
59 {
60  if (parameters.isParamSetByUser("Tbulk_mat") && _Tbulk_var)
61  paramError("Tbulk_var", "Both Tbulk_mat and Tbulk_var set by user, cannot use both.");
62 
63  if (_var.number() == _neighbor_var.number() && _var.isNodal())
64  mooseError(
65  "Variable and neighbor variable are the same, but they are not elemental variables.");
66 }
67 
68 Real
70 {
71  Real r = 0;
72 
73  if (_cond[_qp] != 0.0) // Conduction
74  {
75  Real jump = _u[_qp] - _neighbor_value[_qp];
76  switch (type)
77  {
78  case Moose::Element:
79  r += _cond[_qp] * jump * _test[_i][_qp];
80  break;
81 
82  case Moose::Neighbor:
83  r -= _cond[_qp] * jump * _test_neighbor[_i][_qp];
84  break;
85  }
86  }
87 
88  if (_hp[_qp] != 0.0 && _hm[_qp] != 0.0) // Convection
89  {
90  Real Tb = (_Tbulk_var ? (*_Tbulk_var)[_qp] : (*_Tbulk_mat)[_qp]);
91  switch (type)
92  {
93  case Moose::Element:
94  r += _hp[_qp] * (_u[_qp] - Tb) * _test[_i][_qp];
95  break;
96 
97  case Moose::Neighbor:
98  r += _hm[_qp] * (_neighbor_value[_qp] - Tb) * _test_neighbor[_i][_qp];
99  break;
100  }
101  }
102 
103  if (_eps_p[_qp] != 0.0 && _eps_m[_qp] != 0.0) // Radiation
104  {
105  Real Rp = _eps_p[_qp] * (_u[_qp] * _u[_qp] * _u[_qp] * _u[_qp]);
108  switch (type)
109  {
110  case Moose::Element:
111  r += (Rp - Rm) * _test[_i][_qp];
112  break;
113 
114  case Moose::Neighbor:
115  r += (Rm - Rp) * _test_neighbor[_i][_qp];
116  break;
117  }
118  }
119 
120  return r;
121 }
122 
123 Real
125 {
126  Real jac = 0;
127 
128  if (_cond[_qp] != 0.0) // Conduction
129  {
130  switch (type)
131  {
133  jac += _cond[_qp] * _phi[_j][_qp] * _test[_i][_qp];
134  break;
135 
137  jac += _cond[_qp] * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
138  break;
139 
141  jac -= _cond[_qp] * _phi_neighbor[_j][_qp] * _test[_i][_qp];
142  break;
143 
145  jac -= _cond[_qp] * _phi[_j][_qp] * _test_neighbor[_i][_qp];
146  break;
147  }
148  }
149 
150  if (_hp[_qp] != 0.0 && _hm[_qp] != 0.0) // Convection
151  {
152  switch (type)
153  {
155  jac += _hp[_qp] * _phi[_j][_qp] * _test[_i][_qp];
156  break;
157 
159  jac += _hm[_qp] * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
160  break;
161 
164  break;
165  }
166  }
167 
168  if (_eps_p[_qp] != 0.0 && _eps_m[_qp] != 0.0) // Radiation
169  {
170  switch (type)
171  {
173  jac += 4.0 * _eps_p[_qp] * (_u[_qp] * _u[_qp] * _u[_qp]) * _phi[_j][_qp] * _test[_i][_qp];
174  break;
175 
177  jac += 4.0 * _eps_m[_qp] *
180  break;
181 
183  jac -= 4.0 * _eps_m[_qp] *
185  _phi_neighbor[_j][_qp] * _test[_i][_qp];
186  break;
187 
189  jac -= 4.0 * _eps_p[_qp] * (_u[_qp] * _u[_qp] * _u[_qp]) * _phi[_j][_qp] *
191  break;
192  }
193  }
194 
195  return jac;
196 }
NeighborElement
const TemplateVariableValue & _neighbor_value
const VariableValue *const _Tbulk_var
Bulk temperature of gap.
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 TemplateVariableValue & _u
const MaterialProperty< Real > & _hp
Convective heat transfer coefficient (primary face)
const TemplateVariablePhiValue & _phi
const MaterialProperty< Real > & _eps_m
Neighbor face effective emissivity ^-(1-^+)/(1-^+^-)
DGResidualType
ElementElement
const MooseVariableFE< T > & _neighbor_var
DG kernel for interfacing diffusion between two variables on adjacent blocks.
ElementNeighbor
const MaterialProperty< Real > & _cond
Conductivity of gap divided by effective gap width.
const std::string & type() const
void paramError(const std::string &param, Args... args) const
const TemplateVariableTestValue & _test
void addCoupledVar(const std::string &name, const std::string &doc_string)
bool isNodal() const override
DGJacobianType
bool isParamSetByUser(const std::string &name) const
virtual Real computeQpResidual(Moose::DGResidualType type) override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
const MaterialProperty< Real > & _eps_p
Master face effective emissivity ^+(1-^-)/(1-^+^-)
registerMooseObject("HeatTransferApp", SideSetHeatTransferKernel)
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const InputParameters & parameters() const
MooseVariableFE< T > & _var
const MaterialProperty< Real > & _hm
Convective heat transfer coefficient (neighbor face)
const TemplateVariableTestValue & _test_neighbor
NeighborNeighbor
const TemplateVariablePhiValue & _phi_neighbor
static InputParameters validParams()
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
SideSetHeatTransferKernel(const InputParameters &parameters)