Skip to content

Commit

Permalink
Merge branch 'develop' into fix_cornernode_comp
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristopher-Morales committed Sep 21, 2024
2 parents f81246c + 8e561ee commit bb45348
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions SU2_CFD/src/solvers/CSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,7 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,

CSolver *solverFlow = solver_container[iMesh][FLOW_SOL];
CSolver *solverTurb = solver_container[iMesh][TURB_SOL];
CSolver *solverSpecies = solver_container[iMesh][SPECIES_SOL];

/* Compute the reduction factor for CFLs on the coarse levels. */

Expand All @@ -1744,10 +1745,12 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,
solver residual within the specified number of linear iterations. */

su2double linResTurb = 0.0;
su2double linResSpecies = 0.0;
if ((iMesh == MESH_0) && solverTurb) linResTurb = solverTurb->GetResLinSolver();
if ((iMesh == MESH_0) && solverSpecies) linResSpecies = solverSpecies->GetResLinSolver();

/* Max linear residual between flow and turbulence. */
const su2double linRes = max(solverFlow->GetResLinSolver(), linResTurb);
/* Max linear residual between flow and turbulence/species transport. */
const su2double linRes = max(solverFlow->GetResLinSolver(), max(linResTurb, linResSpecies));

/* Tolerance limited to an acceptable value. */
const su2double linTol = max(acceptableLinTol, config->GetLinear_Solver_Error());
Expand Down Expand Up @@ -1779,6 +1782,11 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,
New_Func += log10(solverTurb->GetRes_RMS(iVar));
}
}
if ((iMesh == MESH_0) && solverSpecies) {
for (unsigned short iVar = 0; iVar < solverSpecies->GetnVar(); iVar++) {
New_Func += log10(solverSpecies->GetRes_RMS(iVar));
}
}

/* Compute the difference in the nonlinear residuals between the
current and previous iterations, taking care with very low initial
Expand Down Expand Up @@ -1822,6 +1830,7 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,

su2double myCFLMin = 1e30, myCFLMax = 0.0, myCFLSum = 0.0;
const su2double CFLTurbReduction = config->GetCFLRedCoeff_Turb();
const su2double CFLSpeciesReduction = config->GetCFLRedCoeff_Species();

SU2_OMP_MASTER
if ((iMesh == MESH_0) && fullComms) {
Expand Down Expand Up @@ -1888,6 +1897,9 @@ void CSolver::AdaptCFLNumber(CGeometry **geometry,
if ((iMesh == MESH_0) && solverTurb) {
solverTurb->GetNodes()->SetLocalCFL(iPoint, CFL * CFLTurbReduction);
}
if ((iMesh == MESH_0) && solverSpecies) {
solverSpecies->GetNodes()->SetLocalCFL(iPoint, CFL * CFLSpeciesReduction);
}

/* Store min and max CFL for reporting on the fine grid. */

Expand Down

0 comments on commit bb45348

Please sign in to comment.