Skip to content

Commit 5477a05

Browse files
making enthalpy the working variable
1 parent 807667f commit 5477a05

22 files changed

+218
-423
lines changed

SU2_CFD/include/fluid/CConstantDensity.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ class CConstantDensity final : public CFluidModel {
5858
Temperature = t;
5959
Enthalpy = Cp * Temperature;
6060
}
61+
62+
void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) {
63+
Enthalpy = val_enthalpy;
64+
Temperature = Enthalpy / Cp;
65+
}
6166
};

SU2_CFD/include/fluid/CFluidFlamelet.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ class CFluidFlamelet final : public CFluidModel {
118118
*/
119119
void SetTDState_T(su2double val_temperature, const su2double* val_scalars = nullptr) override;
120120

121+
/*!
122+
* \brief Set the thermodynamic state.
123+
* \param[in] val_enthalpy - enthalpy
124+
* \param[in] val_scalars - pointer to species mass fractions
125+
*/
126+
void SetTDState_h(su2double val_enthalpy, const su2double* val_scalars = nullptr) override;
127+
121128
/*!
122129
* \brief Evaluate data-set for flamelet simulations.
123130
* \param[in] input_scalar - controlling variables used to interpolate manifold.

SU2_CFD/include/fluid/CIncIdealGas.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ class CIncIdealGas final : public CFluidModel {
6161
Enthalpy = Cp * Temperature;
6262
}
6363

64+
void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) {
65+
Enthalpy = val_enthalpy;
66+
Temperature = Enthalpy / Cp;
67+
Density = Pressure / (Temperature * Gas_Constant);
68+
}
69+
6470
private:
6571
su2double Gas_Constant{0.0}; /*!< \brief Gas Constant. */
6672
su2double Gamma{0.0}; /*!< \brief Heat Capacity Ratio. */

SU2_CFD/include/fluid/CIncIdealGasPolynomial.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ class CIncIdealGasPolynomial final : public CFluidModel {
8383
Enthalpy = Cp * Temperature;
8484
}
8585

86+
void SetTDState_h(const su2double val_enthalpy, const su2double* val_scalars) {
87+
Enthalpy = val_enthalpy;
88+
Temperature = Enthalpy / Cp;
89+
Density = Pressure / (Temperature * Gas_Constant);
90+
/* Evaluate the new Cp from the coefficients and temperature. */
91+
Cp = coeffs_[0];
92+
su2double t_i = 1.0;
93+
for (int i = 1; i < N; ++i) {
94+
t_i *= Temperature;
95+
Cp += coeffs_[i] * t_i;
96+
}
97+
Cv = Cp / Gamma;
98+
}
99+
86100
private:
87101
su2double Gas_Constant{0.0}; /*!< \brief Specific Gas Constant. */
88102
su2double Gamma{0.0}; /*!< \brief Ratio of specific heats. */

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class CNumerics {
191191

192192
bool nemo; /*!< \brief Flag for NEMO problems */
193193

194-
bool energy_multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */
194+
bool multicomponent = false; /*!< \brief Flag for multicomponent and reacting flow */
195195

196196
bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */
197197

@@ -1058,8 +1058,7 @@ class CNumerics {
10581058
* \param[in] val_density - Value of the density.
10591059
* \param[in] val_velocity - Pointer to the velocity.
10601060
* \param[in] val_betainc2 - Value of the artificial compresibility factor.
1061-
* \param[in] val_cp - Value of the specific heat at constant pressure.
1062-
* \param[in] val_temperature - Value of the temperature.
1061+
* \param[in] val_enthalpy - Value of the enthalpy.
10631062
* \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature.
10641063
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
10651064
* \param[in] val_scale - Scale of the projection.
@@ -1068,8 +1067,7 @@ class CNumerics {
10681067
void GetInviscidIncProjJac(const su2double *val_density,
10691068
const su2double *val_velocity,
10701069
const su2double *val_betainc2,
1071-
const su2double *val_cp,
1072-
const su2double *val_temperature,
1070+
const su2double *val_enthalpy,
10731071
const su2double *val_dRhodT,
10741072
const su2double *val_normal,
10751073
su2double val_scale,
@@ -1080,17 +1078,15 @@ class CNumerics {
10801078
* \param[in] val_density - Value of the density.
10811079
* \param[in] val_velocity - Pointer to the velocity.
10821080
* \param[in] val_betainc2 - Value of the artificial compresibility factor.
1083-
* \param[in] val_cp - Value of the specific heat at constant pressure.
1084-
* \param[in] val_temperature - Value of the temperature.
1085-
* \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature.
1081+
* \param[in] val_enthalpy - Value of the enthalpy.
1082+
* \param[in] val_dRhodh - Value of the derivative of density w.r.t. enthalpy.
10861083
* \param[out] val_Precon - Pointer to the preconditioning matrix.
10871084
*/
10881085
void GetPreconditioner(const su2double *val_density,
10891086
const su2double *val_velocity,
10901087
const su2double *val_betainc2,
1091-
const su2double *val_cp,
1092-
const su2double *val_temperature,
1093-
const su2double *val_drhodt,
1088+
const su2double *val_enthalpy,
1089+
const su2double *val_drhodh,
10941090
su2double **val_Precon) const;
10951091

10961092
/*!

SU2_CFD/include/numerics/flow/convection/centered.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ class CCentLaxInc_Flow final : public CNumerics {
4848
Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */
4949
MeanDensity, MeanPressure,
5050
MeanBetaInc2, MeanEnthalpy,
51-
MeanCp, MeanTemperature,
52-
MeanWorkingVar, /*!< \brief Mean values of primitive variables. */
53-
MeandRhodT, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */
51+
MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */
52+
MeandRhodh, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */
5453
Param_p, Param_Kappa_0, /*!< \brief Artificial dissipation parameters. */
5554
Local_Lambda_i, Local_Lambda_j,
5655
MeanLambda, /*!< \brief Local eingenvalues. */
@@ -109,9 +108,8 @@ class CCentJSTInc_Flow final : public CNumerics {
109108
Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */
110109
MeanDensity, MeanPressure,
111110
MeanBetaInc2, MeanEnthalpy,
112-
MeanCp, MeanTemperature,
113-
MeanWorkingVar, /*!< \brief Mean values of primitive variables. */
114-
MeandRhodT, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */
111+
MeanCp, MeanTemperature, /*!< \brief Mean values of primitive variables. */
112+
MeandRhodh, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */
115113
Param_p, Param_Kappa_2,
116114
Param_Kappa_4, /*!< \brief Artificial dissipation parameters. */
117115
Local_Lambda_i, Local_Lambda_j,

SU2_CFD/include/numerics/flow/convection/fds.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ class CUpwFDSInc_Flow final : public CNumerics {
4949
su2double **Precon, **invPrecon_A;
5050
su2double Proj_ModJac_Tensor_ij, Pressure_i,
5151
Pressure_j, ProjVelocity,
52-
MeandRhodT, dRhodT_i, dRhodT_j, /*!< \brief Derivative of density w.r.t. temperature (variable density flows). */
52+
MeandRhodh, dRhodh_i, dRhodh_j, /*!< \brief Derivative of density w.r.t. enthalpy (variable density flows). */
5353
Temperature_i, Temperature_j, /*!< \brief Temperature at node 0 and 1. */
54-
MeanDensity, MeanPressure, MeanSoundSpeed, MeanBetaInc2, MeanWorkingVar, MeanCp, MeanTemperature; /*!< \brief Mean values of primitive variables. */
54+
MeanDensity, MeanPressure, MeanSoundSpeed, MeanBetaInc2, MeanEnthalpy, MeanCp, MeanTemperature; /*!< \brief Mean values of primitive variables. */
5555
unsigned short iDim, iVar, jVar, kVar;
5656

5757
su2double* Flux = nullptr; /*!< \brief The flux / residual across the edge. */

SU2_CFD/include/output/CAdjFlowIncOutput.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class CAdjFlowIncOutput final: public CAdjFlowOutput {
4040
RADIATION_MODEL rad_model; /*!< \brief The kind of radiation model */
4141
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
4242
bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/
43-
bool multicomponent; /*!< \brief Boolean indicating whether have a multicomponent problem*/
4443

4544
public:
4645

SU2_CFD/include/variables/CIncEulerVariable.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
/*!
3434
* \class CIncEulerVariable
3535
* \brief Class for defining the variables of the incompressible Euler solver.
36-
* \note Primitive variables (P, vx, vy, vz, T, rho, beta, lamMu, EddyMu, Kt_eff, Cp, Cv)
37-
* \note Gradients of primitives (P, vx, vy, vz, T, rho, beta)
36+
* \note Primitive variables (P, vx, vy, vz, T, rho,h, beta, lamMu, EddyMu, Kt_eff, Cp, Cv)
37+
* \note Gradients of primitives (P, vx, vy, vz, T, rho, h)
3838
* \ingroup Euler_Equations
3939
* \author F. Palacios, T. Economon, T. Albring
4040
*/
@@ -52,14 +52,14 @@ class CIncEulerVariable : public CFlowVariable {
5252
inline IndexType Velocity() const { return 1; }
5353
inline IndexType Temperature() const { return nDim+1; }
5454
inline IndexType Density() const { return nDim+2; }
55-
inline IndexType Beta() const { return nDim+3; }
55+
inline IndexType Enthalpy() const { return nDim+3; }
56+
inline IndexType Beta() const { return nDim+4; }
5657
inline IndexType SoundSpeed() const { return Beta(); }
57-
inline IndexType LaminarViscosity() const { return nDim+4; }
58-
inline IndexType EddyViscosity() const { return nDim+5; }
59-
inline IndexType ThermalConductivity() const { return nDim+6; }
60-
inline IndexType CpTotal() const { return nDim+7; }
61-
inline IndexType CvTotal() const { return nDim+8; }
62-
inline IndexType Enthalpy() const { return nDim + 9; }
58+
inline IndexType LaminarViscosity() const { return nDim+5; }
59+
inline IndexType EddyViscosity() const { return nDim+6; }
60+
inline IndexType ThermalConductivity() const { return nDim+7; }
61+
inline IndexType CpTotal() const { return nDim+8; }
62+
inline IndexType CvTotal() const { return nDim+9; }
6363

6464
/*--- For compatible interface with NEMO. ---*/
6565
inline IndexType SpeciesDensities() const { return std::numeric_limits<IndexType>::max(); }

SU2_CFD/include/variables/CIncNSVariable.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class CIncNSVariable final : public CIncEulerVariable {
4040
private:
4141
VectorType Tau_Wall; /*!< \brief Magnitude of the wall shear stress from a wall function. */
4242
VectorType DES_LengthScale;
43-
bool Energy_Multicomponent = false;
4443

4544
public:
4645
/*!

0 commit comments

Comments
 (0)