https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TwoPhaseFluidProperties.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
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
61Real
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 ADReal 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 ADReal p_sat = p_sat_real;
87 p_sat.derivatives() = T.derivatives() * dp_sat_dT_real;
88 return p_sat;
89}
90
91Real
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
103Real
105{
106 mooseError(__PRETTY_FUNCTION__, " is not implemented.");
107}
108
109Real
111{
112 mooseError(__PRETTY_FUNCTION__, " is not implemented.");
113}
114
115ADReal
117{
118 const Real T_real = T.value();
119 const Real sigma_real = sigma_from_T(T_real);
120 const Real dsigma_dT = dsigma_dT_from_T(T_real);
121
122 ADReal sigma = sigma_real;
123 sigma.derivatives() = T.derivatives() * dsigma_dT;
124 return sigma;
125}
126
127Real
129{
130 mooseError(__PRETTY_FUNCTION__, " is not implemented.");
131}
132
133#pragma GCC diagnostic pop
DualNumber< Real, DNDerivativeType, true > ADReal
const Real p
const double T
const std::string name
Definition Setup.h:21
bool hasUserObject(const std::string &name) const
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
const std::string & name() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
virtual Real dsigma_dT_from_T(Real T) const
Computes dsigma/dT along the saturation line.
virtual Real T_triple() const
Returns the triple-point temperature.
const UserObjectName _liquid_name
The name of the user object that provides liquid phase fluid properties.
TwoPhaseFluidProperties(const InputParameters &parameters)
virtual Real dT_sat_dp(Real p) const =0
Computes dT/dp along the saturation line.
const UserObjectName _vapor_name
The name of the user object that provides vapor phase fluid properties.
static InputParameters validParams()
virtual Real sigma_from_T(Real T) const
Computes surface tension sigma of saturated liquid in contact with saturated vapor.
virtual Real p_sat(Real T) const =0
Computes the saturation pressure at a temperature.
const SinglePhaseFluidProperties * _fp_liquid
The user object that provides liquid phase fluid properties.
virtual Real L_fusion() const
Returns the latent heat of fusion.
virtual Real h_lat(Real p, Real T) const
Computes latent heat of vaporization.
virtual Real T_sat(Real p) const =0
Computes the saturation temperature at a pressure.
const SinglePhaseFluidProperties * _fp_vapor
The user object that provides vapor phase fluid properties.
FEProblemBase & _fe_problem