https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVEnthalpyVolumetricHeatTransfer.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{
20 "Represents a volumetric heat transfer term between two porous-medium energy equations when "
21 "the solved variable is specific enthalpy and the current-side temperature is linearized "
22 "with dT/dh ~= 1/cp.");
23 params.addRequiredParam<MooseFunctorName>(
24 NS::cp,
25 "Specific heat used to linearize the current-side temperature from the enthalpy variable.");
26 return params;
27}
28
34
35Real
37 const Moose::StateArg & state) const
38{
39 const auto cp = _cp(elem, state);
40 if (cp <= 0.0)
41 mooseError("cp must stay positive when solving for enthalpy, but cp = ",
42 cp,
43 " in element ",
44 elem.elem->id(),
45 " (subdomain ",
46 elem.elem->subdomain_id(),
47 ", vertex average ",
48 elem.elem->vertex_average(),
49 ").");
50 return cp;
51}
52
53Real
55{
56 const auto elem = makeElemArg(_current_elem_info->elem());
57 const auto state = determineState();
58 const auto cp = positiveCp(elem, state);
59
60 return _h_solid_fluid(elem, state) * _current_elem_volume / cp;
61}
62
63Real
65{
66 const auto elem = makeElemArg(_current_elem_info->elem());
67 const auto state = determineState();
68 const auto cp = positiveCp(elem, state);
69
70 const auto & current_temperature = _is_solid ? _temp_solid : _temp_fluid;
71 const auto & other_temperature = _is_solid ? _temp_fluid : _temp_solid;
72 const auto h_current = _var.getElemValue(*_current_elem_info, state);
73 const auto linearized_current_temperature = h_current / cp;
74
75 // linearized temperature is added to the matrix and removed here
76 return _h_solid_fluid(elem, state) *
77 (other_temperature.getElemValue(*_current_elem_info, state) -
78 current_temperature.getElemValue(*_current_elem_info, state) +
79 linearized_current_temperature) *
81}
registerMooseObject("NavierStokesApp", LinearFVEnthalpyVolumetricHeatTransfer)
const Elem * elem() const
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const ElemInfo * _current_elem_info
Volumetric heat transfer kernel for enthalpy equations using an auxiliary temperature together with a...
const Moose::Functor< Real > & _cp
Specific heat used for the current-side temperature linearization.
Real positiveCp(const Moose::ElemArg &elem, const Moose::StateArg &state) const
Evaluate the specific heat in the current element, erroring if it is not positive.
MooseLinearVariableFV< Real > & _var
Kernel that adds contributions to the system matrix and right hand side based on heat transfer betwee...
const MooseLinearVariableFV< Real > & _temp_fluid
Reference to the linear finite volume fluid temperature variable.
const Moose::Functor< Real > & _h_solid_fluid
MOOSE functor describing the heat transfer coefficient.
const bool _is_solid
Flag to help the kernel to decide if it is executed on a solid of a fluid.
const MooseLinearVariableFV< Real > & _temp_solid
Reference to the linear finite volume solid temperature variable.
void mooseError(Args &&... args) const
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
Moose::StateArg determineState() const
dof_id_type id() const
subdomain_id_type subdomain_id() const
Point vertex_average() const
static const std::string cp
Definition NS.h:125
const libMesh::Elem * elem