www.mooseframework.org
TwoPhaseFluidProperties.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
12 
15 {
17  params.set<std::string>("fp_type") = "two-phase-fp";
18 
19  params.addParam<UserObjectName>("fp_liquid",
20  "Liquid single-phase fluid properties user object name");
21  params.addParam<UserObjectName>("fp_vapor",
22  "Vapor single-phase fluid properties user object name");
23 
24  return params;
25 }
26 
28  : FluidProperties(parameters),
29 
30  _liquid_name(isParamValid("fp_liquid") ? getParam<UserObjectName>("fp_liquid")
31  : UserObjectName(name() + ":liquid")),
32  _vapor_name(isParamValid("fp_vapor") ? getParam<UserObjectName>("fp_vapor")
33  : UserObjectName(name() + ":vapor"))
34 {
35  // If the single-phase fluid properties user object names are not provided, it
36  // is implied that these objects will be created by a derived class. In this
37  // case, we need to check that these user objects do not already exist.
38  if (!isParamValid("fp_liquid"))
40  paramError("fp_liquid",
41  "The two-phase fluid properties object '" + name() + "' is ",
42  "trying to create a single-phase fluid properties object with ",
43  "name '",
45  "', but a single-phase fluid properties ",
46  "object with this name already exists.");
47  if (!isParamValid("fp_vapor"))
49  paramError("fp_vapor",
50  "The two-phase fluid properties object '" + name() + "' is ",
51  "trying to create a single-phase fluid properties object with ",
52  "name '",
54  "', but a single-phase fluid properties ",
55  "object with this name already exists.");
56 }
57 
58 #pragma GCC diagnostic push
59 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
60 
61 Real
63 {
64  mooseError(__PRETTY_FUNCTION__, " is not implemented.");
65 }
66 
69 {
70  const Real p_real = p.value();
71  const Real T_sat_real = T_sat(p_real);
72  const Real dT_sat_dp_real = dT_sat_dp(p_real);
73 
74  DualReal T_sat = T_sat_real;
75  T_sat.derivatives() = p.derivatives() * dT_sat_dp_real;
76  return T_sat;
77 }
78 
81 {
82  const Real T_real = T.value();
83  const Real p_sat_real = p_sat(T_real);
84  const Real dp_sat_dT_real = 1.0 / dT_sat_dp(p_sat_real);
85 
86  DualReal p_sat = p_sat_real;
87  p_sat.derivatives() = T.derivatives() * dp_sat_dT_real;
88  return p_sat;
89 }
90 
91 Real
92 TwoPhaseFluidProperties::h_lat(Real p, Real T) const
93 {
94  return _fp_vapor->h_from_p_T(p, T) - _fp_liquid->h_from_p_T(p, T);
95 }
96 
99 {
100  return _fp_vapor->h_from_p_T(p, T) - _fp_liquid->h_from_p_T(p, T);
101 }
102 
103 Real
105 {
106  mooseError(__PRETTY_FUNCTION__, " is not implemented.");
107 }
108 
110 {
111  mooseError(__PRETTY_FUNCTION__, " is not implemented.");
112 }
113 
114 DualReal
116 {
117  const Real T_real = T.value();
118  const Real sigma_real = sigma_from_T(T_real);
119  const Real dsigma_dT = dsigma_dT_from_T(T_real);
120 
121  DualReal sigma = sigma_real;
122  sigma.derivatives() = T.derivatives() * dsigma_dT;
123  return sigma;
124 }
125 
127 {
128  mooseError(__PRETTY_FUNCTION__, " is not implemented.");
129 }
130 
131 #pragma GCC diagnostic pop
const SinglePhaseFluidProperties * _fp_vapor
The user object that provides vapor phase fluid properties.
const UserObjectName _vapor_name
The name of the user object that provides vapor phase fluid properties.
static InputParameters validParams()
const UserObjectName _liquid_name
The name of the user object that provides liquid phase fluid properties.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
DualNumber< Real, DNDerivativeType, true > DualReal
T & set(const std::string &name, bool quiet_mode=false)
TwoPhaseFluidProperties(const InputParameters &parameters)
const SinglePhaseFluidProperties * _fp_liquid
The user object that provides liquid phase fluid properties.
bool hasUserObject(const std::string &name) const
virtual const std::string & name() const
bool isParamValid(const std::string &name) const
virtual Real h_lat(Real p, Real T) const
Computes latent heat of vaporization.
static InputParameters validParams()
const std::string name
Definition: Setup.h:20
void paramError(const std::string &param, Args... args) const
virtual Real dT_sat_dp(Real p) const =0
Computes dT/dp along the saturation line.
virtual Real L_fusion() const
Returns the latent heat of fusion.
virtual Real p_sat(Real T) const =0
Computes the saturation pressure at a temperature.
virtual Real T_sat(Real p) const =0
Computes the saturation temperature at a pressure.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real T_triple() const
Returns the triple-point temperature.
virtual Real dsigma_dT_from_T(Real T) const
Computes dsigma/dT along the saturation line.
FEProblemBase & _fe_problem
void mooseError(Args &&... args) const
virtual Real sigma_from_T(Real T) const
Computes surface tension sigma of saturated liquid in contact with saturated vapor.