Skip to content

Commit 5a184a7

Browse files
authored
Merge branch 'develop' into feature_expliciteuler_scalarsolver
2 parents 217db02 + 56a16b3 commit 5a184a7

13 files changed

Lines changed: 199 additions & 199 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ class CConfig {
554554
STRUCT_DEFORMATION Kind_Struct_Solver; /*!< \brief Determines the geometric condition (small or large deformations) for structural analysis. */
555555
unsigned short Kind_DV_FEA; /*!< \brief Kind of Design Variable for FEA problems.*/
556556

557+
unsigned short nTurbVar; /*!< \brief Number of Turbulence variables, i.e. 1 for SA-types, 2 for SST. */
557558
TURB_MODEL Kind_Turb_Model; /*!< \brief Turbulent model definition. */
558559
unsigned short Kind_SGS_Model; /*!< \brief LES SGS model definition. */
559560
unsigned short Kind_Trans_Model, /*!< \brief Transition model definition. */
@@ -4179,6 +4180,12 @@ class CConfig {
41794180
*/
41804181
void SetKind_SU2(SU2_COMPONENT val_kind_su2) { Kind_SU2 = val_kind_su2 ; }
41814182

4183+
/*!
4184+
* \brief Get the number of Turbulence Variables.
4185+
* \return Number of Turbulence Variables.
4186+
*/
4187+
unsigned short GetnTurbVar(void) const { return nTurbVar; }
4188+
41824189
/*!
41834190
* \brief Get the kind of the turbulence model.
41844191
* \return Kind of the turbulence model.

Common/src/CConfig.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2795,7 +2795,7 @@ void CConfig::SetConfig_Options() {
27952795
/*!\brief MAX_BASIS_DIM \n DESCRIPTION: Maximum number of basis vectors.*/
27962796
addUnsignedShortOption("MAX_BASIS_DIM", maxBasisDim, 100);
27972797

2798-
/*!\brief MAX_BASIS_DIM \n DESCRIPTION: Maximum number of basis vectors.*/
2798+
/*!\brief ROM_SAVE_FREQ \n DESCRIPTION: How often to save snapshots for unsteady problems.*/
27992799
addUnsignedShortOption("ROM_SAVE_FREQ", rom_save_freq, 1);
28002800

28012801
/* END_CONFIG_OPTIONS */
@@ -5080,6 +5080,17 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
50805080
if (GetGasModel() == "ARGON") {monoatomic = true;}
50815081
else {monoatomic = false;}
50825082

5083+
/*--- Set number of Turbulence Variables. ---*/
5084+
switch(Kind_Turb_Model) {
5085+
case TURB_MODEL::NONE:
5086+
nTurbVar = 0; break;
5087+
case TURB_MODEL::SA: case TURB_MODEL::SA_COMP: case TURB_MODEL::SA_E_COMP: case TURB_MODEL::SA_E:
5088+
case TURB_MODEL::SA_NEG:
5089+
nTurbVar = 1; break;
5090+
case TURB_MODEL::SST: case TURB_MODEL::SST_SUST:
5091+
nTurbVar = 2; break;
5092+
}
5093+
50835094
// This option is deprecated. After a grace period until 7.2.0 the usage warning should become an error.
50845095
if(OptionIsSet("CONV_CRITERIA") && rank == MASTER_NODE) {
50855096
cout << "\n\nWARNING: CONV_CRITERIA is deprecated. SU2 will choose the criteria automatically based on the CONV_FIELD.\n"

SU2_CFD/include/numerics/turbulent/turb_sources.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
334334

335335
su2double kAmb, omegaAmb;
336336

337-
su2double Residual[2],
338-
*Jacobian_i[2] = {nullptr},
339-
Jacobian_Buffer[4] = {0.0}; /// Static storage for the Jacobian (which needs to be pointer for return type).
337+
su2double Residual[2];
338+
su2double* Jacobian_i[2];
339+
su2double Jacobian_Buffer[4]; /// Static storage for the Jacobian (which needs to be pointer for return type).
340340

341341
bool incompressible;
342342
bool sustaining_terms;
@@ -371,7 +371,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
371371
sigma_w_i = F1_i*sigma_w_1+(1.0-F1_i)*sigma_w_2;
372372

373373
/*--- Production ---*/
374-
pk_axi = max(0.0,2.0/3.0*rhov*k*(2.0/zeta*(yinv*V_i[2]-PrimVar_Grad_i[2][1]-PrimVar_Grad_i[1][0])-1.0));
374+
pk_axi = max(0.0,2.0/3.0*rhov*k*((2.0*yinv*V_i[2]-PrimVar_Grad_i[2][1]-PrimVar_Grad_i[1][0])/zeta-1.0));
375375
pw_axi = alfa_blended*zeta/k*pk_axi;
376376

377377
/*--- Convection-Diffusion ---*/

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 104 additions & 119 deletions
Large diffs are not rendered by default.

SU2_CFD/include/solvers/CSolver.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@
5757
#include "../variables/CVariable.hpp"
5858

5959
#ifdef HAVE_LIBROM
60-
#include "BasisGenerator.h"
61-
#include "QDEIM.h"
62-
#include "DEIM.h"
60+
#include "librom.h"
6361
#endif
6462

6563
using namespace std;

SU2_CFD/src/solvers/CHeatSolver.cpp

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ void CHeatSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container,
218218

219219
void CHeatSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh) { }
220220

221-
void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) {
222-
221+
void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter,
222+
bool val_update_geo) {
223223
/*--- Restart the solution from file information ---*/
224224

225-
string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter);
225+
const string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter);
226226

227227
/*--- Skip coordinates ---*/
228228

229-
unsigned short skipVars = geometry[MESH_0]->GetnDim();
229+
unsigned short skipVars = nDim;
230230

231231
if (flow) {
232232
// P, vx, vy (,vz)
@@ -243,38 +243,31 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *
243243
}
244244

245245
/*--- Load data from the restart into correct containers. ---*/
246-
long iPoint_Local = 0;
247-
unsigned long iPoint_Global_Local = 0;
248246
unsigned long counter = 0;
249-
su2double Solution[MAXNVAR];
250247
for (auto iPoint_Global = 0ul; iPoint_Global < geometry[MESH_0]->GetGlobal_nPointDomain(); iPoint_Global++ ) {
251248

252249
/*--- Retrieve local index. If this node from the restart file lives
253250
on the current processor, we will load and instantiate the vars. ---*/
254251

255-
iPoint_Local = geometry[MESH_0]->GetGlobal_to_Local_Point(iPoint_Global);
252+
const auto iPoint_Local = geometry[MESH_0]->GetGlobal_to_Local_Point(iPoint_Global);
256253

257254
if (iPoint_Local > -1) {
258-
259255
/*--- We need to store this point's data, so jump to the correct
260256
offset in the buffer of data from the restart file and load it. ---*/
261257

262-
auto index = counter*Restart_Vars[1] + skipVars;
263-
for (auto iVar = 0u; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar];
264-
nodes->SetSolution(iPoint_Local,Solution);
265-
iPoint_Global_Local++;
258+
const auto index = counter*Restart_Vars[1] + skipVars;
259+
for (auto iVar = 0u; iVar < nVar; iVar++) nodes->SetSolution(iPoint_Local, iVar, Restart_Data[index + iVar]);
266260

267261
/*--- Increment the overall counter for how many points have been loaded. ---*/
268262
counter++;
269263
}
270-
271264
}
272265

273266
/*--- Detect a wrong solution file ---*/
274267

275-
if (iPoint_Global_Local != nPointDomain) {
276-
SU2_MPI::Error(string("The solution file ") + restart_filename + string(" doesn't match with the mesh file!\n") +
277-
string("It could be empty lines at the end of the file."), CURRENT_FUNCTION);
268+
if (counter != nPointDomain) {
269+
SU2_MPI::Error(string("The solution file ") + restart_filename + string(" does not match with the mesh file!\n") +
270+
string("This can be caused by empty lines at the end of the file."), CURRENT_FUNCTION);
278271
}
279272

280273
/*--- Communicate the loaded solution on the fine grid before we transfer
@@ -288,31 +281,37 @@ void CHeatSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *
288281
solver[MESH_0][HEAT_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, RUNTIME_HEAT_SYS, false);
289282

290283
/*--- Interpolate the solution down to the coarse multigrid levels ---*/
284+
291285
for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) {
286+
292287
for (auto iPoint = 0ul; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
293-
const auto Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
294-
for (auto iVar = 0u; iVar < nVar; iVar++) Solution[iVar] = 0.0;
288+
const su2double Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
289+
su2double Solution_Coarse[MAXNVAR] = {0.0};
290+
295291
for (auto iChildren = 0ul; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
296292
const auto Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
297-
const auto Area_Children = geometry[iMesh-1]->nodes->GetVolume(Point_Fine);
298-
const auto Solution_Fine = solver[iMesh-1][HEAT_SOL]->GetNodes()->GetSolution(Point_Fine);
293+
const su2double Area_Children = geometry[iMesh - 1]->nodes->GetVolume(Point_Fine);
294+
const su2double* Solution_Fine = solver[iMesh - 1][HEAT_SOL]->GetNodes()->GetSolution(Point_Fine);
295+
299296
for (auto iVar = 0u; iVar < nVar; iVar++) {
300-
Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
297+
Solution_Coarse[iVar] += Solution_Fine[iVar] * Area_Children / Area_Parent;
301298
}
302299
}
303-
solver[iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint,Solution);
300+
solver[iMesh][HEAT_SOL]->GetNodes()->SetSolution(iPoint,Solution_Coarse);
304301
}
302+
305303
solver[iMesh][HEAT_SOL]->InitiateComms(geometry[iMesh], config, SOLUTION);
306304
solver[iMesh][HEAT_SOL]->CompleteComms(geometry[iMesh], config, SOLUTION);
305+
307306
solver[iMesh][HEAT_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_HEAT_SYS, false);
308307
}
309308

310309
/*--- Delete the class memory that is used to load the restart. ---*/
311310

312-
delete [] Restart_Vars;
313-
delete [] Restart_Data;
314-
Restart_Vars = nullptr; Restart_Data = nullptr;
315-
311+
delete[] Restart_Vars;
312+
Restart_Vars = nullptr;
313+
delete[] Restart_Data;
314+
Restart_Data = nullptr;
316315
}
317316

318317
void CHeatSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics **numerics_container,

SU2_CFD/src/solvers/CTurbSolver.cpp

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,10 @@ void CTurbSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_conta
206206
}
207207

208208
void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig* config, int val_iter,
209-
bool val_update_geo) {
209+
bool val_update_geo) {
210210
/*--- Restart the solution from file information ---*/
211211

212-
unsigned short iVar, iMesh;
213-
unsigned long iPoint, index, iChildren, Point_Fine;
214-
su2double Area_Children, Area_Parent;
215-
const su2double* Solution_Fine = nullptr;
216-
217-
string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter);
212+
const string restart_filename = config->GetFilename(config->GetSolution_FileName(), "", val_iter);
218213

219214
/*--- To make this routine safe to call in parallel most of it can only be executed by one thread. ---*/
220215
SU2_OMP_MASTER {
@@ -236,27 +231,27 @@ void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig*
236231
Therefore, we must reduce skipVars here if energy is inactive so that
237232
the turbulent variables are read correctly. ---*/
238233

239-
bool incompressible = (config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE);
240-
bool energy = config->GetEnergy_Equation();
241-
bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat();
234+
const bool incompressible = (config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE);
235+
const bool energy = config->GetEnergy_Equation();
236+
const bool weakly_coupled_heat = config->GetWeakly_Coupled_Heat();
242237

243238
if (incompressible && ((!energy) && (!weakly_coupled_heat))) skipVars--;
244239

245240
/*--- Load data from the restart into correct containers. ---*/
246241

247-
unsigned long counter = 0, iPoint_Global = 0;
248-
for (; iPoint_Global < geometry[MESH_0]->GetGlobal_nPointDomain(); iPoint_Global++) {
242+
unsigned long counter = 0;
243+
for (auto iPoint_Global = 0ul; iPoint_Global < geometry[MESH_0]->GetGlobal_nPointDomain(); iPoint_Global++) {
249244
/*--- Retrieve local index. If this node from the restart file lives
250245
on the current processor, we will load and instantiate the vars. ---*/
251246

252-
auto iPoint_Local = geometry[MESH_0]->GetGlobal_to_Local_Point(iPoint_Global);
247+
const auto iPoint_Local = geometry[MESH_0]->GetGlobal_to_Local_Point(iPoint_Global);
253248

254249
if (iPoint_Local > -1) {
255250
/*--- We need to store this point's data, so jump to the correct
256251
offset in the buffer of data from the restart file and load it. ---*/
257252

258-
index = counter * Restart_Vars[1] + skipVars;
259-
for (iVar = 0; iVar < nVar; ++iVar) nodes->SetSolution(iPoint_Local, iVar, Restart_Data[index + iVar]);
253+
const auto index = counter * Restart_Vars[1] + skipVars;
254+
for (auto iVar = 0u; iVar < nVar; iVar++) nodes->SetSolution(iPoint_Local, iVar, Restart_Data[index + iVar]);
260255

261256
/*--- Increment the overall counter for how many points have been loaded. ---*/
262257
counter++;
@@ -266,8 +261,8 @@ void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig*
266261
/*--- Detect a wrong solution file ---*/
267262

268263
if (counter != nPointDomain) {
269-
SU2_MPI::Error(string("The solution file ") + restart_filename + string(" doesn't match with the mesh file!\n") +
270-
string("It could be empty lines at the end of the file."),
264+
SU2_MPI::Error(string("The solution file ") + restart_filename + string(" does not match with the mesh file!\n") +
265+
string("This can be caused by empty lines at the end of the file."),
271266
CURRENT_FUNCTION);
272267
}
273268

@@ -286,16 +281,19 @@ void CTurbSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig*
286281

287282
/*--- Interpolate the solution down to the coarse multigrid levels ---*/
288283

289-
for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
284+
for (auto iMesh = 1u; iMesh <= config->GetnMGLevels(); iMesh++) {
285+
290286
SU2_OMP_FOR_STAT(omp_chunk_size)
291-
for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
292-
Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
287+
for (auto iPoint = 0ul; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
288+
const su2double Area_Parent = geometry[iMesh]->nodes->GetVolume(iPoint);
293289
su2double Solution_Coarse[MAXNVAR] = {0.0};
294-
for (iChildren = 0; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
295-
Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
296-
Area_Children = geometry[iMesh - 1]->nodes->GetVolume(Point_Fine);
297-
Solution_Fine = solver[iMesh - 1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine);
298-
for (iVar = 0; iVar < nVar; iVar++) {
290+
291+
for (auto iChildren = 0ul; iChildren < geometry[iMesh]->nodes->GetnChildren_CV(iPoint); iChildren++) {
292+
const auto Point_Fine = geometry[iMesh]->nodes->GetChildren_CV(iPoint, iChildren);
293+
const su2double Area_Children = geometry[iMesh - 1]->nodes->GetVolume(Point_Fine);
294+
const su2double* Solution_Fine = solver[iMesh - 1][TURB_SOL]->GetNodes()->GetSolution(Point_Fine);
295+
296+
for (auto iVar = 0u; iVar < nVar; iVar++) {
299297
Solution_Coarse[iVar] += Solution_Fine[iVar] * Area_Children / Area_Parent;
300298
}
301299
}

TestCases/hybrid_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def main():
235235
axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle"
236236
axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg"
237237
axi_rans_air_nozzle.test_iter = 10
238-
axi_rans_air_nozzle.test_vals = [-12.094009, -6.643017, -8.900656, -2.393294]
238+
axi_rans_air_nozzle.test_vals = [-12.093575, -6.630426, -8.798725, -2.399130]
239239
test_list.append(axi_rans_air_nozzle)
240240

241241
#################################

TestCases/parallel_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def main():
400400
axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle"
401401
axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg"
402402
axi_rans_air_nozzle.test_iter = 10
403-
axi_rans_air_nozzle.test_vals = [-12.098340, -6.651791, -8.877009, -2.393286]
403+
axi_rans_air_nozzle.test_vals = [-12.096377, -6.636625, -8.786639, -2.399099]
404404
axi_rans_air_nozzle.su2_exec = "mpirun -n 2 SU2_CFD"
405405
axi_rans_air_nozzle.timeout = 1600
406406
axi_rans_air_nozzle.tol = 0.0001

TestCases/serial_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def main():
417417
axi_rans_air_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle"
418418
axi_rans_air_nozzle.cfg_file = "air_nozzle.cfg"
419419
axi_rans_air_nozzle.test_iter = 10
420-
axi_rans_air_nozzle.test_vals = [-12.097563, -6.650115, -8.875944, -2.393285]
420+
axi_rans_air_nozzle.test_vals = [ -12.092891, -6.630495, -8.784840, -2.399099]
421421
axi_rans_air_nozzle.su2_exec = "SU2_CFD"
422422
axi_rans_air_nozzle.timeout = 1600
423423
axi_rans_air_nozzle.tol = 0.0001

0 commit comments

Comments
 (0)