https://mooseframework.inl.gov
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 
45 template <bool is_ad>
46 void
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 
63 template <bool is_ad>
64 void
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 
81 template <bool is_ad>
82 void
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 }
Moose::GenericType< Real, is_ad > GenericReal
static InputParameters validParams()
FlowModel1PhaseFunctorMaterial(const InputParameters &parameters)
void addVelocityFunctorProperty()
Adds velocity functor material property.
const double v
const SinglePhaseFluidProperties & _fp
Fluid properties.
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string TEMPERATURE
Definition: THMNames.h:39
const Moose::Functor< Real > & _A
Cross-sectional area.
static const std::string PRESSURE
Definition: THMNames.h:27
registerMooseObject("ThermalHydraulicsApp", FlowModel1PhaseFunctorMaterial)
const Moose::Functor< ADReal > & _rhouA
rho*u*A
Common class for single phase fluid properties.
static const std::string VELOCITY
Definition: THMNames.h:43
void addTemperatureFunctorProperty()
Adds temperature functor material property.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addPressureFunctorProperty()
Adds pressure functor material property.
void addClassDescription(const std::string &doc_string)
const Moose::Functor< ADReal > & _rhoA
rho*A
Computes several quantities for FlowModel1Phase.
const Moose::Functor< ADReal > & _rhoEA
rho*E*A