Skip to content

Commit 3c13100

Browse files
authored
Merge branch 'develop' into fix_aachen_testcase
2 parents e60ccba + 492ada9 commit 3c13100

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

Common/include/CConfig.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ class CConfig {
11091109
bool Radiation; /*!< \brief Determines if a radiation model is incorporated. */
11101110
su2double CFL_Rad; /*!< \brief CFL Number for the radiation solver. */
11111111

1112-
array<su2double,5> default_cfl_adapt; /*!< \brief Default CFL adapt param array for the COption class. */
1112+
array<su2double,6> default_cfl_adapt; /*!< \brief Default CFL adapt param array for the COption class. */
11131113
su2double vel_init[3], /*!< \brief initial velocity array for the COption class. */
11141114
vel_inf[3], /*!< \brief freestream velocity array for the COption class. */
11151115
eng_cyl[7], /*!< \brief engine box array for the COption class. */

Common/src/CConfig.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,11 +1777,16 @@ void CConfig::SetConfig_Options() {
17771777
/* DESCRIPTION: Activate The adaptive CFL number. */
17781778
addBoolOption("CFL_ADAPT", CFL_Adapt, false);
17791779
/* !\brief CFL_ADAPT_PARAM
1780-
* DESCRIPTION: Parameters of the adaptive CFL number (factor down, factor up, CFL limit (min and max), acceptable linear residual )
1780+
* DESCRIPTION: Parameters of the adaptive CFL number (factor down, factor up, CFL limit (min and max)[, acceptable linear residual][, starting iteration]).
1781+
* Parameters in square brackets are optional, parameter "starting iteration" only valid with parameter "acceptable linear residual".
17811782
* Factor down generally <1.0, factor up generally > 1.0 to cause the CFL to increase when the under-relaxation parameter is 1.0
17821783
* and to decrease when the under-relaxation parameter is less than 0.1. Factor is multiplicative. \ingroup Config*/
1783-
default_cfl_adapt[0] = 1.0; default_cfl_adapt[1] = 1.0; default_cfl_adapt[2] = 10.0; default_cfl_adapt[3] = 100.0;
1784+
default_cfl_adapt[0] = 0.1;
1785+
default_cfl_adapt[1] = 1.2;
1786+
default_cfl_adapt[2] = 10.0;
1787+
default_cfl_adapt[3] = 100.0;
17841788
default_cfl_adapt[4] = 0.001;
1789+
default_cfl_adapt[5] = 0.0;
17851790
addDoubleListOption("CFL_ADAPT_PARAM", nCFL_AdaptParam, CFL_AdaptParam);
17861791
/* DESCRIPTION: Reduction factor of the CFL coefficient in the adjoint problem */
17871792
addDoubleOption("CFL_REDUCTION_ADJFLOW", CFLRedCoeff_AdjFlow, 0.8);
@@ -7230,7 +7235,8 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
72307235
if (!CFL_Adapt) cout << "No CFL adaptation." << endl;
72317236
else cout << "CFL adaptation. Factor down: "<< CFL_AdaptParam[0] <<", factor up: "<< CFL_AdaptParam[1]
72327237
<<",\n lower limit: "<< CFL_AdaptParam[2] <<", upper limit: " << CFL_AdaptParam[3]
7233-
<<",\n acceptable linear residual: "<< CFL_AdaptParam[4] << "." << endl;
7238+
<<",\n acceptable linear residual: "<< CFL_AdaptParam[4]
7239+
<<"'\n starting iteration: "<< CFL_AdaptParam[5] << "." << endl;
72347240

72357241
if (nMGLevels !=0) {
72367242
PrintingToolbox::CTablePrinter MGTable(&std::cout);

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,7 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,
17171717
const su2double CFLMin = config->GetCFL_AdaptParam(2);
17181718
const su2double CFLMax = config->GetCFL_AdaptParam(3);
17191719
const su2double acceptableLinTol = config->GetCFL_AdaptParam(4);
1720+
const su2double startingIter = config->GetCFL_AdaptParam(5);
17201721
const bool fullComms = (config->GetComm_Level() == COMM_FULL);
17211722

17221723
/* Number of iterations considered to check for stagnation. */
@@ -1764,8 +1765,12 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,
17641765

17651766
/* Check if we should decrease or if we can increase, the 20% is to avoid flip-flopping. */
17661767
resetCFL = linRes > 0.99;
1767-
reduceCFL = linRes > 1.2*linTol;
1768-
canIncrease = linRes < linTol;
1768+
unsigned long iter = config->GetMultizone_Problem() ? config->GetOuterIter() : config->GetInnerIter();
1769+
1770+
/* only change CFL number when larger than starting iteration */
1771+
reduceCFL = (linRes > 1.2*linTol) && (iter >= startingIter);
1772+
1773+
canIncrease = (linRes < linTol) && (iter >= startingIter);
17691774

17701775
if ((iMesh == MESH_0) && (Res_Count > 0)) {
17711776
Old_Func = New_Func;

config_template.cfg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,12 +1389,12 @@ CFL_NUMBER= 15.0
13891389
CFL_ADAPT= NO
13901390
%
13911391
% Parameters of the adaptive CFL number (factor-down, factor-up, CFL min value,
1392-
% CFL max value, acceptable linear solver convergence)
1393-
% Local CFL increases by factor-up until max if the solution rate of change is not limited,
1394-
% and acceptable linear convergence is achieved. It is reduced if rate is limited, or if there
1392+
% CFL max value, acceptable linear solver convergence, starting iteration)
1393+
% After the starting iteration has passed, local CFL increases by factor-up until max if the solution rate of
1394+
% change is not limited, and acceptable linear convergence is achieved. It is reduced if rate is limited, or if there
13951395
% is not enough linear convergence, or if the nonlinear residuals are stagnant and oscillatory.
13961396
% It is reset back to min when linear solvers diverge, or if nonlinear residuals increase too much.
1397-
CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10, 0.001 )
1397+
CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10, 0.001, 0)
13981398
%
13991399
% Maximum Delta Time in local time stepping simulations
14001400
MAX_DELTA_TIME= 1E6

0 commit comments

Comments
 (0)