https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVEnthalpyFunctorMaterial.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" // Variable Term Names
12#include "NavierStokesMethods.h"
14
16
19{
20 auto params = FunctorMaterial::validParams();
21 params.addClassDescription(
22 "Creates functors for conversions between specific enthalpy and temperature");
23
24 params.addRequiredParam<MooseFunctorName>(NS::pressure, "Pressure");
25 params.addRequiredParam<MooseFunctorName>(NS::T_fluid, "Fluid temperature");
26 params.addRequiredParam<MooseFunctorName>(NS::specific_enthalpy, "Specific Enthalpy");
27
28 // Please choose between providing a fluid properties
29 params.addParam<UserObjectName>(NS::fluid, "Fluid properties userobject");
30 // or the h_from_p_T and T_from_p_h functors.
31 params.addParam<MooseFunctorName>("h_from_p_T_functor",
32 "User specified enthalpy from temperature functor");
33 params.addParam<MooseFunctorName>("T_from_p_h_functor",
34 "User specified temperature from enthalpy functor");
35
36 return params;
37}
38
40 : FunctorMaterial(params),
41 _pressure(getFunctor<Real>(NS::pressure)),
42 _T_fluid(getFunctor<Real>(NS::T_fluid)),
43 _h(getFunctor<Real>(NS::specific_enthalpy)),
44 _fluid(params.isParamValid(NS::fluid)
45 ? &UserObjectInterface::getUserObject<SinglePhaseFluidProperties>(NS::fluid)
46 : nullptr),
47 _h_from_p_T_functor(params.isParamValid("h_from_p_T_functor")
48 ? &getFunctor<Real>("h_from_p_T_functor")
49 : nullptr),
50 _T_from_p_h_functor(params.isParamValid("T_from_p_h_functor")
51 ? &getFunctor<Real>("T_from_p_h_functor")
52 : nullptr)
53{
54 // Check parameters
57 {
58 mooseError("An unsupported combination of input parameters was given. Current "
59 "supported combinations are either\ni) `fp` and neither `h_from_p_T_functor` nor "
60 "`T_from_p_h_functor`, or\nii) "
61 "no `fp` and both `h_from_p_T_functor` and `T_from_p_h_functor` are provided.");
62 }
63
64 //
65 // Set material property functors
66 //
67 if (_fluid)
68 {
69 addFunctorProperty<Real>("h_from_p_T",
70 [this](const auto & r, const auto & t) -> Real
71 { return _fluid->h_from_p_T(_pressure(r, t), _T_fluid(r, t)); });
72 addFunctorProperty<Real>("T_from_p_h",
73 [this](const auto & r, const auto & t) -> Real
74 { return _fluid->T_from_p_h(_pressure(r, t), _h(r, t)); });
75 }
76 else
77 {
78 addFunctorProperty<Real>("h_from_p_T",
79 [this](const auto & r, const auto & t) -> Real
80 { return (*_h_from_p_T_functor)(r, t); });
81 addFunctorProperty<Real>("T_from_p_h",
82 [this](const auto & r, const auto & t) -> Real
83 { return (*_T_from_p_h_functor)(r, t); });
84 }
85}
registerMooseObject("NavierStokesApp", LinearFVEnthalpyFunctorMaterial)
static InputParameters validParams()
Converts temperature to enthalpy or enthalpy to temperature using functor material properties.
const Moose::Functor< Real > & _pressure
Variables, treated as functors.
LinearFVEnthalpyFunctorMaterial(const InputParameters &parameters)
const Moose::Functor< Real > * _h_from_p_T_functor
Pointers to the the conversion functors (in case the fluid property is not provided)
const SinglePhaseFluidProperties * _fluid
The fluid properties that contain the h from T conversion routines.
const Moose::Functor< Real > * _T_from_p_h_functor
void mooseError(Args &&... args) const
Common class for single phase fluid properties.
static const std::string T_fluid
Definition NS.h:110
static const std::string specific_enthalpy
Definition NS.h:69
static const std::string fluid
Definition NS.h:88
static const std::string pressure
Definition NS.h:57