Skip to content

Commit 8f92f77

Browse files
committed
Merge branch 'develop' into preacc_performance
2 parents f4feba9 + 0699292 commit 8f92f77

36 files changed

Lines changed: 913 additions & 444 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ class CConfig {
909909
Tke_FreeStreamND, /*!< \brief Farfield kinetic energy (external flow). */
910910
Omega_FreeStreamND, /*!< \brief Specific dissipation (external flow). */
911911
Omega_FreeStream; /*!< \brief Specific dissipation (external flow). */
912+
bool Variable_Density; /*!< \brief Variable density for incompressible flow. */
912913
unsigned short nElectric_Constant; /*!< \brief Number of different electric constants. */
913914
su2double *Electric_Constant; /*!< \brief Dielectric constant modulus. */
914915
su2double Knowles_B, /*!< \brief Knowles material model constant B. */
@@ -1229,9 +1230,10 @@ class CConfig {
12291230
unsigned short n_user_sources = 0; /*!< \brief Number of source terms for user defined (auxiliary) scalar transport equations. */
12301231
unsigned short n_control_vars = 0; /*!< \brief Number of controlling variables (independent variables) for the LUT. */
12311232

1233+
string* controlling_variable_names;
1234+
string* cv_source_names;
12321235
vector<string> table_scalar_names; /*!< \brief Names of transported scalar variables. */
1233-
string* table_lookup_names; /*!< \brief Names of LUT variables. */
1234-
string file_name_lut; /*!< \brief Filename of the LUT. */
1236+
string* lookup_names; /*!< \brief Names of passive look-up variables. */
12351237
string* user_scalar_names; /*!< \brief Names of the user defined (auxiliary) transported scalars .*/
12361238
string* user_source_names; /*!< \brief Names of the source terms for the user defined transported scalars. */
12371239

@@ -2151,6 +2153,19 @@ class CConfig {
21512153
*/
21522154
unsigned short GetNUserScalars() const { return n_user_scalars; }
21532155

2156+
/*!
2157+
* \brief Get the name of a specific controlling variable.
2158+
*/
2159+
const string& GetControllingVariableName(unsigned short i_cv) const {
2160+
return controlling_variable_names[i_cv];
2161+
}
2162+
2163+
/*!
2164+
* \brief Get the name of the source term variable for a specific controlling variable.
2165+
*/
2166+
const string& GetControllingVariableSourceName(unsigned short i_cv) const {
2167+
return cv_source_names[i_cv];
2168+
}
21542169
/*!
21552170
* \brief Get the name of the user scalar.
21562171
*/
@@ -2175,13 +2190,7 @@ class CConfig {
21752190
/*!
21762191
* \brief Get the name of the variable that we want to retrieve from the lookup table.
21772192
*/
2178-
const string& GetLUTLookupName(unsigned short i_lookup) const { return table_lookup_names[i_lookup]; }
2179-
2180-
/*!
2181-
* \brief Get the file name of the look up table.
2182-
* \return File name of the look up table.
2183-
*/
2184-
const string& GetFileNameLUT() const { return file_name_lut; }
2193+
const string& GetLookupName(unsigned short i_lookup) const { return lookup_names[i_lookup]; }
21852194

21862195
/*!
21872196
* \brief Get the Young's modulus of elasticity.
@@ -3884,6 +3893,12 @@ class CConfig {
38843893
*/
38853894
INC_DENSITYMODEL GetKind_DensityModel() const { return Kind_DensityModel; }
38863895

3896+
/*!
3897+
* \brief Selection of variable density option for incompressible flows.
3898+
* \return Flag for variable density for incompressible flows.
3899+
*/
3900+
bool GetVariable_Density_Model() const { return Variable_Density; }
3901+
38873902
/*!
38883903
* \brief Flag for whether to solve the energy equation for incompressible flows.
38893904
* \return Flag for energy equation

Common/include/containers/CLookUpTable.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class CLookUpTable {
7676
*/
7777
su2vector<su2activematrix> table_data;
7878

79+
double memory_footprint_data = 0; /*!< \brief Memory footprint of the loaded table data. */
80+
7981
/*! \brief
8082
* Holds all connectivity data stored in the table for each level. First index
8183
* addresses the variable while second index addresses the point.
@@ -216,7 +218,7 @@ class CLookUpTable {
216218
*/
217219
void Linear_Interpolation(const su2double val_CV3, const unsigned long lower_level, const unsigned long upper_level,
218220
std::vector<su2double>& lower_values, std::vector<su2double>& upper_values,
219-
std::vector<su2double*>& var_vals) const;
221+
std::vector<su2double>& var_vals) const;
220222

221223
/*!
222224
* \brief Find the point on the hull (boundary of the table) that is closest to the point P(val_CV1,val_CV2).
@@ -345,7 +347,7 @@ class CLookUpTable {
345347
* \param[in] val_CV3 - Value of controlling variable 3.
346348
* \returns 1 if the lookup and subsequent interpolation was a success, 0 if not.
347349
*/
348-
unsigned long LookUp_XYZ(const std::vector<std::string>& val_names_var, std::vector<su2double*>& val_vars,
350+
unsigned long LookUp_XYZ(const std::vector<std::string>& val_names_var, std::vector<su2double>& val_vars,
349351
su2double val_CV1, su2double val_CV2, su2double val_CV3 = 0);
350352

351353
/*!

Common/include/containers/CTrapezoidalMap.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ class CTrapezoidalMap {
5454
* same band. Used to sort the edges */
5555
su2vector<std::vector<std::pair<su2double, unsigned long> > > y_edge_at_band_mid;
5656

57+
double memory_footprint = 0;
58+
5759
public:
5860
CTrapezoidalMap() = default;
5961

6062
CTrapezoidalMap(const su2double* samples_x, const su2double* samples_y, const unsigned long size,
6163
const std::vector<std::array<unsigned long, 2> >& edges,
62-
const su2vector<std::vector<unsigned long> >& edge_to_triangle);
64+
const su2vector<std::vector<unsigned long> >& edge_to_triangle, bool display = false);
6365

6466
/*!
6567
* \brief return the index to the triangle that contains the coordinates (val_x,val_y)
@@ -97,4 +99,10 @@ class CTrapezoidalMap {
9799
inline bool IsInsideHullX(su2double val_x) {
98100
return (val_x >= unique_bands_x.front()) && (val_x <= unique_bands_x.back());
99101
}
102+
103+
/*!
104+
* \brief get memory footprint of trapezoidal map.
105+
* \return - memory footprint in mega bytes.
106+
*/
107+
double GetMemoryFootprint() const { return memory_footprint; }
100108
};

Common/include/linear_algebra/CSysSolve.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class CSysSolve {
168168
* \brief Modified Gram-Schmidt orthogonalization
169169
* \author Based on Kesheng John Wu's mgsro subroutine in Saad's SPARSKIT
170170
*
171+
* \param[in] shared_hsbg - if the Hessenberg matrix is shared by multiple threads
171172
* \param[in] i - index indicating which vector in w is being orthogonalized
172173
* \param[in,out] Hsbg - the upper Hessenberg begin updated
173174
* \param[in,out] w - the (i+1)th vector of w is orthogonalized against the
@@ -181,7 +182,7 @@ class CSysSolve {
181182
* vector is kept in nrm0 and updated after operating with each vector
182183
*
183184
*/
184-
void ModGramSchmidt(int i, su2matrix<ScalarType>& Hsbg, std::vector<VectorType>& w) const;
185+
void ModGramSchmidt(bool shared_hsbg, int i, su2matrix<ScalarType>& Hsbg, std::vector<VectorType>& w) const;
185186

186187
/*!
187188
* \brief writes header information for a CSysSolve residual history

Common/include/linear_algebra/vector_expressions.hpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -146,28 +146,30 @@ MAKE_UNARY_FUN(sign, sign_, sign_impl)
146146

147147
/*--- Macro to create expressions and overloads for binary functions. ---*/
148148

149-
#define MAKE_BINARY_FUN(FUN, EXPR, IMPL) \
150-
/*!--- Expression class. ---*/ \
151-
template <class U, class V, class Scalar> \
152-
class EXPR : public CVecExpr<EXPR<U, V, Scalar>, Scalar> { \
153-
store_t<const U> u; \
154-
store_t<const V> v; \
155-
\
156-
public: \
157-
static constexpr bool StoreAsRef = false; \
158-
FORCEINLINE EXPR(const U& u_, const V& v_) : u(u_), v(v_) {} \
159-
FORCEINLINE auto operator[](size_t i) const RETURNS(IMPL(u[i], v[i])) \
160-
}; \
161-
/*!--- Vector with vector function overload. ---*/ \
162-
template <class U, class V, class S> \
163-
FORCEINLINE auto FUN(const CVecExpr<U, S>& u, const CVecExpr<V, S>& v) \
164-
RETURNS(EXPR<U, V, S>(u.derived(), v.derived())) /*!--- Vector with scalar function overload. ---*/ \
165-
template <class U, class S> \
166-
FORCEINLINE auto FUN(const CVecExpr<U, S>& u, decay_t<S> v) \
167-
RETURNS(EXPR<U, Bcast<S>, S>(u.derived(), Bcast<S>(v))) /*!--- Scalar with vector function overload. ---*/ \
168-
template <class S, class V> \
169-
FORCEINLINE auto FUN(decay_t<S> u, const CVecExpr<V, S>& v) \
170-
RETURNS(EXPR<Bcast<S>, V, S>(Bcast<S>(u), v.derived()))
149+
// clang-format off
150+
#define MAKE_BINARY_FUN(FUN, EXPR, IMPL) \
151+
/*!--- Expression class. ---*/ \
152+
template <class U, class V, class Scalar> \
153+
class EXPR : public CVecExpr<EXPR<U, V, Scalar>, Scalar> { \
154+
store_t<const U> u; \
155+
store_t<const V> v; \
156+
\
157+
public: \
158+
static constexpr bool StoreAsRef = false; \
159+
FORCEINLINE EXPR(const U& u_, const V& v_) : u(u_), v(v_) {} \
160+
FORCEINLINE auto operator[](size_t i) const RETURNS(IMPL(u[i], v[i])) \
161+
}; \
162+
/*!--- Vector with vector function overload. ---*/ \
163+
template <class U, class V, class S> \
164+
FORCEINLINE auto FUN(const CVecExpr<U, S>& u, const CVecExpr<V, S>& v) \
165+
RETURNS(EXPR<U, V, S>(u.derived(), v.derived())) \
166+
/*!--- Vector with scalar function overload. ---*/ \
167+
template <class U, class S> \
168+
FORCEINLINE auto FUN(const CVecExpr<U, S>& u, decay_t<S> v) RETURNS(EXPR<U, Bcast<S>, S>(u.derived(), Bcast<S>(v))) \
169+
/*!--- Scalar with vector function overload. ---*/ \
170+
template <class S, class V> \
171+
FORCEINLINE auto FUN(decay_t<S> u, const CVecExpr<V, S>& v) RETURNS(EXPR<Bcast<S>, V, S>(Bcast<S>(u), v.derived()))
172+
// clang-format on
171173

172174
/*--- std::max/min have issues (because they return by reference).
173175
* fmin and fmax return by value and thus are fine, but they would force

Common/include/option_structure.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,13 @@ enum class INC_DENSITYMODEL {
628628
CONSTANT, /*!< \brief Constant density. */
629629
BOUSSINESQ, /*!< \brief Boussinesq density model. */
630630
VARIABLE, /*!< \brief Variable density model. */
631+
FLAMELET, /*!< \brief Density according to flamelet manifold. */
631632
};
632633
static const MapType<std::string, INC_DENSITYMODEL> DensityModel_Map = {
633634
MakePair("CONSTANT", INC_DENSITYMODEL::CONSTANT)
634635
MakePair("BOUSSINESQ", INC_DENSITYMODEL::BOUSSINESQ)
635636
MakePair("VARIABLE", INC_DENSITYMODEL::VARIABLE)
637+
MakePair("FLAMELET", INC_DENSITYMODEL::FLAMELET)
636638
};
637639

638640
/*!
@@ -1317,6 +1319,7 @@ static const MapType<std::string, SPECIES_MODEL> Species_Model_Map = {
13171319
enum FLAMELET_SCALAR_VARIABLES {
13181320
I_PROGVAR,
13191321
I_ENTH,
1322+
I_MIXFRAC,
13201323
};
13211324

13221325
/*!
@@ -1326,6 +1329,15 @@ enum FLAMELET_SCALAR_SOURCES {
13261329
I_SRC_TOT_PROGVAR
13271330
};
13281331

1332+
/*!
1333+
* \brief Look-up operations for the flamelet scalar solver.
1334+
*/
1335+
enum FLAMELET_LOOKUP_OPS {
1336+
TD, /*!< \brief Thermochemical properties (temperature, density, diffusivity, etc.). */
1337+
SOURCES, /*!< \brief Scalar source terms (controlling variables, passive species).*/
1338+
LOOKUP, /*!< \brief Passive look-up variables specified in config. */
1339+
};
1340+
13291341
/*!
13301342
* \brief Types of subgrid scale models
13311343
*/

Common/src/CConfig.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,11 +2101,14 @@ void CConfig::SetConfig_Options() {
21012101
/* DESCRIPTION: Determine if we need to allocate memory to store the multizone residual. \n DEFAULT: true (temporarily) */
21022102
addBoolOption("MULTIZONE_RESIDUAL", Multizone_Residual, false);
21032103

2104-
/*!\brief File name of the flamelet look up table.*/
2105-
addStringOption("FILENAME_LUT", file_name_lut, string("LUT"));
2104+
/* !\brief CONTROLLING_VARIABLE_NAMES \n DESCRIPTION: Names of the variables used as inputs for the data regression method in flamelet or data-driven fluid models. */
2105+
addStringListOption("CONTROLLING_VARIABLE_NAMES", n_control_vars, controlling_variable_names);
2106+
2107+
/* !\brief CONTROLLING_VARIABLE_SOURCE_NAMES \n DESCRIPTION: Names of the variables in the flamelet manifold corresponding to the source terms of the controlling variables. */
2108+
addStringListOption("CONTROLLING_VARIABLE_SOURCE_NAMES", n_control_vars, cv_source_names);
21062109

21072110
/* DESCRIPTION: Names of the passive lookup variables for flamelet LUT */
2108-
addStringListOption("LOOKUP_NAMES", n_lookups, table_lookup_names);
2111+
addStringListOption("LOOKUP_NAMES", n_lookups, lookup_names);
21092112

21102113
/* DESCRIPTION: Names of the user transport equations solved in the flamelet problem. */
21112114
addStringListOption("USER_SCALAR_NAMES", n_user_scalars, user_scalar_names);
@@ -3840,6 +3843,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
38403843
SetDefaultIfEmpty(Prandtl_Turb, nPrandtl_Turb, Prandtl_Turb_Default);
38413844
SetDefaultIfEmpty(Constant_Lewis_Number, nConstant_Lewis_Number, Lewis_Number_Default);
38423845

3846+
Variable_Density = ((Kind_DensityModel == INC_DENSITYMODEL::VARIABLE) || (Kind_DensityModel == INC_DENSITYMODEL::FLAMELET));
3847+
38433848
/*--- Check whether inputs for FLUID_MIXTURE are correctly specified. ---*/
38443849

38453850
if (Kind_FluidModel == FLUID_MIXTURE) {
@@ -3935,8 +3940,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
39353940
CURRENT_FUNCTION);
39363941
}
39373942

3938-
if (Kind_DensityModel != INC_DENSITYMODEL::VARIABLE) {
3939-
SU2_MPI::Error("The use of FLUID_FLAMELET requires the INC_DENSITY_MODEL option to be VARIABLE",
3943+
if (!Variable_Density) {
3944+
SU2_MPI::Error("The use of FLUID_FLAMELET requires the INC_DENSITY_MODEL option to be VARIABLE or FLAMELET",
39403945
CURRENT_FUNCTION);
39413946
}
39423947

@@ -5480,8 +5485,10 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
54805485

54815486
/*--- Define some variables for flamelet model. ---*/
54825487
if (Kind_Species_Model == SPECIES_MODEL::FLAMELET) {
5483-
/*--- The controlling variables are progress variable and total enthalpy ---*/
5484-
n_control_vars = 2;
5488+
/*--- The controlling variables are progress variable, total enthalpy, and optionally mixture fraction ---*/
5489+
//n_control_vars = nSpecies - n_user_scalars;
5490+
if (n_control_vars != (nSpecies - n_user_scalars))
5491+
SU2_MPI::Error("Number of initial species incompatbile with number of controlling variables and user scalars.", CURRENT_FUNCTION);
54855492
/*--- We can have additional user defined transported scalars ---*/
54865493
n_scalars = n_control_vars + n_user_scalars;
54875494
}

0 commit comments

Comments
 (0)