https://mooseframework.inl.gov
LinearFVVolumetricHeatTransfer.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 "SubProblem.h"
12 #include "NS.h"
13 #include "FEProblemBase.h"
14 
16 
19 {
21  params.addClassDescription(
22  "Represents a heat transfer term between the fluid and a homogenized structure.");
23  params.addRequiredParam<MooseFunctorName>("h_solid_fluid",
24  "Name of the convective heat transfer coefficient.");
25  params.addRequiredParam<bool>("is_solid", "Whether this kernel acts on the solid temperature.");
26  params.addRequiredParam<VariableName>(NS::T_fluid, "Fluid temperature.");
27  params.addRequiredParam<VariableName>(NS::T_solid, "Solid temperature.");
28  return params;
29 }
30 
32  : LinearFVElementalKernel(params),
33  _h_solid_fluid(getFunctor<Real>("h_solid_fluid")),
34  _temp_fluid(getTemperatureVariable(NS::T_fluid)),
35  _temp_solid(getTemperatureVariable(NS::T_solid)),
36  _is_solid(getParam<bool>("is_solid"))
37 {
38 }
39 
42 {
43  auto * ptr = dynamic_cast<MooseLinearVariableFV<Real> *>(
44  &_fe_problem.getVariable(_tid, getParam<VariableName>(vname)));
45 
46  if (!ptr)
47  paramError(
48  vname, "The variable supplied to ", vname, " should be of type MooseLinearVariableFVReal!");
49 
50  return *ptr;
51 }
52 
53 Real
55 {
56  const auto elem = makeElemArg(_current_elem_info->elem());
57  const auto state = determineState();
58 
59  return _h_solid_fluid(elem, state) * _current_elem_volume;
60 }
61 
62 Real
64 {
65  const auto elem = makeElemArg(_current_elem_info->elem());
66  const auto state = determineState();
67 
68  const auto temp_value = _is_solid ? _temp_fluid.getElemValue(*_current_elem_info, state)
70 
71  return _h_solid_fluid(elem, state) * temp_value * _current_elem_volume;
72 }
const ElemInfo * _current_elem_info
const Moose::Functor< Real > & _h_solid_fluid
MOOSE functor describing the heat transfer coefficient.
void paramError(const std::string &param, Args... args) const
static const std::string T_solid
Definition: NS.h:107
const MooseLinearVariableFV< Real > & getTemperatureVariable(const std::string &vname)
Routine used to throw an error if the provided variable is not an MooseLinearVariableFV.
Moose::StateArg determineState() const
const Elem * elem() const
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
LinearFVVolumetricHeatTransfer(const InputParameters &params)
Class constructor.
const THREAD_ID _tid
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
static const std::string T_fluid
Definition: NS.h:106
virtual Real computeRightHandSideContribution() override
Kernel that adds contributions to the system matrix and right hand side based on heat transfer betwee...
registerMooseObject("NavierStokesApp", LinearFVVolumetricHeatTransfer)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MooseLinearVariableFV< Real > & _temp_solid
Reference to the linear finite volume solid temperature variable.
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
const MooseLinearVariableFV< Real > & _temp_fluid
Reference to the linear finite volume fluid temperature variable.
void addClassDescription(const std::string &doc_string)
FEProblemBase & _fe_problem
const bool _is_solid
Flag to help the kernel to decide if it is executed on a solid of a fluid.