https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
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}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", HeatConduction3EqnDGKernel)
const VariableTestValue & _test_neighbor
static InputParameters validParams()
const VariableTestValue & _test
unsigned int _i
unsigned int _qp
const Elem *const & _current_elem
const Elem *const & _neighbor_elem
Adds heat conduction for the single-phase flow model.
const ADMaterialProperty< Real > & _T_elem
Temperature for current element.
virtual ADReal computeQpResidual(Moose::DGResidualType type) override
static InputParameters validParams()
const MaterialProperty< RealVectorValue > & _dir
Flow channel direction.
const ADMaterialProperty< Real > & _k_neig
Thermal conductivity for neighbor element.
const ADMaterialProperty< Real > & _k_elem
Thermal conductivity for current element.
HeatConduction3EqnDGKernel(const InputParameters &parameters)
const ADVariableValue & _A
Cross-sectional area.
const ADMaterialProperty< Real > & _T_neig
Temperature for neighbor element.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const std::string & type() const
DGResidualType