Skip to content

Commit c5dcdc4

Browse files
committed
Automatically modify the scaling factor of relative Cauchy convergence
for coefficients that are close to zero. Example: For the clean aircraft, the rolling moment coefficient MOMENT_X is close to zero and thus will never reach a relative cauchy convergence ->> dividing tiny numbers is not a good idea. Using absolute cauchy convergence is more robust in this case. See also short discussion on the CFD-online forum: https://www.cfd-online.com/Forums/su2/240148-cauchy-convergence-criteria-cmx-cmy-cmz.html
1 parent 4f85841 commit c5dcdc4

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

SU2_CFD/src/output/COutput.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,7 @@ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) {
850850
for (unsigned short iField_Conv = 0; iField_Conv < convFields.size(); iField_Conv++){
851851

852852
bool fieldConverged = false;
853+
su2double cauchyScalingFactor = 1.0;
853854

854855
const string &convField = convFields[iField_Conv];
855856
if (historyOutput_Map.count(convField) > 0){
@@ -873,7 +874,17 @@ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) {
873874

874875
oldFunc[iField_Conv] = newFunc[iField_Conv];
875876
newFunc[iField_Conv] = monitor;
876-
cauchyFunc = fabs(newFunc[iField_Conv] - oldFunc[iField_Conv])/fabs(monitor);
877+
878+
/*--- Automatically modify the scaling factor of relative Cauchy convergence for
879+
* coefficients that are close to zero. Example: For the clean aircraft, the rolling
880+
* moment coefficient MOMENT_X is close to zero and thus will never reach a relative
881+
* cauchy convergence ->> dividing tiny numbers is not a good idea. Using absolute
882+
* cauchy convergence is more robust in this case. ---*/
883+
884+
if (fabs(monitor) <= 0.1) { cauchyScalingFactor = 0.1; }
885+
else { cauchyScalingFactor = fabs(monitor); }
886+
887+
cauchyFunc = fabs(newFunc[iField_Conv] - oldFunc[iField_Conv])/cauchyScalingFactor;
877888

878889
cauchySerie[iField_Conv][Iteration % nCauchy_Elems] = cauchyFunc;
879890
cauchyValue = 0.0;

0 commit comments

Comments
 (0)