https://mooseframework.inl.gov
HeatConduction3EqnDGKernel.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 
12 registerMooseObject("ThermalHydraulicsApp", HeatConduction3EqnDGKernel);
13 
16 {
18 
19  params.addRequiredParam<MaterialPropertyName>("k", "Thermal conductivity");
20  params.addRequiredParam<MaterialPropertyName>("T", "Temperature");
21  params.addRequiredCoupledVar("A", "Cross-sectional area");
22  params.addRequiredParam<MaterialPropertyName>("direction", "Direction of the flow channel");
23 
24  params.addClassDescription("Adds heat conduction for the single-phase flow model.");
25 
26  return params;
27 }
28 
30  : ADDGKernel(parameters),
31  _k_elem(getADMaterialProperty<Real>("k")),
32  _k_neig(getNeighborADMaterialProperty<Real>("k")),
33  _T_elem(getADMaterialProperty<Real>("T")),
34  _T_neig(getNeighborADMaterialProperty<Real>("T")),
35  _A(adCoupledValue("A")),
36  _dir(getMaterialProperty<RealVectorValue>("direction"))
37 {
38 }
39 
40 ADReal
42 {
43  const ADReal k_avg = 0.5 * (_k_elem[_qp] + _k_neig[_qp]);
44 
45  const Point x_elem = _current_elem->vertex_average();
46  const Point x_neig = _neighbor_elem->vertex_average();
47  const Real dx = (x_neig - x_elem) * _dir[_qp];
48  const ADReal dTdx = (_T_neig[_qp] - _T_elem[_qp]) / dx;
49 
50  const ADReal flux = k_avg * dTdx * _A[_qp];
51 
52  return type == Moose::Element ? -flux * _test[_i][_qp] : flux * _test_neighbor[_i][_qp];
53 }
const ADMaterialProperty< Real > & _T_neig
Temperature for neighbor element.
static InputParameters validParams()
unsigned int _i
DGResidualType
static InputParameters validParams()
DualNumber< Real, DNDerivativeType, false > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
const MaterialProperty< RealVectorValue > & _dir
Flow channel direction.
const ADMaterialProperty< Real > & _T_elem
Temperature for current element.
const VariableTestValue & _test_neighbor
virtual ADReal computeQpResidual(Moose::DGResidualType type) override
const ADMaterialProperty< Real > & _k_elem
Thermal conductivity for current element.
const std::string & type() const
registerMooseObject("ThermalHydraulicsApp", HeatConduction3EqnDGKernel)
HeatConduction3EqnDGKernel(const InputParameters &parameters)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
Adds heat conduction for the single-phase flow model.
const ADMaterialProperty< Real > & _k_neig
Thermal conductivity for neighbor element.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
const Elem *const & _neighbor_elem
const ADVariableValue & _A
Cross-sectional area.
const VariableTestValue & _test