https://mooseframework.inl.gov
LinearFVConvectiveHeatTransferBC.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 #include "NS.h"
12 
14 
17 {
19  params.addRequiredParam<MooseFunctorName>(NS::T_fluid, "The fluid temperature variable");
20  params.addRequiredParam<MooseFunctorName>(NS::T_solid, "The solid/wall temperature variable");
21  params.addRequiredParam<MooseFunctorName>("h", "The convective heat transfer coefficient");
22  params.addClassDescription("Class describing a convective heat transfer between two domains.");
23  return params;
24 }
25 
27  const InputParameters & parameters)
28  : LinearFVAdvectionDiffusionBC(parameters),
29  _temp_fluid(getFunctor<Real>(NS::T_fluid)),
30  _temp_solid(getFunctor<Real>(NS::T_solid)),
31  _htc(getFunctor<Real>("h")),
32  _var_is_fluid("wraps_" + _var.name() == _temp_fluid.functorName() ||
33  "wraps_" + _var.name() + "_raw_value" == _temp_fluid.functorName())
34 {
35  // We determine which one is the source variable
36  if (_var_is_fluid)
38  else
40 }
41 
42 Real
44 {
45  const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM)
48 
49  return _var.getElemValue(*elem_info, determineState());
50 }
51 
52 Real
54 {
55  const auto face = singleSidedFaceArg(_current_face_info);
56  const auto state = determineState();
57 
58  const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM)
61 
62  const auto neighbor_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM)
65 
66  const auto fluid_side_elem_info = _var_is_fluid ? elem_info : neighbor_info;
67 
68  // All this fuss is just for cases when we have an internal boundary, then the flux will change
69  // signs depending on which side of the face we are at.
70  const auto multiplier = _current_face_info->normal() * (_current_face_info->faceCentroid() -
71  fluid_side_elem_info->centroid()) >
72  0
73  ? 1
74  : -1;
75 
76  return multiplier * _htc(face, state) * (_temp_fluid(face, state) - _temp_solid(face, state));
77 }
78 
79 Real
81 {
82  // We approximate the face value with the cell value here.
83  // TODO: we can extend this to a 2-term expansion at some point when the need arises.
84  return 1.0;
85 }
86 
87 Real
89 {
90  // We approximate the face value with the cell value, we
91  // don't need to add anything to the right hand side.
92  // TODO: we can extend this to a 2-term expansion at some point when the need arises.
93  return 0.0;
94 }
95 
96 Real
98 {
99  const auto face = singleSidedFaceArg(_current_face_info);
100  const auto state = determineState();
101 
102  // We just put the heat transfer coefficient on the diagonal (multiplication with the
103  // surface area is taken care of in the kernel).
104  return _htc(face, state);
105 }
106 
107 Real
109 {
110  const auto state = determineState();
112 
113  // We check where the functor contributing to the right hand side lives. We do this
114  // because this functor lives on the domain where the variable of this kernel doesn't.
115  if (_rhs_temperature->hasFaceSide(*_current_face_info, true))
116  face.face_side = _current_face_info->elemPtr();
117  else
118  face.face_side = _current_face_info->neighborPtr();
119 
120  return _htc(face, state) * (*_rhs_temperature)(face, state);
121 }
const Moose::Functor< Real > & _temp_solid
The solid/wall temperature, we use the functor form to enable situations when the user wants to suppl...
LinearFVConvectiveHeatTransferBC(const InputParameters &parameters)
Class constructor.
static const std::string T_solid
Definition: NS.h:107
virtual Real computeBoundaryValueRHSContribution() const override
Moose::StateArg determineState() const
const Moose::Functor< Real > * _rhs_temperature
The temperature which will contribute to the right hand side.
const ElemInfo * neighborInfo() const
const Point & faceCentroid() const
const ElemInfo * elemInfo() const
virtual Real computeBoundaryValue() const override
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeBoundaryGradientMatrixContribution() const override
const Elem * neighborPtr() const
static const std::string T_fluid
Definition: NS.h:106
virtual Real computeBoundaryNormalGradient() const override
const std::string name
Definition: Setup.h:20
FaceInfo::VarFaceNeighbors _current_face_type
const Point & normal() const
MooseLinearVariableFV< Real > & _var
const Elem * elemPtr() const
Class describing a convective heat transfer between two domains.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const FaceInfo * _current_face_info
virtual Real computeBoundaryValueMatrixContribution() const override
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
virtual Real computeBoundaryGradientRHSContribution() const override
const Moose::Functor< Real > & _htc
The convective heat transfer coefficient.
registerMooseObject("NavierStokesApp", LinearFVConvectiveHeatTransferBC)
void addClassDescription(const std::string &doc_string)
bool _var_is_fluid
Helper boolean to see if the variable we have is the fluid variable.
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
const Moose::Functor< Real > & _temp_fluid
The fluid temperature, we use the functor form to enable situations when the user wants to supply a s...
static InputParameters validParams()