Skip to content

Commit 462e95c

Browse files
Apply suggestions from code review
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
1 parent 66aec2e commit 462e95c

2 files changed

Lines changed: 7 additions & 21 deletions

File tree

SU2_CFD/src/solvers/CScalarSolver.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,7 @@ void CScalarSolver::LoadRestart(CGeometry** geometry, CSolver*** solver, CConfig
711711

712712
/*--- Skip flow variables ---*/
713713

714-
unsigned short skipVars = 0;
715-
716-
if (nDim == 2) skipVars += 6;
717-
if (nDim == 3) skipVars += 8;
714+
unsigned short skipVars = nDim + solver[MESH_0][FLOW_SOL]->GetnVar();
718715

719716
/*--- Adjust the number of solution variables in the incompressible
720717
restart. We always carry a space in nVar for the energy equation in the

SU2_CFD/src/solvers/CTurbSASolver.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,10 +1595,7 @@ void CTurbSASolver::ComputeUnderRelaxationFactor(const CConfig *config) {
15951595
SA_NEG model is more robust due to allowing for negative nu_tilde,
15961596
so the under-relaxation is not applied to that variant. */
15971597

1598-
bool sa_model = ((config->GetKind_Turb_Model() == SA) ||
1599-
(config->GetKind_Turb_Model() == SA_E) ||
1600-
(config->GetKind_Turb_Model() == SA_COMP) ||
1601-
(config->GetKind_Turb_Model() == SA_E_COMP));
1598+
if (config->GetKind_Turb_Model() == SA_NEG) return;
16021599

16031600
/* Loop over the solution update given by relaxing the linear
16041601
system for this nonlinear iteration. */
@@ -1610,19 +1607,11 @@ void CTurbSASolver::ComputeUnderRelaxationFactor(const CConfig *config) {
16101607
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
16111608

16121609
localUnderRelaxation = 1.0;
1613-
if (sa_model) {
1614-
for (unsigned short iVar = 0; iVar < nVar; iVar++) {
1615-
1616-
/* We impose a limit on the maximum percentage that the
1617-
turbulence variables can change over a nonlinear iteration. */
1618-
1619-
const unsigned long index = iPoint * nVar + iVar;
1620-
su2double ratio = fabs(LinSysSol[index]) / (fabs(nodes->GetSolution(iPoint, iVar)) + EPS);
1621-
if (ratio > allowableRatio) {
1622-
localUnderRelaxation = min(allowableRatio / ratio, localUnderRelaxation);
1623-
}
1624-
1625-
}
1610+
su2double ratio = fabs(LinSysSol[iPoint]) / (fabs(nodes->GetSolution(iPoint, 0)) + EPS);
1611+
/* We impose a limit on the maximum percentage that the
1612+
turbulence variables can change over a nonlinear iteration. */
1613+
if (ratio > allowableRatio) {
1614+
localUnderRelaxation = min(allowableRatio / ratio, localUnderRelaxation);
16261615
}
16271616

16281617
/* Threshold the relaxation factor in the event that there is

0 commit comments

Comments
 (0)