Skip to content

Commit 0f6df0e

Browse files
committed
fix sensible enthalpy
1 parent b91b14d commit 0f6df0e

16 files changed

+52
-64
lines changed

Common/include/CConfig.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ class CConfig {
919919
Initial_BCThrust, /*!< \brief Ratio of turbulent to laminar viscosity at the actuator disk. */
920920
Pressure_FreeStream, /*!< \brief Total pressure of the fluid. */
921921
Pressure_Thermodynamic, /*!< \brief Thermodynamic pressure of the fluid. */
922-
Standard_Ref_Temperature, /*!< \brief Standard reference temperature for multicomponent flows. */
923922
Temperature_FreeStream, /*!< \brief Total temperature of the fluid. */
924923
Temperature_ve_FreeStream; /*!< \brief Total vibrational-electronic temperature of the fluid. */
925924
unsigned short wallModel_MaxIter; /*!< \brief maximum number of iterations for the Newton method for the wall model */
@@ -1959,12 +1958,6 @@ class CConfig {
19591958
*/
19601959
su2double GetPressure_Thermodynamic(void) const { return Pressure_Thermodynamic; }
19611960

1962-
/*!
1963-
* \brief Get the value of the standard reference temperature for multicomponent flows.
1964-
* \return Standard reference temperature, Non-dimensionalized if it is needed for Non-Dimensional problems.
1965-
*/
1966-
su2double GetStandard_RefTemperatureND(void) const { return Standard_Ref_Temperature / Temperature_Ref; }
1967-
19681961
/*!
19691962
* \brief Get the value of the non-dimensionalized thermodynamic pressure.
19701963
* \return Non-dimensionalized thermodynamic pressure.

Common/include/option_structure.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const su2double UNIVERSAL_GAS_CONSTANT = 8.3144598; /*!< \brief Universal gas
9696
const su2double BOLTZMANN_CONSTANT = 1.3806503E-23; /*!< \brief Boltzmann's constant [J K^-1] */
9797
const su2double AVOGAD_CONSTANT = 6.0221415E26; /*!< \brief Avogadro's constant, number of particles in one kmole. */
9898
const su2double FUND_ELEC_CHARGE_CGS = 4.8032047E-10; /*!< \brief Fundamental electric charge in CGS units, cm^(3/2) g^(1/2) s^(-1). */
99-
99+
const su2double STD_REF_TEMP = 298.15; /*!< \brief Standard reference temperature for enthalpy in Kelvin. */
100100
const su2double EPS = 1.0E-16; /*!< \brief Error scale. */
101101
const su2double TURB_EPS = 1.0E-16; /*!< \brief Turbulent Error scale. */
102102

Common/src/CConfig.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,9 +1229,6 @@ void CConfig::SetConfig_Options() {
12291229
addDoubleOption("GAMMA_VALUE", Gamma, 1.4);
12301230
/*!\brief THERMODYNAMIC_PRESSURE \n DESCRIPTION: Thermodynamics(operating) Pressure (101325 Pa), only for incompressible flows) \ingroup Config*/
12311231
addDoubleOption("THERMODYNAMIC_PRESSURE", Pressure_Thermodynamic, 101325.0);
1232-
/*!\brief STANDARD_REFERENCE_TEMPERATURE \n DESCRIPTION: Standard reference temperature (298.15K), only for
1233-
* multicomponent incompressible flows) \ingroup Config*/
1234-
addDoubleOption("STANDARD_REFERENCE_TEMPERATURE", Standard_Ref_Temperature, 298.15);
12351232
/*!\brief CP_VALUE \n DESCRIPTION: Specific heat at constant pressure, Cp (1004.703 J/kg*K (air), constant density incompressible fluids only) \ingroup Config*/
12361233
addDoubleListOption("SPECIFIC_HEAT_CP", nSpecific_Heat_Cp, Specific_Heat_Cp);
12371234
/*!\brief THERMAL_EXPANSION_COEFF \n DESCRIPTION: Thermal expansion coefficient (0.00347 K^-1 (air), used for Boussinesq approximation for liquids/non-ideal gases) \ingroup Config*/

SU2_CFD/include/fluid/CConstantDensity.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ class CConstantDensity final : public CFluidModel {
5656
decoupled equation. Hence, we update the value.
5757
Note Cp = Cv, (gamma = 1).*/
5858
Temperature = t;
59-
Enthalpy = Cp * Temperature;
59+
Enthalpy = Cp * (Temperature - STD_REF_TEMP); // Sensible enthalpy relative to STD_REF_TEMP
6060
}
6161

6262
/*!
6363
* \brief Set the Dimensionless State using Enthalpy.
6464
* \param[in] val_enthalpy - Enthalpy value at the point.
65-
* \param[in] val_scalars - not used here.
65+
* \param[in] val_scalars - not used here.
6666
*/
6767
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override {
6868
Enthalpy = val_enthalpy;
69-
Temperature = Enthalpy / Cp;
69+
Temperature = Enthalpy / Cp + STD_REF_TEMP; // Temperature from sensible enthalpy
7070
}
7171
};

SU2_CFD/include/fluid/CFluidScalar.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class CFluidScalar final : public CFluidModel {
4242
const int n_species_mixture; /*!< \brief Number of species in mixture. */
4343
su2double Gas_Constant; /*!< \brief Specific gas constant. */
4444
const su2double Pressure_Thermodynamic; /*!< \brief Constant pressure thermodynamic. */
45-
const su2double Ref_Temperature; /*!< \brief Standard Reference temperature, usually set to 298.15 K. */
4645
const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */
4746
const su2double Prandtl_Turb_Number; /*!< \brief Prandlt turbulent number.*/
4847
const su2double Schmidt_Turb_Number; /*!< \brief Schmidt turbulent number.*/
@@ -177,7 +176,7 @@ class CFluidScalar final : public CFluidModel {
177176
/*!
178177
* \brief Virtual member.
179178
* \param[in] val_enthalpy - Enthalpy value at the point.
180-
* \param[in] val_scalars - Scalar mass fractions.
179+
* \param[in] val_scalars - Scalar mass fractions.
181180
*/
182181
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override;
183182
};

SU2_CFD/include/fluid/CIncIdealGas.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class CIncIdealGas final : public CFluidModel {
5858
/*--- The EoS only depends upon temperature. ---*/
5959
Temperature = t;
6060
Density = Pressure / (Temperature * Gas_Constant);
61-
Enthalpy = Cp * Temperature;
61+
Enthalpy = Cp * (Temperature - STD_REF_TEMP); // Sensible enthalpy relative to REF_TEMP
6262
}
6363

6464
/*!
@@ -67,7 +67,7 @@ class CIncIdealGas final : public CFluidModel {
6767
*/
6868
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override {
6969
Enthalpy = val_enthalpy;
70-
Temperature = Enthalpy / Cp;
70+
Temperature = Enthalpy / Cp + STD_REF_TEMP; // Temperature from sensible enthalpy
7171
Density = Pressure / (Temperature * Gas_Constant);
7272
}
7373

SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ class CIncIdealGasPolynomial final : public CFluidModel {
5858
* \param[in] config - configuration container for the problem.
5959
*/
6060
void SetCpModel(const CConfig* config) override {
61-
const su2double t_ref = config->GetStandard_RefTemperatureND();
6261
Enthalpy_Ref = 0.0;
6362
su2double t_i = 1.0;
6463
for (int i = 0; i < N; ++i) {
65-
t_i *= t_ref;
64+
t_i *= STD_REF_TEMP;
6665
coeffs_[i] = config->GetCp_PolyCoeffND(i);
6766
Enthalpy_Ref += coeffs_[i] * t_i / (i + 1);
6867
}

SU2_CFD/src/fluid/CFluidScalar.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ CFluidScalar::CFluidScalar(su2double value_pressure_operating, const CConfig* co
4545
: CFluidModel(),
4646
n_species_mixture(config->GetnSpecies() + 1),
4747
Pressure_Thermodynamic(value_pressure_operating),
48-
Ref_Temperature(config->GetStandard_RefTemperatureND()),
4948
GasConstant_Ref(config->GetGas_Constant_Ref()),
5049
Prandtl_Turb_Number(config->GetPrandtl_Turb()),
5150
Schmidt_Turb_Number(config->GetSchmidt_Number_Turbulent()),
@@ -219,14 +218,14 @@ su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, co
219218
* depend on temperature, but it does depend on mixture composition, enthalpy is directly computed from
220219
* the expression h_s = Cp(T - T_ref).
221220
*/
222-
su2double val_Enthalpy = Cp * (val_temperature - Ref_Temperature);
221+
su2double val_Enthalpy = Cp * (val_temperature - STD_REF_TEMP);
223222
return val_Enthalpy;
224223
}
225224

226225
void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) const {
227-
const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - Ref_Temperature);
226+
const su2double enthalpy_species_N = specificHeat[n_species_mixture - 1] * (Temperature - STD_REF_TEMP);
228227
for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) {
229-
const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - Ref_Temperature);
228+
const su2double enthalpy_species_i = specificHeat[iVar] * (Temperature - STD_REF_TEMP);
230229
enthalpy_diffusions[iVar] = Density * (enthalpy_species_i * massDiffusivity[iVar] -
231230
enthalpy_species_N * massDiffusivity[n_species_mixture - 1]);
232231
enthalpy_diffusions[iVar] += Mu_Turb * (enthalpy_species_i - enthalpy_species_N) / Schmidt_Turb_Number;
@@ -271,7 +270,7 @@ void CFluidScalar::SetTDState_h(const su2double val_enthalpy, const su2double* v
271270
* depend on temperature, but it does depend on mixture composition, temperature is directly solved from the
272271
* expression h_s = Cp(T - T_ref).
273272
*/
274-
Temperature = val_enthalpy / Cp + Ref_Temperature;
273+
Temperature = val_enthalpy / Cp + STD_REF_TEMP;
275274
Density = Pressure_Thermodynamic / (Temperature * Gas_Constant);
276275
Cv = Cp - Gas_Constant;
277276

@@ -282,4 +281,5 @@ void CFluidScalar::SetTDState_h(const su2double val_enthalpy, const su2double* v
282281
}
283282

284283
Kt = WilkeConductivity(val_scalars);
284+
ComputeMassDiffusivity();
285285
}

SU2_CFD/src/output/CFlowIncOutput.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
330330
AddVolumeOutput("LAMINAR_VISCOSITY", "Laminar_Viscosity", "PRIMITIVE", "Laminar viscosity");
331331
AddVolumeOutput("HEAT_CAPACITY", "Heat_Capacity", "PRIMITIVE", "Heat capacity");
332332
AddVolumeOutput("THERMAL_CONDUCTIVITY", "Thermal_Conductivity", "PRIMITIVE", "Thermal conductivity");
333-
if (heat || flamelet) AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature");
333+
if (!weakly_coupled_heat)
334+
AddVolumeOutput("TEMPERATURE", "Temperature", "PRIMITIVE", "Temperature");
334335

335336
AddVolumeOutput("SKIN_FRICTION-X", "Skin_Friction_Coefficient_x", "PRIMITIVE", "x-component of the skin friction vector");
336337
AddVolumeOutput("SKIN_FRICTION-Y", "Skin_Friction_Coefficient_y", "PRIMITIVE", "y-component of the skin friction vector");
@@ -354,7 +355,7 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
354355
AddVolumeOutput("RES_VELOCITY-Y", "Residual_Velocity_y", "RESIDUAL", "Residual of the y-velocity component");
355356
if (nDim == 3)
356357
AddVolumeOutput("RES_VELOCITY-Z", "Residual_Velocity_z", "RESIDUAL", "Residual of the z-velocity component");
357-
if (config->GetEnergy_Equation()){
358+
if (heat){
358359
AddVolumeOutput("RES_ENTHALPY", "Residual_Enthalpy", "RESIDUAL", "Residual of the enthalpy");
359360
}
360361
SetVolumeOutputFieldsScalarResidual(config);
@@ -440,7 +441,8 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
440441
SetVolumeOutputValue("LAMINAR_VISCOSITY", iPoint, Node_Flow->GetLaminarViscosity(iPoint));
441442
SetVolumeOutputValue("HEAT_CAPACITY", iPoint, Node_Flow->GetSpecificHeatCp(iPoint));
442443
SetVolumeOutputValue("THERMAL_CONDUCTIVITY", iPoint, Node_Flow->GetThermalConductivity(iPoint));
443-
if (heat || flamelet) SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint));
444+
if (!weakly_coupled_heat)
445+
SetVolumeOutputValue("TEMPERATURE", iPoint, Node_Flow->GetTemperature(iPoint));
444446
}
445447

446448
SetVolumeOutputValue("RES_PRESSURE", iPoint, solver[FLOW_SOL]->LinSysRes(iPoint, 0));

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,9 +2145,9 @@ void CIncEulerSolver::SetPreconditioner(const CConfig *config, unsigned long iPo
21452145
Therefore, we build inv(Precon) here and multiply by the residual
21462146
later in the R-K and Euler Explicit time integration schemes. ---*/
21472147

2148-
2148+
21492149
Preconditioner[0][0] = Enthalpy * BetaInc2 * dRhodh / Density + BetaInc2;
2150-
2150+
21512151
for (iDim = 0; iDim < nDim; iDim++) Preconditioner[iDim + 1][0] = -1.0 * Velocity[iDim] / Density;
21522152

21532153
if (energy) {

0 commit comments

Comments
 (0)