https://mooseframework.inl.gov
LinearFVRobinCHTBC.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 
10 #include "LinearFVRobinCHTBC.h"
11 #include "NS.h"
12 
13 registerMooseObject("NavierStokesApp", LinearFVRobinCHTBC);
14 
17 {
19  params.addRequiredParam<MooseFunctorName>("h", "The convective heat transfer coefficient.");
20  params.addRequiredParam<MooseFunctorName>("incoming_flux",
21  "The incoming diffusive flux on the interface.");
22  params.addRequiredParam<MooseFunctorName>("surface_temperature",
23  "The prescribed temperature on the interface.");
24  params.addRequiredParam<MooseFunctorName>(
25  "thermal_conductivity",
26  "The thermal conductivity of the material. Only used to compute the pure normal gradient of "
27  "the variable on the boundary.");
28 
29  params.addClassDescription(
30  "Conjugate heat transfer BC for Robin boundary condition-based coupling.");
31  return params;
32 }
33 
35  : LinearFVAdvectionDiffusionBC(parameters),
37  _htc(getFunctor<Real>("h")),
38  _k(getFunctor<Real>("thermal_conductivity")),
39  _incoming_flux(getFunctor<Real>("incoming_flux")),
40  _surface_temperature(getFunctor<Real>("surface_temperature"))
41 {
42 }
43 
44 Real
46 {
47  const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM)
50 
51  return _var.getElemValue(*elem_info, determineState());
52 }
53 
54 Real
56 {
57  const auto elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM)
60  const auto state = determineState();
62  face.face_side = elem_info->elem();
63 
64  return (_htc(face, state) * (_var.getElemValue(*elem_info, determineState()) -
65  _surface_temperature(face, state)) +
66  _incoming_flux(face, state)) /
67  _k(face, state);
68 }
69 
70 Real
72 {
73  // We approximate the face value with the cell value here.
74  // TODO: we can extend this to a 2-term expansion at some point when the need arises.
75  return 1.0;
76 }
77 
78 Real
80 {
81  // We approximate the face value with the cell value, we
82  // don't need to add anything to the right hand side.
83  return 0.0;
84 }
85 
86 Real
88 {
89  const auto face = singleSidedFaceArg(_current_face_info);
90  const auto state = determineState();
91 
92  // We just put the heat transfer coefficient on the diagonal (multiplication with the
93  // surface area is taken care of in the kernel).
94  return _htc(face, state);
95 }
96 Real
98 {
99  // We check where the functor contributing to the right hand side lives. We do this
100  // because this functor lives on the domain where the variable of this kernel doesn't.
101  const auto * elem_info = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM)
104 
105  const auto state = determineState();
107  face.face_side = elem_info->elem();
108 
109  return _htc(face, state) * _surface_temperature(face, state) + _incoming_flux(face, state);
110 }
virtual Real computeBoundaryValue() const override
Base class that allows error checking for CHT applications.
registerMooseObject("NavierStokesApp", LinearFVRobinCHTBC)
Moose::StateArg determineState() const
const ElemInfo * neighborInfo() const
const ElemInfo * elemInfo() const
virtual Real computeBoundaryGradientRHSContribution() const override
const Moose::Functor< Real > & _surface_temperature
The prescribed temperature on the interface.
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
FaceInfo::VarFaceNeighbors _current_face_type
MooseLinearVariableFV< Real > & _var
const Moose::Functor< Real > & _k
The thermal conductivity of the material.
virtual Real computeBoundaryValueMatrixContribution() const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LinearFVRobinCHTBC(const InputParameters &parameters)
Class constructor.
const FaceInfo * _current_face_info
const Moose::Functor< Real > & _incoming_flux
The incoming diffusive flux on the intervace.
virtual Real computeBoundaryValueRHSContribution() const override
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
void addClassDescription(const std::string &doc_string)
const Moose::Functor< Real > & _htc
The virtual convective heat transfer coefficient.
virtual Real computeBoundaryGradientMatrixContribution() const override
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
Conjugate heat transfer BC for Robin boundary condition-based coupling.
static InputParameters validParams()
virtual Real computeBoundaryNormalGradient() const override