https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FlowModel1PhaseFunctorMaterial.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
13
16{
18
19 params.addClassDescription("Computes several quantities for FlowModel1Phase.");
20
21 params.addRequiredParam<UserObjectName>("fluid_properties",
22 "The SinglePhaseFluidProperties object for the fluid");
23
24 return params;
25}
26
28 : FunctorMaterial(parameters),
29 _rhoA(getFunctor<ADReal>(THM::RHOA)),
30 _rhouA(getFunctor<ADReal>(THM::RHOUA)),
31 _rhoEA(getFunctor<ADReal>(THM::RHOEA)),
32 _A(getFunctor<Real>(THM::AREA)),
33 _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
34{
35 // pressure
36 addPressureFunctorProperty<false>();
37
38 // temperature
39 addTemperatureFunctorProperty<false>();
40
41 // velocity
42 addVelocityFunctorProperty<false>();
43}
44
45template <bool is_ad>
46void
48{
49 addFunctorProperty<GenericReal<is_ad>>(
50 THM::functorMaterialPropertyName<is_ad>(THM::PRESSURE),
51 [this](const auto & r, const auto & t) -> GenericReal<is_ad>
52 {
53 const auto rhoA = Moose::ADRealToGenericReal<is_ad>(_rhoA(r, t));
54 const auto rhouA = Moose::ADRealToGenericReal<is_ad>(_rhouA(r, t));
55 const auto rhoEA = Moose::ADRealToGenericReal<is_ad>(_rhoEA(r, t));
56 const auto A = _A(r, t);
57 const auto v = A / rhoA;
58 const auto e = (rhoEA - 0.5 * rhouA * rhouA / rhoA) / rhoA;
59 return _fp.p_from_v_e(v, e);
60 });
61}
62
63template <bool is_ad>
64void
66{
67 addFunctorProperty<GenericReal<is_ad>>(
68 THM::functorMaterialPropertyName<is_ad>(THM::TEMPERATURE),
69 [this](const auto & r, const auto & t) -> GenericReal<is_ad>
70 {
71 const auto rhoA = Moose::ADRealToGenericReal<is_ad>(_rhoA(r, t));
72 const auto rhouA = Moose::ADRealToGenericReal<is_ad>(_rhouA(r, t));
73 const auto rhoEA = Moose::ADRealToGenericReal<is_ad>(_rhoEA(r, t));
74 const auto A = _A(r, t);
75 const auto v = A / rhoA;
76 const auto e = (rhoEA - 0.5 * rhouA * rhouA / rhoA) / rhoA;
77 return _fp.T_from_v_e(v, e);
78 });
79}
80
81template <bool is_ad>
82void
84{
85 addFunctorProperty<GenericReal<is_ad>>(
86 THM::functorMaterialPropertyName<is_ad>(THM::VELOCITY),
87 [this](const auto & r, const auto & t) -> GenericReal<is_ad>
88 {
89 const auto rhoA = Moose::ADRealToGenericReal<is_ad>(_rhoA(r, t));
90 const auto rhouA = Moose::ADRealToGenericReal<is_ad>(_rhouA(r, t));
91 return rhouA / rhoA;
92 });
93}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("ThermalHydraulicsApp", FlowModel1PhaseFunctorMaterial)
const double v
Moose::GenericType< Real, is_ad > GenericReal
Computes several quantities for FlowModel1Phase.
const SinglePhaseFluidProperties & _fp
Fluid properties.
const Moose::Functor< ADReal > & _rhouA
rho*u*A
void addPressureFunctorProperty()
Adds pressure functor material property.
void addTemperatureFunctorProperty()
Adds temperature functor material property.
void addVelocityFunctorProperty()
Adds velocity functor material property.
FlowModel1PhaseFunctorMaterial(const InputParameters &parameters)
const Moose::Functor< ADReal > & _rhoEA
rho*E*A
const Moose::Functor< ADReal > & _rhoA
rho*A
const Moose::Functor< Real > & _A
Cross-sectional area.
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Common class for single phase fluid properties.
static const std::string TEMPERATURE
Definition THMNames.h:39
static const std::string VELOCITY
Definition THMNames.h:43
static const std::string PRESSURE
Definition THMNames.h:27