Skip to content

Commit 41ffb84

Browse files
authored
Merge pull request #1057 from su2code/fix_ur
Fix underrelaxation
2 parents 1d8058e + a9e9d38 commit 41ffb84

6 files changed

Lines changed: 48 additions & 58 deletions

File tree

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -597,20 +597,13 @@ void CFVMFlowSolverBase<V, R>::ComputeUnderRelaxationFactor(CSolver** solver_con
597597

598598
if ((iVar == 0) || (iVar == nVar - 1)) {
599599
const unsigned long index = iPoint * nVar + iVar;
600-
su2double ratio = fabs(LinSysSol[index]) / (nodes->GetSolution(iPoint, iVar) + EPS);
600+
su2double ratio = fabs(LinSysSol[index]) / (fabs(nodes->GetSolution(iPoint, iVar)) + EPS);
601601
if (ratio > allowableRatio) {
602602
localUnderRelaxation = min(allowableRatio / ratio, localUnderRelaxation);
603603
}
604604
}
605605
}
606606

607-
/* In case of turbulence, take the min of the under-relaxation factor
608-
between the mean flow and the turb model. */
609-
610-
if (config->GetKind_Turb_Model() != NONE)
611-
localUnderRelaxation =
612-
min(localUnderRelaxation, solver_container[TURB_SOL]->GetNodes()->GetUnderRelaxation(iPoint));
613-
614607
/* Threshold the relaxation factor in the event that there is
615608
a very small value. This helps avoid catastrophic crashes due
616609
to non-realizable states by canceling the update. */

SU2_CFD/src/solvers/CTurbSolver.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,8 @@ void CTurbSolver::ComputeUnderRelaxationFactor(CSolver **solver_container, const
665665
/* Loop over the solution update given by relaxing the linear
666666
system for this nonlinear iteration. */
667667

668-
su2double localUnderRelaxation = 1.00;
669-
const su2double allowableDecrease = -0.99;
670-
const su2double allowableIncrease = 0.99;
668+
su2double localUnderRelaxation = 1.00;
669+
const su2double allowableRatio = 0.99;
671670

672671
SU2_OMP_FOR_STAT(omp_chunk_size)
673672
for (unsigned long iPoint = 0; iPoint < nPointDomain; iPoint++) {
@@ -679,12 +678,10 @@ void CTurbSolver::ComputeUnderRelaxationFactor(CSolver **solver_container, const
679678
/* We impose a limit on the maximum percentage that the
680679
turbulence variables can change over a nonlinear iteration. */
681680

682-
const unsigned long index = iPoint*nVar + iVar;
683-
su2double ratio = LinSysSol[index]/(nodes->GetSolution(iPoint, iVar)+EPS);
684-
if (ratio > allowableIncrease) {
685-
localUnderRelaxation = min(allowableIncrease/ratio, localUnderRelaxation);
686-
} else if (ratio < allowableDecrease) {
687-
localUnderRelaxation = min(fabs(allowableDecrease)/ratio, localUnderRelaxation);
681+
const unsigned long index = iPoint * nVar + iVar;
682+
su2double ratio = fabs(LinSysSol[index]) / (fabs(nodes->GetSolution(iPoint, iVar)) + EPS);
683+
if (ratio > allowableRatio) {
684+
localUnderRelaxation = min(allowableRatio / ratio, localUnderRelaxation);
688685
}
689686

690687
}

TestCases/hybrid_regression.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def main():
143143
rae2822_sa.cfg_dir = "rans/rae2822"
144144
rae2822_sa.cfg_file = "turb_SA_RAE2822.cfg"
145145
rae2822_sa.test_iter = 20
146-
rae2822_sa.test_vals = [-2.021218, -5.268447, 0.807465, 0.060897]
146+
rae2822_sa.test_vals = [-2.021224, -5.268445, 0.807582, 0.060731]
147147
test_list.append(rae2822_sa)
148148

149149
# RAE2822 SST
@@ -175,7 +175,7 @@ def main():
175175
turb_oneram6.cfg_dir = "rans/oneram6"
176176
turb_oneram6.cfg_file = "turb_ONERAM6.cfg"
177177
turb_oneram6.test_iter = 10
178-
turb_oneram6.test_vals = [-2.412446, -6.702976, 0.229866, 0.147638]
178+
turb_oneram6.test_vals = [-2.388851, -6.689340, 0.230320, 0.157649]
179179
test_list.append(turb_oneram6)
180180

181181
# NACA0012 (SA, FUN3D finest grid results: CL=1.0983, CD=0.01242)
@@ -215,7 +215,7 @@ def main():
215215
propeller_var_load.cfg_dir = "rans/actuatordisk_variable_load"
216216
propeller_var_load.cfg_file = "propeller_variable_load.cfg"
217217
propeller_var_load.test_iter = 20
218-
propeller_var_load.test_vals = [-1.810684, -4.535582, 0.000252, 0.170455]
218+
propeller_var_load.test_vals = [-1.808010, -4.535613, 0.000190, 0.172483]
219219
test_list.append(propeller_var_load)
220220

221221
#################################
@@ -240,39 +240,39 @@ def main():
240240
turb_naca0012_1c.cfg_dir = "rans_uq/naca0012"
241241
turb_naca0012_1c.cfg_file = "turb_NACA0012_uq_1c.cfg"
242242
turb_naca0012_1c.test_iter = 10
243-
turb_naca0012_1c.test_vals = [-4.979339, 1.140084, 1.217182, 0.220079]
243+
turb_naca0012_1c.test_vals = [-4.979389, 1.140070, 1.211965, 0.194237]
244244
test_list.append(turb_naca0012_1c)
245245

246246
# NACA0012 2c
247247
turb_naca0012_2c = TestCase('turb_naca0012_2c')
248248
turb_naca0012_2c.cfg_dir = "rans_uq/naca0012"
249249
turb_naca0012_2c.cfg_file = "turb_NACA0012_uq_2c.cfg"
250250
turb_naca0012_2c.test_iter = 10
251-
turb_naca0012_2c.test_vals = [-5.484195, 0.969780, 1.315926, 0.258346]
251+
turb_naca0012_2c.test_vals = [-5.484195, 0.969789, 1.310525, 0.231240]
252252
test_list.append(turb_naca0012_2c)
253253

254254
# NACA0012 3c
255255
turb_naca0012_3c = TestCase('turb_naca0012_3c')
256256
turb_naca0012_3c.cfg_dir = "rans_uq/naca0012"
257257
turb_naca0012_3c.cfg_file = "turb_NACA0012_uq_3c.cfg"
258258
turb_naca0012_3c.test_iter = 10
259-
turb_naca0012_3c.test_vals = [-5.586959, 0.932347, 1.540973, 0.345562]
259+
turb_naca0012_3c.test_vals = [-5.586959, 0.932359, 1.535455, 0.315820]
260260
test_list.append(turb_naca0012_3c)
261261

262262
# NACA0012 p1c1
263263
turb_naca0012_p1c1 = TestCase('turb_naca0012_p1c1')
264264
turb_naca0012_p1c1.cfg_dir = "rans_uq/naca0012"
265265
turb_naca0012_p1c1.cfg_file = "turb_NACA0012_uq_p1c1.cfg"
266266
turb_naca0012_p1c1.test_iter = 10
267-
turb_naca0012_p1c1.test_vals = [-5.132080, 1.076459, 1.183320, 0.207012]
267+
turb_naca0012_p1c1.test_vals = [-5.132081, 1.076462, 1.178093, 0.181595]
268268
test_list.append(turb_naca0012_p1c1)
269269

270270
# NACA0012 p1c2
271271
turb_naca0012_p1c2 = TestCase('turb_naca0012_p1c2')
272272
turb_naca0012_p1c2.cfg_dir = "rans_uq/naca0012"
273273
turb_naca0012_p1c2.cfg_file = "turb_NACA0012_uq_p1c2.cfg"
274274
turb_naca0012_p1c2.test_iter = 10
275-
turb_naca0012_p1c2.test_vals = [-5.556645, 0.945121, 1.246337, 0.231311]
275+
turb_naca0012_p1c2.test_vals = [-5.556648, 0.945129, 1.240986, 0.205071]
276276
test_list.append(turb_naca0012_p1c2)
277277

278278
######################################
@@ -293,7 +293,7 @@ def main():
293293
hb_rans_preconditioning.cfg_dir = "harmonic_balance/hb_rans_preconditioning"
294294
hb_rans_preconditioning.cfg_file = "davis.cfg"
295295
hb_rans_preconditioning.test_iter = 25
296-
hb_rans_preconditioning.test_vals = [-1.909633, -5.954752, 0.007773, 0.131217]
296+
hb_rans_preconditioning.test_vals = [-1.902391, -5.950120, 0.007786, 0.128110]
297297
hb_rans_preconditioning.new_output = False
298298
test_list.append(hb_rans_preconditioning)
299299

@@ -386,7 +386,7 @@ def main():
386386
Jones_tc.cfg_dir = "turbomachinery/APU_turbocharger"
387387
Jones_tc.cfg_file = "Jones.cfg"
388388
Jones_tc.test_iter = 5
389-
Jones_tc.test_vals = [-5.280316, 0.379651, 44.725470, 2.271540]
389+
Jones_tc.test_vals = [-5.280316, 0.379651, 72.207590, 1.277638]
390390
Jones_tc.new_output = False
391391
test_list.append(Jones_tc)
392392

@@ -395,7 +395,7 @@ def main():
395395
Jones_tc_rst.cfg_dir = "turbomachinery/APU_turbocharger"
396396
Jones_tc_rst.cfg_file = "Jones_rst.cfg"
397397
Jones_tc_rst.test_iter = 5
398-
Jones_tc_rst.test_vals = [-4.626647, -1.570858, 34.014100, 10.190720]
398+
Jones_tc_rst.test_vals = [-4.625330, -1.568896, 33.995140, 10.181610]
399399
Jones_tc_rst.new_output = False
400400
test_list.append(Jones_tc_rst)
401401

@@ -404,7 +404,7 @@ def main():
404404
axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D"
405405
axial_stage2D.cfg_file = "Axial_stage2D.cfg"
406406
axial_stage2D.test_iter = 20
407-
axial_stage2D.test_vals = [-1.933199, 5.381560, 73.357900, 1.780500]
407+
axial_stage2D.test_vals = [-1.933200, 5.379973, 73.357900, 0.925878]
408408
axial_stage2D.new_output = False
409409
test_list.append(axial_stage2D)
410410

@@ -413,7 +413,7 @@ def main():
413413
transonic_stator.cfg_dir = "turbomachinery/transonic_stator_2D"
414414
transonic_stator.cfg_file = "transonic_stator.cfg"
415415
transonic_stator.test_iter = 20
416-
transonic_stator.test_vals = [-0.563540, 5.823232, 96.736080, 0.062426]
416+
transonic_stator.test_vals = [-0.562430, 5.828446, 96.436050, 0.062506]
417417
transonic_stator.new_output = False
418418
test_list.append(transonic_stator)
419419

TestCases/parallel_regression.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def main():
188188
rae2822_sa.cfg_dir = "rans/rae2822"
189189
rae2822_sa.cfg_file = "turb_SA_RAE2822.cfg"
190190
rae2822_sa.test_iter = 20
191-
rae2822_sa.test_vals = [-2.013881, -5.271311, 0.814981, 0.061858] #last 4 columns
191+
rae2822_sa.test_vals = [-2.014031, -5.271357, 0.815010, 0.061599] #last 4 columns
192192
rae2822_sa.su2_exec = "parallel_computation.py -f"
193193
rae2822_sa.timeout = 1600
194194
rae2822_sa.tol = 0.00001
@@ -232,7 +232,7 @@ def main():
232232
turb_oneram6.cfg_dir = "rans/oneram6"
233233
turb_oneram6.cfg_file = "turb_ONERAM6.cfg"
234234
turb_oneram6.test_iter = 10
235-
turb_oneram6.test_vals = [-2.412448, -6.702975, 0.229867, 0.147637] #last 4 columns
235+
turb_oneram6.test_vals = [-2.388853, -6.689340, 0.230321, 0.157649] #last 4 columns
236236
turb_oneram6.su2_exec = "parallel_computation.py -f"
237237
turb_oneram6.timeout = 3200
238238
turb_oneram6.tol = 0.00001
@@ -287,7 +287,7 @@ def main():
287287
propeller_var_load.cfg_dir = "rans/actuatordisk_variable_load"
288288
propeller_var_load.cfg_file = "propeller_variable_load.cfg"
289289
propeller_var_load.test_iter = 20
290-
propeller_var_load.test_vals = [-1.839227, -4.535048, -0.000314, 0.169980] #last 4 columns
290+
propeller_var_load.test_vals = [-1.839281, -4.535070, -0.000323, 0.171814] #last 4 columns
291291
propeller_var_load.su2_exec = "parallel_computation.py -f"
292292
propeller_var_load.timeout = 3200
293293
propeller_var_load.tol = 0.00001
@@ -642,7 +642,7 @@ def main():
642642
turb_naca0012_1c.cfg_dir = "rans_uq/naca0012"
643643
turb_naca0012_1c.cfg_file = "turb_NACA0012_uq_1c.cfg"
644644
turb_naca0012_1c.test_iter = 10
645-
turb_naca0012_1c.test_vals = [-4.973604, 1.141377, 0.870252, 0.041511] #last 4 columns
645+
turb_naca0012_1c.test_vals = [-4.973604, 1.141376, 0.865859, 0.015106] #last 4 columns
646646
turb_naca0012_1c.su2_exec = "parallel_computation.py -f"
647647
turb_naca0012_1c.timeout = 1600
648648
turb_naca0012_1c.tol = 0.00001
@@ -653,7 +653,7 @@ def main():
653653
turb_naca0012_2c.cfg_dir = "rans_uq/naca0012"
654654
turb_naca0012_2c.cfg_file = "turb_NACA0012_uq_2c.cfg"
655655
turb_naca0012_2c.test_iter = 10
656-
turb_naca0012_2c.test_vals = [-5.484222, 0.967203, 0.909852, 0.056844] #last 4 columns
656+
turb_naca0012_2c.test_vals = [-5.484222, 0.967199, 0.905520, 0.029991] #last 4 columns
657657
turb_naca0012_2c.su2_exec = "parallel_computation.py -f"
658658
turb_naca0012_2c.timeout = 1600
659659
turb_naca0012_2c.tol = 0.00001
@@ -664,7 +664,7 @@ def main():
664664
turb_naca0012_3c.cfg_dir = "rans_uq/naca0012"
665665
turb_naca0012_3c.cfg_file = "turb_NACA0012_uq_3c.cfg"
666666
turb_naca0012_3c.test_iter = 10
667-
turb_naca0012_3c.test_vals = [-5.587082, 0.929251, 1.008548, 0.094463] #last 4 columns
667+
turb_naca0012_3c.test_vals = [-5.587082, 0.929246, 1.004417, 0.066538] #last 4 columns
668668
turb_naca0012_3c.su2_exec = "parallel_computation.py -f"
669669
turb_naca0012_3c.timeout = 1600
670670
turb_naca0012_3c.tol = 0.00001
@@ -675,7 +675,7 @@ def main():
675675
turb_naca0012_p1c1.cfg_dir = "rans_uq/naca0012"
676676
turb_naca0012_p1c1.cfg_file = "turb_NACA0012_uq_p1c1.cfg"
677677
turb_naca0012_p1c1.test_iter = 10
678-
turb_naca0012_p1c1.test_vals = [-5.128243, 1.076374, 0.959431, 0.067416] #last 4 columns
678+
turb_naca0012_p1c1.test_vals = [-5.128243, 1.076375, 0.955242, 0.039885] #last 4 columns
679679
turb_naca0012_p1c1.su2_exec = "parallel_computation.py -f"
680680
turb_naca0012_p1c1.timeout = 1600
681681
turb_naca0012_p1c1.tol = 0.00001
@@ -686,7 +686,7 @@ def main():
686686
turb_naca0012_p1c2.cfg_dir = "rans_uq/naca0012"
687687
turb_naca0012_p1c2.cfg_file = "turb_NACA0012_uq_p1c2.cfg"
688688
turb_naca0012_p1c2.test_iter = 10
689-
turb_naca0012_p1c2.test_vals = [-5.556656, 0.941889, 0.956330, 0.069297] #last 4 columns
689+
turb_naca0012_p1c2.test_vals = [-5.556656, 0.941887, 0.952078, 0.041824] #last 4 columns
690690
turb_naca0012_p1c2.su2_exec = "parallel_computation.py -f"
691691
turb_naca0012_p1c2.timeout = 1600
692692
turb_naca0012_p1c2.tol = 0.00001
@@ -713,7 +713,7 @@ def main():
713713
hb_rans_preconditioning.cfg_dir = "harmonic_balance/hb_rans_preconditioning"
714714
hb_rans_preconditioning.cfg_file = "davis.cfg"
715715
hb_rans_preconditioning.test_iter = 25
716-
hb_rans_preconditioning.test_vals = [-1.909596, -5.954720, 0.007773, 0.131219] #last 4 columns
716+
hb_rans_preconditioning.test_vals = [-1.902361, -5.950093, 0.007786, 0.128110] #last 4 columns
717717
hb_rans_preconditioning.su2_exec = "parallel_computation.py -f"
718718
hb_rans_preconditioning.timeout = 1600
719719
hb_rans_preconditioning.tol = 0.00001
@@ -856,7 +856,7 @@ def main():
856856
Jones_tc.cfg_dir = "turbomachinery/APU_turbocharger"
857857
Jones_tc.cfg_file = "Jones.cfg"
858858
Jones_tc.test_iter = 5
859-
Jones_tc.test_vals = [-5.280323, 0.379654, 44.725390, 2.271597] #last 4 columns
859+
Jones_tc.test_vals = [-5.280323, 0.379654, 72.206950, 1.277699] #last 4 columns
860860
Jones_tc.su2_exec = "parallel_computation.py -f"
861861
Jones_tc.timeout = 1600
862862
Jones_tc.new_output = False
@@ -868,7 +868,7 @@ def main():
868868
Jones_tc_rst.cfg_dir = "turbomachinery/APU_turbocharger"
869869
Jones_tc_rst.cfg_file = "Jones_rst.cfg"
870870
Jones_tc_rst.test_iter = 5
871-
Jones_tc_rst.test_vals = [-4.626538, -1.570728, 34.013520, 10.190740] #last 4 columns
871+
Jones_tc_rst.test_vals = [-4.625211, -1.568755, 33.994550, 10.181630] #last 4 columns
872872
Jones_tc_rst.su2_exec = "parallel_computation.py -f"
873873
Jones_tc_rst.timeout = 1600
874874
Jones_tc_rst.new_output = False
@@ -880,7 +880,7 @@ def main():
880880
axial_stage2D.cfg_dir = "turbomachinery/axial_stage_2D"
881881
axial_stage2D.cfg_file = "Axial_stage2D.cfg"
882882
axial_stage2D.test_iter = 20
883-
axial_stage2D.test_vals = [-1.933205, 5.381311, 73.357930, 1.780467] #last 4 columns
883+
axial_stage2D.test_vals = [-1.933206, 5.379711, 73.357930, 0.925874] #last 4 columns
884884
axial_stage2D.su2_exec = "parallel_computation.py -f"
885885
axial_stage2D.timeout = 1600
886886
axial_stage2D.new_output = False
@@ -892,7 +892,7 @@ def main():
892892
transonic_stator.cfg_dir = "turbomachinery/transonic_stator_2D"
893893
transonic_stator.cfg_file = "transonic_stator.cfg"
894894
transonic_stator.test_iter = 20
895-
transonic_stator.test_vals = [-0.576128, 5.820136, 96.994800, 0.062868] #last 4 columns
895+
transonic_stator.test_vals = [-0.575758, 5.826350, 96.764000, 0.062990] #last 4 columns
896896
transonic_stator.su2_exec = "parallel_computation.py -f"
897897
transonic_stator.timeout = 1600
898898
transonic_stator.new_output = False

0 commit comments

Comments
 (0)