Skip to content

Commit cfa9e2c

Browse files
committed
Moving and cleaning up transport property models.
1 parent 437f5b0 commit cfa9e2c

33 files changed

Lines changed: 2036 additions & 1969 deletions

Common/include/fem/fem_geometry_structure.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class CSortFaces {
174174
* \author E. van der Weide
175175
* \version 7.0.4 "Blackbird"
176176
*/
177-
class CSurfaceElementFEM; // Forward declaration to avoid problems.
177+
struct CSurfaceElementFEM; // Forward declaration to avoid problems.
178178
struct CSortBoundaryFaces {
179179
/*!
180180
* \brief Operator used for the comparison.

Common/include/option_structure.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ const int SU2_CONN_SKIP = 2; /*!< \brief Offset to skip the globalID and VTK
136136

137137
const su2double COLORING_EFF_THRESH = 0.875; /*!< \brief Below this value fallback strategies are used instead. */
138138

139+
constexpr int N_POLY_COEFFS = 5; /*!< \brief Number of coefficients in temperature polynomial fits for fluid models. */; /*!< \brief Number of coefficients in temperature polynomial fits for fluid models. */
140+
139141
/*!
140142
* \brief Boolean answers
141143
*/

Common/src/CConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ void CConfig::SetConfig_Options() {
10851085
Cp(T) = b0 + b1*T + b2*T^2 + b3*T^3 + b4*T^4. By default, all coeffs
10861086
are set to zero and will be properly non-dim. in the solver. ---*/
10871087

1088-
nPolyCoeffs = 5;
1088+
nPolyCoeffs = N_POLY_COEFFS;
10891089
default_cp_polycoeffs = new su2double[nPolyCoeffs]();
10901090
default_mu_polycoeffs = new su2double[nPolyCoeffs]();
10911091
default_kt_polycoeffs = new su2double[nPolyCoeffs]();

SU2_CFD/include/fluid_model.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,14 @@
3434
#include <iostream>
3535
#include <string>
3636
#include <cmath>
37+
#include <memory>
3738

38-
#define LEN_COMPONENTS 32
39-
40-
#include "stdio.h"
41-
#include "math.h"
39+
#include "../include/thermophysical/CViscosityModel.hpp"
40+
#include "../include/thermophysical/CConductivityModel.hpp"
41+
#include "../../Common/include/CConfig.hpp"
4242

4343
using namespace std;
4444

45-
#include "../include/transport_model.hpp"
46-
#include "../../Common/include/CConfig.hpp"
47-
4845
/*!
4946
* \class CFluidModel
5047
* \brief Main class for defining the Thermo-Physical Model
@@ -78,8 +75,8 @@ class CFluidModel {
7875
dktdrho_T, /*!< \brief Specific Heat Capacity at constant pressure. */
7976
dktdT_rho; /*!< \brief Specific Heat Capacity at constant pressure. */
8077

81-
CViscosityModel *LaminarViscosity; /*!< \brief Laminar Viscosity Model */
82-
CConductivityModel *ThermalConductivity; /*!< \brief Thermal Conductivity Model */
78+
unique_ptr<CViscosityModel> LaminarViscosity; /*!< \brief Laminar Viscosity Model */
79+
unique_ptr<CConductivityModel> ThermalConductivity; /*!< \brief Thermal Conductivity Model */
8380

8481
public:
8582

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*!
2+
* \file CConductivityModel.cpp
3+
* \brief Defines an interface class for thermal conductivity models.
4+
* \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon
5+
* \version 7.0.4 "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-2020, 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/datatype_structure.hpp"
31+
32+
using namespace std;
33+
34+
/*!
35+
* \class CConductivityModel
36+
* \brief Interface class for defining the thermal conductivity model.
37+
* \author S. Vitale, M. Pini
38+
*/
39+
class CConductivityModel {
40+
public:
41+
CConductivityModel() = default;
42+
CConductivityModel(const CConductivityModel&) = delete;
43+
void operator=(const CConductivityModel&) = delete;
44+
virtual ~CConductivityModel() {}
45+
46+
/*!
47+
* \brief return conductivity value.
48+
*/
49+
virtual su2double GetConductivity(void) const = 0;
50+
51+
/*!
52+
* \brief return conductivity partial derivative value.
53+
*/
54+
virtual su2double Getdktdrho_T(void) const = 0;
55+
56+
/*!
57+
* \brief return viscosity partial derivative value.
58+
*/
59+
virtual su2double GetdktdT_rho(void) const = 0;
60+
61+
/*!
62+
* \brief Set thermal conductivity.
63+
*/
64+
virtual void SetConductivity(su2double t, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp) = 0;
65+
66+
/*!
67+
* \brief Set thermal conductivity derivatives.
68+
*/
69+
virtual void SetDerConductivity(su2double t, su2double rho, su2double dmudrho_t, su2double dmudt_rho,
70+
su2double cp) = 0;
71+
};
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*!
2+
* \file CConstantConductivity.cpp
3+
* \brief Defines a constant laminar thermal conductivity model.
4+
* \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon
5+
* \version 7.0.4 "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-2020, 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 "CConductivityModel.hpp"
31+
32+
/*!
33+
* \class CConstantConductivity
34+
* \brief Defines a constant thermal conductivity model.
35+
* \author S.Vitale, M.Pini
36+
*/
37+
class CConstantConductivity final : public CConductivityModel {
38+
public:
39+
/*!
40+
* \brief Constructor of the class.
41+
*/
42+
CConstantConductivity(su2double kt_const) : kt_(kt_const) {}
43+
44+
/*!
45+
* \brief return conductivity value.
46+
*/
47+
su2double GetConductivity() const override { return kt_; }
48+
49+
/*!
50+
* \brief return conductivity partial derivative value.
51+
*/
52+
su2double Getdktdrho_T() const override { return dktdrho_t_; }
53+
54+
/*!
55+
* \brief return conductivity partial derivative value.
56+
*/
57+
su2double GetdktdT_rho() const override { return dktdt_rho_; }
58+
59+
/*!
60+
* \brief Set thermal conductivity.
61+
*/
62+
void SetConductivity(su2double t, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp) override {}
63+
64+
/*!
65+
* \brief Set thermal conductivity derivatives.
66+
*/
67+
void SetDerConductivity(su2double t, su2double rho, su2double dmudrho_t, su2double dmudt_rho, su2double cp) override {
68+
}
69+
70+
private:
71+
su2double kt_{0.0}; /*!< \brief Thermal conductivity. */
72+
su2double dktdrho_t_{0.0}; /*!< \brief DktDrho_T. */
73+
su2double dktdt_rho_{0.0}; /*!< \brief DktDT_rho. */
74+
};
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*!
2+
* \file CConstantConductivityRANS.cpp
3+
* \brief Defines a constant conductivity model for RANS problems.
4+
* \author T. Economon
5+
* \version 7.0.4 "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-2020, 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 "CConductivityModel.hpp"
31+
32+
/*!
33+
* \class CConstantConductivityRANS
34+
* \brief Defines a constant laminar thermal conductivity along
35+
* with a turbulent Prandtl number for including effects of
36+
* turbulent heat transfer. Returns the effective conductivity.
37+
* \author T. Economon
38+
*/
39+
class CConstantConductivityRANS final : public CConductivityModel {
40+
public:
41+
/*!
42+
* \brief Constructor of the class.
43+
*/
44+
CConstantConductivityRANS(su2double kt_lam_const, su2double pr_turb)
45+
: kt_lam_const_(kt_lam_const), pr_turb_(pr_turb) {}
46+
47+
/*!
48+
* \brief return conductivity value.
49+
*/
50+
su2double GetConductivity() const override { return kt_; }
51+
52+
/*!
53+
* \brief return conductivity partial derivative value.
54+
*/
55+
su2double Getdktdrho_T() const override { return dktdrho_t_; }
56+
57+
/*!
58+
* \brief return conductivity partial derivative value.
59+
*/
60+
su2double GetdktdT_rho() const override { return dktdt_rho_; }
61+
62+
/*!
63+
* \brief Set thermal conductivity.
64+
*/
65+
void SetConductivity(su2double t, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp) override {
66+
kt_ = kt_lam_const_ + cp * mu_turb / pr_turb_;
67+
}
68+
69+
/*!
70+
* \brief Set thermal conductivity derivatives.
71+
*/
72+
void SetDerConductivity(su2double t, su2double rho, su2double dmudrho_t, su2double dmudt_rho, su2double cp) override {
73+
}
74+
75+
private:
76+
su2double kt_{0.0}; /*!< \brief Effective thermal conductivity. */
77+
su2double dktdrho_t_{0.0}; /*!< \brief DktDrho_T. */
78+
su2double dktdt_rho_{0.0}; /*!< \brief DktDT_rho. */
79+
su2double kt_lam_const_{0.0}; /*!< \brief Constant laminar conductivity. */
80+
su2double pr_turb_{0.0}; /*!< \brief Turbulent Prandtl number. */
81+
};
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*!
2+
* \file CConstantPrandtl.cpp
3+
* \brief Defines a non-constant laminar Prandtl number thermal conductivity model.
4+
* \author S. Vitale, M. Pini, G. Gori, A. Guardone, P. Colonna, T. Economon
5+
* \version 7.0.4 "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-2020, 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 "CConductivityModel.hpp"
31+
32+
/*!
33+
* \class CConstantPrandtl
34+
* \brief Defines a non-constant laminar thermal conductivity using a constant Prandtl's number
35+
* \author S.Vitale, M.Pini
36+
*/
37+
class CConstantPrandtl final : public CConductivityModel {
38+
public:
39+
/*!
40+
* \brief Constructor of the class.
41+
*/
42+
CConstantPrandtl(su2double pr_lam) : pr_lam_(pr_lam) {}
43+
44+
/*!
45+
* \brief return conductivity value.
46+
*/
47+
su2double GetConductivity() const override { return kt_; }
48+
49+
/*!
50+
* \brief return conductivity partial derivative value.
51+
*/
52+
su2double Getdktdrho_T() const override { return dktdrho_t_; }
53+
54+
/*!
55+
* \brief return conductivity partial derivative value.
56+
*/
57+
su2double GetdktdT_rho() const override { return dktdt_rho_; }
58+
59+
/*!
60+
* \brief Set thermal conductivity.
61+
*/
62+
void SetConductivity(su2double t, su2double rho, su2double mu_lam, su2double mu_turb, su2double cp) override {
63+
kt_ = mu_lam * cp / pr_lam_;
64+
}
65+
66+
/*!
67+
* \brief Set thermal conductivity derivatives.
68+
*/
69+
void SetDerConductivity(su2double t, su2double rho, su2double dmudrho_t, su2double dmudt_rho, su2double cp) override {
70+
dktdrho_t_ = dmudrho_t * cp / pr_lam_;
71+
dktdt_rho_ = dmudt_rho * cp / pr_lam_;
72+
}
73+
74+
private:
75+
su2double kt_{0.0}; /*!< \brief Thermal conductivity. */
76+
su2double dktdrho_t_{0.0}; /*!< \brief DktDrho_T. */
77+
su2double dktdt_rho_{0.0}; /*!< \brief DktDT_rho. */
78+
su2double pr_lam_{0.0}; /*!< \brief Laminar Prandtl number. */
79+
};

0 commit comments

Comments
 (0)