Skip to content

Commit a37a609

Browse files
committed
Merge branch 'fix_mz_adjoint_wall_time' of https://github.com/su2code/SU2 into fix_mz_adjoint_wall_time
2 parents f3de6e5 + 1ee3f82 commit a37a609

40 files changed

Lines changed: 1193 additions & 601 deletions

File tree

.github/workflows/regression.yml

Lines changed: 98 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ jobs:
5252
key: ${{ matrix.config_set }}-${{ github.sha }}
5353
restore-keys: ${{ matrix.config_set }}
5454
- name: Pre Cleanup
55-
uses: docker://ghcr.io/su2code/su2/build-su2:230225-2136
55+
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
5656
with:
5757
entrypoint: /bin/rm
5858
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
5959
- name: Build
60-
uses: docker://ghcr.io/su2code/su2/build-su2:230225-2136
60+
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
6161
with:
6262
args: -b ${{github.ref}} -f "${{matrix.flags}}"
6363
- name: Compress binaries
@@ -68,7 +68,50 @@ jobs:
6868
name: ${{ matrix.config_set }}
6969
path: install_bin.tgz
7070
- name: Post Cleanup
71-
uses: docker://ghcr.io/su2code/su2/build-su2:230225-2136
71+
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
72+
with:
73+
entrypoint: /bin/rm
74+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
75+
build_tsan:
76+
name: Build SU2 (tsan)
77+
if: inputs.runner != 'ARM64'
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
config_set: [BaseOMP-tsan, ReverseOMP-tsan] #ForwardOMP-tsan
82+
include:
83+
- config_set: BaseOMP-tsan
84+
flags: '--buildtype=debugoptimized -Dwith-omp=true -Denable-mixedprec=true -Denable-tecio=false --warnlevel=3'
85+
- config_set: ReverseOMP-tsan
86+
flags: '--buildtype=debugoptimized -Denable-autodiff=true -Denable-normal=false -Dwith-omp=true -Denable-mixedprec=true -Denable-tecio=false --warnlevel=3'
87+
#- config_set: ForwardOMP-tsan
88+
# flags: '--buildtype=debug -Denable-directdiff=true -Denable-normal=false -Dwith-omp=true -Denable-mixedprec=true -Denable-pywrapper=true -Denable-tecio=false --warnlevel=3 --werror'
89+
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
90+
steps:
91+
- name: Cache Object Files
92+
uses: actions/cache@v3
93+
with:
94+
path: ccache
95+
key: ${{ matrix.config_set }}-${{ github.sha }}
96+
restore-keys: ${{ matrix.config_set }}
97+
- name: Pre Cleanup
98+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
99+
with:
100+
entrypoint: /bin/rm
101+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
102+
- name: Build
103+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
104+
with:
105+
args: -b ${{github.ref}} -f "${{matrix.flags}}"
106+
- name: Compress binaries
107+
run: tar -zcvf install_bin.tgz install/bin
108+
- name: Upload Binaries
109+
uses: actions/upload-artifact@v3
110+
with:
111+
name: ${{ matrix.config_set }}
112+
path: install_bin.tgz
113+
- name: Post Cleanup
114+
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
72115
with:
73116
entrypoint: /bin/rm
74117
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -99,7 +142,7 @@ jobs:
99142
tag: OMP
100143
steps:
101144
- name: Pre Cleanup
102-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
145+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
103146
with:
104147
entrypoint: /bin/rm
105148
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -125,12 +168,58 @@ jobs:
125168
chmod a+x $BIN_FOLDER/*
126169
ls -lahR $BIN_FOLDER
127170
- name: Run Tests in Container
128-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
171+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
129172
with:
130173
# -t <Tutorials-branch> -c <Testcases-branch>
131174
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
132175
- name: Cleanup
133-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
176+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
177+
with:
178+
entrypoint: /bin/rm
179+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
180+
thread_sanitizer_tests:
181+
if: inputs.runner != 'ARM64'
182+
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
183+
name: Thread Sanitizer Tests
184+
needs: build_tsan
185+
strategy:
186+
fail-fast: false
187+
matrix:
188+
testscript: ['hybrid_regression.py', 'hybrid_regression_AD.py']
189+
steps:
190+
- name: Pre Cleanup
191+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
192+
with:
193+
entrypoint: /bin/rm
194+
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
195+
- name: Download All artifacts
196+
uses: actions/download-artifact@v3
197+
- name: Uncompress and Move Binaries
198+
run: |
199+
BIN_FOLDER="$PWD/install/bin"
200+
mkdir -p $BIN_FOLDER
201+
ls -lah $BIN_FOLDER
202+
for type in Base Reverse Forward; do
203+
TYPE_FOLDER="${type}OMP-tsan"
204+
echo "Processing '$TYPE_FOLDER' ..."
205+
if [ -d $TYPE_FOLDER ]; then
206+
pushd $TYPE_FOLDER
207+
ls -lah
208+
tar -zxvf install_bin.tgz
209+
ls -lah install/bin/
210+
cp -r install/bin/* $BIN_FOLDER;
211+
popd;
212+
fi
213+
done
214+
chmod a+x $BIN_FOLDER/*
215+
ls -lahR $BIN_FOLDER
216+
- name: Run Tests in Container
217+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
218+
with:
219+
# -t <Tutorials-branch> -c <Testcases-branch>
220+
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tsan"
221+
- name: Cleanup
222+
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
134223
with:
135224
entrypoint: /bin/rm
136225
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -151,7 +240,7 @@ jobs:
151240
tag: MPI
152241
steps:
153242
- name: Pre Cleanup
154-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
243+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
155244
with:
156245
entrypoint: /bin/rm
157246
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
@@ -212,11 +301,11 @@ jobs:
212301
echo $PWD
213302
ls -lahR
214303
- name: Run Unit Tests
215-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
304+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
216305
with:
217306
entrypoint: install/bin/${{matrix.testdriver}}
218307
- name: Post Cleanup
219-
uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136
308+
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
220309
with:
221310
entrypoint: /bin/rm
222311
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}

.github/workflows/release-management.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
key: ${{ matrix.os_bin }}-${{ github.sha }}
3636
restore-keys: ${{ matrix.os_bin }}
3737
- name: Build
38-
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230225-2136
38+
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230704-1323
3939
with:
4040
args: -b ${{ github.sha }} -f "${{matrix.flags}}"
4141
- name: Create Archive

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/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)