https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADPipeWallTemperatureScalarKernelBase.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#include "ScalarCoupleable.h"
14
17{
21 "Base class for assembling transport equation for the temperature of a radial node of a pipe "
22 "wall, with axial "
23 "conduction to the upstream/downstream nodes of the same radial layer and radial "
24 "conduction to the node on the other side of the wall.");
25 params.addCoupledVar("upstream_wall_temperature",
26 {},
27 "Wall temperature of the upstream node, same radial layer. Takes a "
28 "scalar variable name");
29 params.addCoupledVar("downstream_wall_temperature",
30 {},
31 "Wall temperature of the downstream node, same radial layer. Takes "
32 "a scalar variable name");
33 params.addParam<bool>(
34 "is_implicit",
35 false,
36 "Whether an explicit (previous value calculation) or implicit (current value) is used");
37 params.addRequiredParam<UserObjectName>("solid_properties",
38 "The name of the user object for solid properties");
39 params.addRequiredParam<MooseFunctorName>("area",
40 "Cross-sectional area of this wall layer [m^2]");
41 params.addRequiredParam<MooseFunctorName>(
42 "interface_perimeter",
43 "Perimeter of the interface between the inner and outer wall nodes [m]");
44 params.addRequiredParam<MooseFunctorName>(
45 "wall_thickness",
46 "Radial conduction-path distance between the inner and outer wall nodes [m]");
47 params.addRequiredParam<MooseFunctorName>("length",
48 "Axial length of this node's control volume [m]");
49 params.addRequiredParam<MooseFunctorName>(
50 "upstream_spacing", "Axial distance from this node to the upstream node [m]");
51 params.addRequiredParam<MooseFunctorName>(
52 "downstream_spacing", "Axial distance from this node to the downstream node [m]");
53 params.addRequiredParam<MooseFunctorName>(
54 "upstream_area", "Cross-sectional area of the upstream node's wall layer [m^2]");
55 params.addRequiredParam<MooseFunctorName>(
56 "downstream_area", "Cross-sectional area of the downstream node's wall layer [m^2]");
57
58 return params;
59}
60
62 const InputParameters & parameters)
63 : Base(parameters),
64 _sp(this->template getUserObject<ThermalSolidProperties>("solid_properties")),
65 _Tup(ScalarCoupleable::adCoupledScalarValue("upstream_wall_temperature")),
66 _Tdown(ScalarCoupleable::adCoupledScalarValue("downstream_wall_temperature")),
67 _is_implicit(this->template getParam<bool>("is_implicit")),
68 _area(this->template getFunctor<ADReal>("area")),
69 _interface_perimeter(this->template getFunctor<ADReal>("interface_perimeter")),
70 _wall_thickness(this->template getFunctor<ADReal>("wall_thickness")),
71 _length(this->template getFunctor<ADReal>("length")),
72 _upstream_spacing(this->template getFunctor<ADReal>("upstream_spacing")),
73 _downstream_spacing(this->template getFunctor<ADReal>("downstream_spacing")),
74 _upstream_area(this->template getFunctor<ADReal>("upstream_area")),
75 _downstream_area(this->template getFunctor<ADReal>("downstream_area"))
76{
77}
78
81{
82 const Moose::PointArg arg = {Point(1, 2, 3)};
83 const int i = 0;
84 const auto state = _is_implicit ? Moose::currentState() : Moose::oldState();
85
86 const auto A = _area(arg, state);
87 const auto k = _sp.k_from_T(Base::_u[i]);
88 const auto cp = _sp.cp_from_T(Base::_u[i]);
89 const auto rho = _sp.rho_from_T(Base::_u[i]);
90
91 // Neighbor wall-layer cross-sectional areas and conductivities, used below to build a
92 // harmonic-mean face conductance for axial conduction between control volumes whose
93 // cross-section may differ (two half-length resistances in series)
94 const auto A_up = _upstream_area(arg, state);
95 const auto k_up = _sp.k_from_T(_Tup[i]);
96 const auto A_down = _downstream_area(arg, state);
97 const auto k_down = _sp.k_from_T(_Tdown[i]);
98
99 const auto G_up = 1.0 / (_upstream_spacing(arg, state) / (2.0 * k * A) +
100 _upstream_spacing(arg, state) / (2.0 * k_up * A_up));
101 const auto G_down = 1.0 / (_downstream_spacing(arg, state) / (2.0 * k * A) +
102 _downstream_spacing(arg, state) / (2.0 * k_down * A_down));
103
104 // Radial conduction from the node on the other side of this layer
105 const auto q_radial = k * _interface_perimeter(arg, state) *
106 (otherNodeTemperature() - Base::_u[i]) / _wall_thickness(arg, state);
107 // Axial conduction from the upstream/downstream nodes of this layer
108 const auto q_axial =
109 (G_up * (_Tup[i] - Base::_u[i]) + G_down * (_Tdown[i] - Base::_u[i])) / _length(arg, state);
110 // Heat exchanged with the fluid or ambient environment on this node's non-radial side
111 const auto q_convective = convectiveLinearHeatRate();
112
113 return -(q_radial + q_axial + q_convective) / (rho * cp * A);
114}
115
116Real
118{
119 mooseError("computeQpJacobian() should not be called in AD mode");
120 return 0;
121}
DualNumber< Real, DNDerivativeType, true > ADReal
const double rho
static InputParameters validParams()
const ADVariableValue & _Tdown
Coupled wall temperature of the downstream node (same radial layer)
virtual ADReal otherNodeTemperature() const =0
Temperature of the wall node on the other side of this layer's radial conduction path.
const Moose::Functor< ADReal > & _length
Axial length of this node's control volume.
virtual ADReal convectiveLinearHeatRate() const =0
Heat flux exchanged with the fluid or ambient environment on this node's interface to the fluid/envir...
const ThermalSolidProperties & _sp
Solid properties object for the pipe wall.
const Moose::Functor< ADReal > & _upstream_area
Cross-sectional area of the upstream node's wall layer.
const Moose::Functor< ADReal > & _downstream_spacing
Axial distance from this node to the downstream node.
const Moose::Functor< ADReal > & _interface_perimeter
Perimeter of the interface between the inner and outer wall nodes.
const Moose::Functor< ADReal > & _wall_thickness
Radial conduction-path distance between the inner and outer wall nodes.
const Moose::Functor< ADReal > & _downstream_area
Cross-sectional area of the downstream node's wall layer.
const bool _is_implicit
Property state integration flag.
const ADVariableValue & _Tup
Coupled wall temperature of the upstream node (same radial layer)
const Moose::Functor< ADReal > & _area
Cross-sectional area of this wall layer.
const Moose::Functor< ADReal > & _upstream_spacing
Axial distance from this node to the upstream node.
ADPipeWallTemperatureScalarKernelBase(const InputParameters &parameters)
const ADVariableValue & _u
static InputParameters validParams()
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)
void mooseError(Args &&... args) const
Common class for solid properties that are a function of temperature.
StateArg oldState()
StateArg currentState()