11/* !
2- * \file CCoolProp.hpp
3- * \brief Defines the state-of-the-art fluid model from CoolProp library.
4- * \author P. Yan, G. Gori, A. Guardone
5- * \version 7.5.1 "Blackbird"
6- *
7- * SU2 Project Website: https://su2code.github.io
8- *
9- * The SU2 Project is maintained by the SU2 Foundation
10- * (http://su2foundation.org)
11- *
12- * Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md)
13- *
14- * SU2 is free software; you can redistribute it and/or
15- * modify it under the terms of the GNU Lesser General Public
16- * License as published by the Free Software Foundation; either
17- * version 2.1 of the License, or (at your option) any later version.
18- *
19- * SU2 is distributed in the hope that it will be useful,
20- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22- * Lesser General Public License for more details.
23- *
24- * You should have received a copy of the GNU Lesser General Public
25- * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26- */
2+ * \file CCoolProp.hpp
3+ * \brief Defines the state-of-the-art fluid model from CoolProp library.
4+ * \author P. Yan, G. Gori, A. Guardone
5+ * \version 7.5.1 "Blackbird"
6+ *
7+ * SU2 Project Website: https://su2code.github.io
8+ *
9+ * The SU2 Project is maintained by the SU2 Foundation
10+ * (http://su2foundation.org)
11+ *
12+ * Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md)
13+ *
14+ * SU2 is free software; you can redistribute it and/or
15+ * modify it under the terms of the GNU Lesser General Public
16+ * License as published by the Free Software Foundation; either
17+ * version 2.1 of the License, or (at your option) any later version.
18+ *
19+ * SU2 is distributed in the hope that it will be useful,
20+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22+ * Lesser General Public License for more details.
23+ *
24+ * You should have received a copy of the GNU Lesser General Public
25+ * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26+ */
2727
2828#pragma once
2929#include " CFluidModel.hpp"
@@ -36,135 +36,136 @@ class AbstractState;
3636#include < memory>
3737
3838/* !
39- * \class CCoolProp
40- * \brief Child class for defining fluid model from CoolProp library.
41- * \author: P.Yan
42- */
39+ * \class CCoolProp
40+ * \brief Child class for defining fluid model from CoolProp library.
41+ * \author: P.Yan
42+ */
4343class CCoolProp final : public CFluidModel {
44- private:
45- su2double Gamma{1.4 }; /* !< \brief Ratio of Specific Heats. */
46- su2double Gas_Constant{297 }; /* !< \brief specific Gas Constant. */
47- su2double Pressure_Critical{0.0 }; /* !< \brief critical pressure */
48- su2double Temperature_Critical{0.0 }; /* !< \brief critical temperature */
49- su2double acentric_factor{0.0 }; /* !< \brief acentric factor */
50- const su2double dp{0.01 }; /* !< threshold for pressure */
51- const su2double dt{0.01 }; /* !< threshold for temperature */
44+ private:
45+ su2double Gamma{1.4 }; /* !< \brief Ratio of Specific Heats. */
46+ su2double Gas_Constant{297 }; /* !< \brief specific Gas Constant. */
47+ su2double Pressure_Critical{0.0 }; /* !< \brief critical pressure */
48+ su2double Temperature_Critical{0.0 }; /* !< \brief critical temperature */
49+ su2double acentric_factor{0.0 }; /* !< \brief acentric factor */
50+ const su2double dp{0.01 }; /* !< threshold for pressure */
51+ const su2double dt{0.01 }; /* !< threshold for temperature */
5252#ifdef USE_COOLPROP
53- std::unique_ptr<CoolProp::AbstractState> fluid_entity; /* !< \brief fluid entity */
53+ std::unique_ptr<CoolProp::AbstractState> fluid_entity; /* !< \brief fluid entity */
5454#endif
55- /* !
56- * \brief Avoid critical pressure
57- * \param[in,out] Pressure: Modified so that it is not too close to critical pressure to avoid issues in CoolProp.
58- */
59- void CheckPressure (su2double& Pressure) const {
60- if (Pressure > Pressure_Critical)
61- Pressure = fmax (Pressure, (1 + dp) * Pressure_Critical);
62- else
63- Pressure = fmin (Pressure, (1 - dp) * Pressure_Critical);
64- }
65-
66- /* !
67- * \brief Avoid critical temperature
68- * \param[in,out] Temperature: Modified so that it is not too close to critical temperature to avoid issues in CoolProp.
69- */
70- void CheckTemperature (su2double& Temperature) const {
71- if (Temperature > Temperature_Critical)
72- Temperature = fmax (Temperature, (1 + dt) * Temperature_Critical);
73- else
74- Temperature = fmin (Temperature, (1 + dt) * Temperature_Critical);
75- }
76-
77- public:
78- /* !
79- * \brief Constructor of the class.
80- */
81- CCoolProp (string fluidname);
55+ /* !
56+ * \brief Avoid critical pressure
57+ * \param[in,out] Pressure: Modified so that it is not too close to critical pressure to avoid issues in CoolProp.
58+ */
59+ void CheckPressure (su2double& Pressure) const {
60+ if (Pressure > Pressure_Critical)
61+ Pressure = fmax (Pressure, (1 + dp) * Pressure_Critical);
62+ else
63+ Pressure = fmin (Pressure, (1 - dp) * Pressure_Critical);
64+ }
65+
66+ /* !
67+ * \brief Avoid critical temperature
68+ * \param[in,out] Temperature: Modified so that it is not too close to critical temperature to avoid issues in
69+ * CoolProp.
70+ */
71+ void CheckTemperature (su2double& Temperature) const {
72+ if (Temperature > Temperature_Critical)
73+ Temperature = fmax (Temperature, (1 + dt) * Temperature_Critical);
74+ else
75+ Temperature = fmin (Temperature, (1 + dt) * Temperature_Critical);
76+ }
77+
78+ public:
79+ /* !
80+ * \brief Constructor of the class.
81+ */
82+ CCoolProp (string fluidname);
8283
8384#ifdef USE_COOLPROP
84- /* !
85- * \brief Destructor of the class.
86- * \note Needs to be defined in the .cpp to allow using only a forward declaration of CoolProp::AbstractState.
87- */
88- ~CCoolProp ();
89-
90- /* !
91- * \brief Set the Dimensionless State using Density and Internal Energy
92- * \param[in] rho - first thermodynamic variable.
93- * \param[in] e - second thermodynamic variable.
94- */
95- void SetTDState_rhoe (su2double rho, su2double e) override ;
96-
97- /* !
98- * \brief Set the Dimensionless State using Pressure and Temperature
99- * \param[in] P - first thermodynamic variable.
100- * \param[in] T - second thermodynamic variable.
101- */
102- void SetTDState_PT (su2double P, su2double T) override ;
103-
104- /* !
105- * \brief Set the Dimensionless State using Pressure and Density
106- * \param[in] P - first thermodynamic variable.
107- * \param[in] rho - second thermodynamic variable.
108- */
109- void SetTDState_Prho (su2double P, su2double rho) override ;
110-
111- /* !
112- * \brief Set the Dimensionless Internal Energy using Pressure and Density
113- * \param[in] P - first thermodynamic variable.
114- * \param[in] rho - second thermodynamic variable.
115- */
116- void SetEnergy_Prho (su2double P, su2double rho) override ;
117-
118- /* !
119- * \brief Set the Dimensionless State using Enthalpy and Entropy
120- * \param[in] th1 - first thermodynamic variable (h).
121- * \param[in] th2 - second thermodynamic variable (s).
122- */
123- void SetTDState_hs (su2double h, su2double s) override ;
124-
125- /* !
126- * \brief Set the Dimensionless State using Density and Temperature
127- * \param[in] th1 - first thermodynamic variable (rho).
128- * \param[in] th2 - second thermodynamic variable (T).
129- */
130- void SetTDState_rhoT (su2double rho, su2double T) override ;
131-
132- /* !
133- * \brief Set the Dimensionless State using Pressure and Entropy
134- * \param[in] th1 - first thermodynamic variable (P).
135- * \param[in] th2 - second thermodynamic variable (s).
136- */
137- void SetTDState_Ps (su2double P, su2double s) override ;
138-
139- /* !
140- * \brief compute some derivatives of enthalpy and entropy needed for subsonic inflow BC
141- * \param[in] th1 - first thermodynamic variable (P).
142- * \param[in] th2 - second thermodynamic variable (rho).
143- */
144- void ComputeDerivativeNRBC_Prho (su2double P, su2double rho) override ;
85+ /* !
86+ * \brief Destructor of the class.
87+ * \note Needs to be defined in the .cpp to allow using only a forward declaration of CoolProp::AbstractState.
88+ */
89+ ~CCoolProp ();
90+
91+ /* !
92+ * \brief Set the Dimensionless State using Density and Internal Energy
93+ * \param[in] rho - first thermodynamic variable.
94+ * \param[in] e - second thermodynamic variable.
95+ */
96+ void SetTDState_rhoe (su2double rho, su2double e) override ;
97+
98+ /* !
99+ * \brief Set the Dimensionless State using Pressure and Temperature
100+ * \param[in] P - first thermodynamic variable.
101+ * \param[in] T - second thermodynamic variable.
102+ */
103+ void SetTDState_PT (su2double P, su2double T) override ;
104+
105+ /* !
106+ * \brief Set the Dimensionless State using Pressure and Density
107+ * \param[in] P - first thermodynamic variable.
108+ * \param[in] rho - second thermodynamic variable.
109+ */
110+ void SetTDState_Prho (su2double P, su2double rho) override ;
111+
112+ /* !
113+ * \brief Set the Dimensionless Internal Energy using Pressure and Density
114+ * \param[in] P - first thermodynamic variable.
115+ * \param[in] rho - second thermodynamic variable.
116+ */
117+ void SetEnergy_Prho (su2double P, su2double rho) override ;
118+
119+ /* !
120+ * \brief Set the Dimensionless State using Enthalpy and Entropy
121+ * \param[in] th1 - first thermodynamic variable (h).
122+ * \param[in] th2 - second thermodynamic variable (s).
123+ */
124+ void SetTDState_hs (su2double h, su2double s) override ;
125+
126+ /* !
127+ * \brief Set the Dimensionless State using Density and Temperature
128+ * \param[in] th1 - first thermodynamic variable (rho).
129+ * \param[in] th2 - second thermodynamic variable (T).
130+ */
131+ void SetTDState_rhoT (su2double rho, su2double T) override ;
132+
133+ /* !
134+ * \brief Set the Dimensionless State using Pressure and Entropy
135+ * \param[in] th1 - first thermodynamic variable (P).
136+ * \param[in] th2 - second thermodynamic variable (s).
137+ */
138+ void SetTDState_Ps (su2double P, su2double s) override ;
139+
140+ /* !
141+ * \brief compute some derivatives of enthalpy and entropy needed for subsonic inflow BC
142+ * \param[in] th1 - first thermodynamic variable (P).
143+ * \param[in] th2 - second thermodynamic variable (rho).
144+ */
145+ void ComputeDerivativeNRBC_Prho (su2double P, su2double rho) override ;
145146#endif
146147
147- /* !
148- * \brief Get the value of the critical pressure.
149- * \return Critical pressure.
150- */
151- su2double GetPressure_Critical (void ) const { return Pressure_Critical; }
152-
153- /* !
154- * \brief Get the value of the critical temperature.
155- * \return Critical temperature.
156- */
157- su2double GetTemperature_Critical (void ) const { return Temperature_Critical; }
158-
159- /* !
160- * \brief Get the value of specific gas constant.
161- * \return Value of the constant: Gamma
162- */
163- su2double GetGas_Constant (void ) const { return Gas_Constant; }
164-
165- /* !
166- * \brief Get the value of specific gas constant.
167- * \return Value of the constant: Gamma
168- */
169- su2double GetGamma (void ) const { return Gamma; }
148+ /* !
149+ * \brief Get the value of the critical pressure.
150+ * \return Critical pressure.
151+ */
152+ su2double GetPressure_Critical (void ) const { return Pressure_Critical; }
153+
154+ /* !
155+ * \brief Get the value of the critical temperature.
156+ * \return Critical temperature.
157+ */
158+ su2double GetTemperature_Critical (void ) const { return Temperature_Critical; }
159+
160+ /* !
161+ * \brief Get the value of specific gas constant.
162+ * \return Value of the constant: Gamma
163+ */
164+ su2double GetGas_Constant (void ) const { return Gas_Constant; }
165+
166+ /* !
167+ * \brief Get the value of specific gas constant.
168+ * \return Value of the constant: Gamma
169+ */
170+ su2double GetGamma (void ) const { return Gamma; }
170171};
0 commit comments