Skip to content

Commit 399b73b

Browse files
Cristopher-Moralespcarruscagbigfooted
authored
Composition-dependent heat capacities and mass diffusivity models for incompresible flows (#1762)
* adding commits from branch feature_massdiffusivity * adding test cases * Update Common/src/CConfig.cpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * adding pull request comments * adding NonDimensional test case * adding description test case * removing unneccesary cv implementation * cleaning up and updating some implementations * change needed for Adjoint problems * Update SU2_CFD/include/fluid/CConstantSchmidtRANS.hpp Co-authored-by: Nijso <nijso@hotmail.com> * Update SU2_CFD/include/fluid/CDiffusivityModel.hpp Co-authored-by: Nijso <nijso@hotmail.com> * Update TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_ND.cfg Co-authored-by: Nijso <nijso@hotmail.com> * Update TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_mixingmodel_ND.cfg Co-authored-by: Nijso <nijso@hotmail.com> * cleaning up and removing virtual function * Update Common/include/CConfig.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/fluid/CConstantSchmidt.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/fluid/CConstantSchmidtRANS.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * Update SU2_CFD/include/fluid/CUnityLewisDiffusivity.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * removing cv implementations and updating ND case * undo lambda implementation * changing PASSIVE_SCALAR to SPECIES_TRANSPORT and updating residuals Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Co-authored-by: Nijso <nijso@hotmail.com>
1 parent 8984689 commit 399b73b

31 files changed

Lines changed: 778 additions & 109 deletions

Common/include/CConfig.hpp

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,9 @@ class CConfig {
805805
Gas_Constant, /*!< \brief Specific gas constant. */
806806
Gas_ConstantND, /*!< \brief Non-dimensional specific gas constant. */
807807
*Molecular_Weight; /*!< \brief Molecular weight of an incompressible ideal gas (g/mol). */
808-
unsigned short nMolecular_Weight; /*!< \brief Number of species molecular weights. */
809-
su2double Specific_Heat_Cp, /*!< \brief Specific heat at constant pressure. */
810-
Specific_Heat_CpND, /*!< \brief Non-dimensional specific heat at constant pressure. */
811-
Specific_Heat_Cv, /*!< \brief Specific heat at constant volume. */
812-
Specific_Heat_CvND, /*!< \brief Non-dimensional specific heat at constant volume. */
808+
unsigned short nMolecular_Weight, /*!< \brief Number of species molecular weights. */
809+
nSpecific_Heat_Cp; /*!< \brief Number of species specific heat constants at constant pressure. */
810+
su2double *Specific_Heat_Cp, /*!< \brief Specific heat at constant pressure. */
813811
Thermal_Expansion_Coeff, /*!< \brief Thermal expansion coefficient. */
814812
Thermal_Expansion_CoeffND, /*!< \brief Non-dimensional thermal expansion coefficient. */
815813
Inc_Density_Ref, /*!< \brief Reference density for custom incompressible non-dim. */
@@ -1619,25 +1617,13 @@ class CConfig {
16191617
* \brief Get the value of specific heat at constant pressure.
16201618
* \return Value of the constant: Cp
16211619
*/
1622-
su2double GetSpecific_Heat_Cp(void) const { return Specific_Heat_Cp; }
1620+
su2double GetSpecific_Heat_Cp(unsigned short val_index = 0) const { return Specific_Heat_Cp[val_index]; }
16231621

16241622
/*!
16251623
* \brief Get the non-dimensional value of specific heat at constant pressure.
16261624
* \return Value of the non-dim. constant: Cp
16271625
*/
1628-
su2double GetSpecific_Heat_CpND(void) const { return Specific_Heat_CpND; }
1629-
1630-
/*!
1631-
* \brief Get the value of specific heat at constant volume.
1632-
* \return Value of the constant: Cv
1633-
*/
1634-
su2double GetSpecific_Heat_Cv(void) const { return Specific_Heat_Cv; }
1635-
1636-
/*!
1637-
* \brief Get the non-dimensional value of specific heat at constant volume.
1638-
* \return Value of the non-dim. constant: Cv
1639-
*/
1640-
su2double GetSpecific_Heat_CvND(void) const { return Specific_Heat_CvND; }
1626+
su2double GetSpecific_Heat_CpND(unsigned short val_index = 0) const { return Specific_Heat_Cp[val_index] / Gas_Constant_Ref; }
16411627

16421628
/*!
16431629
* \brief Get the value of wall temperature.
@@ -2427,30 +2413,6 @@ class CConfig {
24272413
*/
24282414
void SetGas_Constant(su2double val_gas_constant) { Gas_Constant = val_gas_constant; }
24292415

2430-
/*!
2431-
* \brief Set the value of the specific heat at constant pressure (incompressible fluids with energy equation).
2432-
* \param[in] val_specific_heat_cp - specific heat at constant pressure.
2433-
*/
2434-
void SetSpecific_Heat_Cp(su2double val_specific_heat_cp) { Specific_Heat_Cp = val_specific_heat_cp; }
2435-
2436-
/*!
2437-
* \brief Set the non-dimensional value of the specific heat at constant pressure (incompressible fluids with energy equation).
2438-
* \param[in] val_specific_heat_cpnd - non-dim. specific heat at constant pressure.
2439-
*/
2440-
void SetSpecific_Heat_CpND(su2double val_specific_heat_cpnd) { Specific_Heat_CpND = val_specific_heat_cpnd; }
2441-
2442-
/*!
2443-
* \brief Set the value of the specific heat at constant volume (incompressible fluids with energy equation).
2444-
* \param[in] val_specific_heat_cv - specific heat at constant volume.
2445-
*/
2446-
void SetSpecific_Heat_Cv(su2double val_specific_heat_cv) { Specific_Heat_Cv = val_specific_heat_cv; }
2447-
2448-
/*!
2449-
* \brief Set the non-dimensional value of the specific heat at constant volume (incompressible fluids with energy equation).
2450-
* \param[in] val_specific_heat_cvnd - non-dim. specific heat at constant pressure.
2451-
*/
2452-
void SetSpecific_Heat_CvND(su2double val_specific_heat_cvnd) { Specific_Heat_CvND = val_specific_heat_cvnd; }
2453-
24542416
/*!
24552417
* \brief Set the heat flux reference value.
24562418
* \return Value of the reference heat flux.
@@ -3831,6 +3793,12 @@ class CConfig {
38313793
*/
38323794
CONDUCTIVITYMODEL_TURB GetKind_ConductivityModel_Turb() const { return Kind_ConductivityModel_Turb; }
38333795

3796+
/*!
3797+
* \brief Get the value of the mass diffusivity model.
3798+
* \return Mass diffusivity model.
3799+
*/
3800+
DIFFUSIVITYMODEL GetKind_Diffusivity_Model(void) const { return Kind_Diffusivity_Model; }
3801+
38343802
/*!
38353803
* \brief Get the value of the constant viscosity.
38363804
* \return Constant viscosity.

Common/include/option_structure.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,11 +1177,11 @@ static const MapType<std::string, TURB_TRANS_MODEL> Trans_Model_Map = {
11771177
*/
11781178
enum class SPECIES_MODEL {
11791179
NONE, /*!< \brief No scalar transport model. */
1180-
PASSIVE_SCALAR, /*!< \brief Passive scalar transport model. */
1180+
SPECIES_TRANSPORT, /*!< \brief Passive scalar transport model. */
11811181
};
11821182
static const MapType<std::string, SPECIES_MODEL> Species_Model_Map = {
11831183
MakePair("NONE", SPECIES_MODEL::NONE)
1184-
MakePair("PASSIVE_SCALAR", SPECIES_MODEL::PASSIVE_SCALAR)
1184+
MakePair("SPECIES_TRANSPORT", SPECIES_MODEL::SPECIES_TRANSPORT)
11851185
};
11861186

11871187
/*!

Common/src/CConfig.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,7 @@ void CConfig::SetConfig_Options() {
11611161
/*!\brief GAMMA_VALUE \n DESCRIPTION: Ratio of specific heats (1.4 (air), only for compressible flows) \ingroup Config*/
11621162
addDoubleOption("GAMMA_VALUE", Gamma, 1.4);
11631163
/*!\brief CP_VALUE \n DESCRIPTION: Specific heat at constant pressure, Cp (1004.703 J/kg*K (air), constant density incompressible fluids only) \ingroup Config*/
1164-
addDoubleOption("SPECIFIC_HEAT_CP", Specific_Heat_Cp, 1004.703);
1165-
/*!\brief CP_VALUE \n DESCRIPTION: Specific heat at constant volume, Cp (717.645 J/kg*K (air), constant density incompressible fluids only) \ingroup Config*/
1166-
addDoubleOption("SPECIFIC_HEAT_CV", Specific_Heat_Cv, 717.645);
1164+
addDoubleListOption("SPECIFIC_HEAT_CP", nSpecific_Heat_Cp, Specific_Heat_Cp);
11671165
/*!\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*/
11681166
addDoubleOption("THERMAL_EXPANSION_COEFF", Thermal_Expansion_Coeff, 0.00347);
11691167
/*!\brief MOLECULAR_WEIGHT \n DESCRIPTION: Molecular weight for an incompressible ideal gas (28.96 g/mol (air) default) \ingroup Config*/
@@ -3754,6 +3752,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
37543752
const su2double Mu_Ref_Default = Mu_Constant_Default;
37553753
const su2double Mu_Temperature_Ref_Default = (SystemMeasurements == SI) ? 273.15 : (273.15 * 1.8);
37563754
const su2double Mu_S_Default = (SystemMeasurements == SI) ? 110.4 : (110.4 * 1.8);
3755+
const su2double Specific_Heat_Cp_Default = 1004.703;
37573756
const su2double Thermal_Conductivity_Constant_Default = (SystemMeasurements == SI) ? 2.57E-2 : (2.57E-2 * 0.577789317);
37583757
const su2double Prandtl_Lam_Default = 0.72;
37593758
const su2double Prandtl_Turb_Default = 0.9;
@@ -3767,6 +3766,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
37673766
};
37683767

37693768
SetDefaultIfEmpty(Molecular_Weight, nMolecular_Weight, Molecular_Weight_Default);
3769+
SetDefaultIfEmpty(Specific_Heat_Cp, nSpecific_Heat_Cp, Specific_Heat_Cp_Default);
37703770
SetDefaultIfEmpty(Mu_Constant, nMu_Constant, Mu_Constant_Default);
37713771
if (Mu_Ref == nullptr && Mu_Temperature_Ref == nullptr && Mu_S == nullptr) {
37723772
SetDefaultIfEmpty(Mu_Ref, nMu_Ref, Mu_Ref_Default);
@@ -3782,10 +3782,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
37823782

37833783
if (Kind_FluidModel == FLUID_MIXTURE) {
37843784
/*--- Check whether the number of entries of each specified fluid property equals the number of transported scalar
3785-
equations solved + 1. nMolecular_Weight is used because it is required for the fluid mixing models. --- */
3786-
if (nMolecular_Weight != nSpecies_Init + 1) {
3785+
equations solved + 1. nMolecular_Weight and nSpecific_Heat_Cp are used because it is required for the fluid mixing models.
3786+
* Cp is required in case of MIXTURE_FLUID_MODEL because the energy equation needs to be active.--- */
3787+
if (nMolecular_Weight != nSpecies_Init + 1 || nSpecific_Heat_Cp != nSpecies_Init + 1) {
37873788
SU2_MPI::Error(
3788-
"The use of FLUID_MIXTURE requires the number of entries for MOLECULAR_WEIGHT\n"
3789+
"The use of FLUID_MIXTURE requires the number of entries for MOLECULAR_WEIGHT and SPECIFIC_HEAT_CP,\n"
37893790
"to be equal to the number of entries of SPECIES_INIT + 1",
37903791
CURRENT_FUNCTION);
37913792
}
@@ -4831,7 +4832,7 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
48314832

48324833
/*--- Energy equation must be active for any fluid models other than constant density. ---*/
48334834

4834-
if (Kind_DensityModel != INC_DENSITYMODEL::CONSTANT) Energy_Equation = true;
4835+
if ((Kind_DensityModel != INC_DENSITYMODEL::CONSTANT) && (Kind_Species_Model==SPECIES_MODEL::NONE)) Energy_Equation = true;
48354836

48364837
if (Kind_DensityModel == INC_DENSITYMODEL::BOUSSINESQ) {
48374838
Energy_Equation = true;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*!
2+
* \file CConstantDiffusivity.hpp
3+
* \brief Defines constant mass diffusivity.
4+
* \author T. Economon, Cristopher Morales Ubal
5+
* \version 7.4.0 "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-2022, 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+
*/
27+
28+
#pragma once
29+
30+
#include "CDiffusivityModel.hpp"
31+
32+
/*!
33+
* \class CConstantDiffusivity
34+
* \brief Defines a constant mass diffusivity model for species equations.
35+
* \author T. Economon
36+
*/
37+
class CConstantDiffusivity final : public CDiffusivityModel {
38+
public:
39+
/*!
40+
* \brief Constructor of the class.
41+
*/
42+
CConstantDiffusivity(su2double diff_const) { diff_ = diff_const; }
43+
44+
/*!
45+
* \brief Set diffusivity.
46+
*/
47+
void SetDiffusivity(su2double T, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp,
48+
su2double kt) override {}
49+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*!
2+
* \file CConstantSchmidt.hpp
3+
* \brief Defines a mass diffusivity model with constant Schmidt numbers.
4+
* \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon
5+
* \version 7.4.0 "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-2022, 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+
*/
27+
28+
#pragma once
29+
30+
#include "CDiffusivityModel.hpp"
31+
32+
/*!
33+
* \class CDiffusivityModel
34+
* \brief Defines a mass diffusivity model for species equations based on Schmidt number.
35+
* \author T. Economon
36+
*/
37+
class CConstantSchmidt final : public CDiffusivityModel {
38+
public:
39+
40+
/*!
41+
* \brief Constructor of the class.
42+
*/
43+
CConstantSchmidt(su2double sc_lam) : sc_lam_(sc_lam) {}
44+
45+
/*!
46+
* \brief Set diffusivity.
47+
*/
48+
void SetDiffusivity(su2double T, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp,
49+
su2double kt) override {
50+
diff_ = mu_lam / (rho * sc_lam_);
51+
}
52+
53+
private:
54+
su2double sc_lam_{0.0};
55+
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*!
2+
* \file CConstantSchmidtRANS.hpp
3+
* \brief Defines a mass diffusivity model with constant Schmidt numbers for RANS.
4+
* \author T. Economon, C. Morales
5+
* \version 7.4.0 "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-2022, 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+
*/
27+
28+
#pragma once
29+
30+
#include "CDiffusivityModel.hpp"
31+
32+
/*!
33+
* \class CDiffusivityModelRANS
34+
* \brief Defines a mass diffusivity model for species equations based on Schmidt numbers for RANS.
35+
* \author T. Economon
36+
*/
37+
class CConstantSchmidtRANS final : public CDiffusivityModel {
38+
public:
39+
40+
/*!
41+
* \brief Constructor of the class.
42+
*/
43+
CConstantSchmidtRANS(su2double diff_lam_const, su2double sc_turb)
44+
: diff_lam_const_(diff_lam_const), sc_turb_(sc_turb) {}
45+
46+
/*!
47+
* \brief Set mass diffusivity.
48+
*/
49+
void SetDiffusivity(su2double t, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp,
50+
su2double kt) override {
51+
diff_ = diff_lam_const_ + mu_turb / (rho * sc_turb_);
52+
}
53+
54+
private:
55+
su2double diff_lam_const_{0.0};
56+
su2double sc_turb_{0.0};
57+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*!
2+
* \file CDiffusivityModel.hpp
3+
* \brief Interface class for defining mass diffusivity models.
4+
* \author T. Economon, C. Morales
5+
* \version 7.4.0 "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-2022, 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+
*/
27+
28+
#pragma once
29+
30+
#include "../../../Common/include/basic_types/datatype_structure.hpp"
31+
32+
/*!
33+
* \class CDiffusivityModel
34+
* \brief Defines a mass diffusivity model for species equations.
35+
* \author T. Economon
36+
*/
37+
class CDiffusivityModel {
38+
public:
39+
virtual ~CDiffusivityModel() = default;
40+
41+
/*!
42+
* \brief Get mass diffusivity
43+
*/
44+
su2double GetDiffusivity() const { return diff_; }
45+
46+
/*!
47+
* \brief Set mass diffusivity
48+
*/
49+
virtual void SetDiffusivity(su2double T, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp,
50+
su2double kt) = 0;
51+
52+
protected:
53+
su2double diff_{0.0}; /*!< \brief mass diffusivity. */
54+
};

0 commit comments

Comments
 (0)