43 solutionControl::read(
false);
45 const dictionary pimpleDict(dict());
47 solveFlow_ = pimpleDict.lookupOrDefault(
"solveFlow",
true);
48 nCorrPIMPLE_ = pimpleDict.lookupOrDefault<label>(
"nOuterCorrectors", 1);
49 nCorrPISO_ = pimpleDict.lookupOrDefault<label>(
"nCorrectors", 1);
50 SIMPLErho_ = pimpleDict.lookupOrDefault(
"SIMPLErho",
false);
52 pimpleDict.lookupOrDefault(
"turbOnFinalIterOnly",
true);
58 if ((corr_ == 1) || residualControl_.empty() || finalIter())
63 const bool storeIni = this->storeInitialResiduals();
68 const dictionary& solverDict = mesh_.solverPerformanceDict();
69 forAllConstIters(solverDict, iter)
71 const entry& solverPerfDictEntry = *iter;
73 const word& fieldName = solverPerfDictEntry.keyword();
74 const label fieldi = applyToField(fieldName);
78 Pair<scalar> residuals = maxResidual(solverPerfDictEntry);
82 scalar relative = 0.0;
83 bool relCheck =
false;
86 (residuals.last() < residualControl_[fieldi].absTol);
90 residualControl_[fieldi].initialResidual = residuals.first();
95 (residualControl_[fieldi].initialResidual + ROOTVSMALL);
97 relative = residuals.last() / iniRes;
98 relCheck = (relative < residualControl_[fieldi].relTol);
101 achieved = achieved && (absCheck || relCheck);
105 Info << algorithmName_ <<
" loop:" << endl;
107 Info <<
" " << fieldName
108 <<
" PIMPLE iter " << corr_
110 << residualControl_[fieldi].initialResidual
111 <<
", abs tol = " << residuals.last()
112 <<
" (" << residualControl_[fieldi].absTol <<
")"
113 <<
", rel tol = " << relative
114 <<
" (" << residualControl_[fieldi].relTol <<
")"
120 return checked && achieved;
127 <<
" corrPISO:" << corrPISO_
128 <<
" corrNonOrtho:" << corrNonOrtho_
131 solutionControl::setFirstIterFlag(check && corrPISO_ <= 1, force);
136 Foam::pimpleControlDF::pimpleControlDF(fvMesh&
mesh,
const word& dictName)
137 : solutionControl(
mesh, dictName),
143 turbOnFinalIterOnly_(true),
153 if (residualControl_.empty())
155 Info <<
": no residual control data found. "
157 <<
" corrector loops" << nl;
163 for (
const fieldData& ctrl : residualControl_)
165 Info <<
" field " << ctrl.name << token::TAB
166 <<
": relTol " << ctrl.relTol
167 <<
", tolerance " << ctrl.absTol
174 Info <<
": Operating solver in PISO mode" << nl;
190 Info << algorithmName_ <<
" loop: corr = " << corr_ << endl;
195 if (corr_ == nCorrPIMPLE_ + 1)
197 if (!residualControl_.empty() && (nCorrPIMPLE_ != 1))
201 Info << algorithmName_ <<
": not converged within "
202 << nCorrPIMPLE_ <<
" iterations" << endl;
207 mesh_.data::remove(
"finalIteration");
211 bool completed =
false;
212 if (converged_ || criteriaSatisfied())
218 Info << algorithmName_ <<
": converged in " << corr_ - 1
219 <<
" iterations" << endl;
222 mesh_.data::remove(
"finalIteration");
232 Info << algorithmName_ <<
": iteration " << corr_ << endl;
234 storePrevIterFields();
236 mesh_.data::add(
"finalIteration",
true);
244 mesh_.data::add(
"finalIteration",
true);
247 if (corr_ <= nCorrPIMPLE_)
251 Info << algorithmName_ <<
": iteration " << corr_ << endl;
253 storePrevIterFields();