@@ -1921,7 +1921,45 @@ void CIncEulerSolver::PrepareImplicitIteration(CGeometry *geometry, CSolver**, C
19211921
19221922void CIncEulerSolver::CompleteImplicitIteration (CGeometry *geometry, CSolver**, CConfig *config) {
19231923
1924- CompleteImplicitIteration_impl<false >(geometry, config);
1924+ CompleteImplicitIteration_impl<true >(geometry, config);
1925+ }
1926+
1927+ void CIncEulerSolver::ComputeUnderRelaxationFactor (const CConfig* config) {
1928+ /* Apply the under-relaxation to energy equation. As the energy equation
1929+ for incompressible flows can be switch-off, the under-relaxation is not
1930+ applied when the energy equation is not solved. */
1931+
1932+ if (!config->GetEnergy_Equation ()) return ;
1933+
1934+ /* Loop over the solution update given by relaxing the linear
1935+ system for this nonlinear iteration. */
1936+
1937+ const su2double allowableRatio = config->GetMaxUpdateFractionFlow ();
1938+
1939+ SU2_OMP_FOR_STAT (omp_chunk_size)
1940+ for (unsigned long iPoint = 0 ; iPoint < nPointDomain; iPoint++) {
1941+ su2double localUnderRelaxation = 1.0 ;
1942+
1943+ /* We impose a limit on the maximum percentage that the
1944+ temperature can change over a nonlinear iteration. */
1945+
1946+ const unsigned long index = iPoint * nVar + nVar - 1 ;
1947+ su2double ratio = fabs (LinSysSol[index]) / (fabs (nodes->GetSolution (iPoint, nVar - 1 )) + EPS);
1948+ if (ratio > allowableRatio) {
1949+ localUnderRelaxation = min (allowableRatio / ratio, localUnderRelaxation);
1950+ }
1951+
1952+ /* Threshold the relaxation factor in the event that there is
1953+ a very small value. This helps avoid catastrophic crashes due
1954+ to non-realizable states by canceling the update. */
1955+
1956+ if (localUnderRelaxation < 1e-10 ) localUnderRelaxation = 0.0 ;
1957+
1958+ /* Store the under-relaxation factor for this point. */
1959+
1960+ nodes->SetUnderRelaxation (iPoint, localUnderRelaxation);
1961+ }
1962+ END_SU2_OMP_FOR
19251963}
19261964
19271965void CIncEulerSolver::SetBeta_Parameter (CGeometry *geometry, CSolver **solver_container,
0 commit comments