53 bool satisfied(
false);
58 if (subCycledTimePtr_().index() == 1)
73 if (mesh_.time().timeIndex() == mesh_.time().startTimeIndex() + 1)
75 return nInitialIters_;
86 Time&
runTime =
const_cast<Time&
>(mesh_.time());
87 if (
runTime.deltaTValue() != deltaTSubSycle_)
96Foam::SIMPLEControlOpt::SIMPLEControlOpt
99 const word& managerType,
103 SIMPLEControl(
mesh, managerType, solver),
105 subCycledTimePtr_(nullptr),
106 deltaTSubSycle_(
Zero)
128 bool doNextIter(
true);
133 if (!subCycledTimePtr_)
136 Info<<
"Solving equations for solver "
137 << solver_.solverName() <<
"\n" <<
endl;
138 deltaTSubSycle_ =
runTime.deltaTValue();
152 subCycledTimePtr_()++;
153 iter_ = subCycledTimePtr_().index();
156 if (criteriaSatisfied())
159 << solver_.solverName()
160 <<
" solution converged in "
161 << subCycledTimePtr_->index() <<
" iterations" <<
nl <<
endl;
163 subCycledTimePtr_->endSubCycle();
164 subCycledTimePtr_.clear();
176 else if (subCycledTimePtr_->end())
179 << solver_.solverName()
180 <<
" solution reached max. number of iterations "
181 << subCycledTimePtr_().nSubCycles() <<
nl <<
endl;
183 subCycledTimePtr_->endSubCycle();
184 subCycledTimePtr_.clear();
200 <<
"Iteration " << subCycledTimePtr_().index()
201 <<
"|" << subCycledTimePtr_().nSubCycles() <<
endl;
211 <<
"Number of iterations is non-positive (" << nIters() <<
")."
213 <<
"Skipping the solution of the equations corresponding to solver "
214 << solver_.solverName()
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
SIMPLE control class for optimisation runs. Each time is sub-cycled and corresponds to one optimisati...
autoPtr< subCycleTime > subCycledTimePtr_
Subcycled time.
label nInitialIters_
Number of iterations for the first optimisation cycle.
scalar deltaTSubSycle_
deltaT of the sub-cycled time
virtual bool write(const bool valid=true) const
Whether to call time.write() or not.
const label & nIters() const
Maximum number of solver iterations.
virtual bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
void resetDeltaT()
Reset deltaT in case controlDict has been re-written at run-time.
virtual bool read()
Read controls from optimisationDict.
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
label nIters_
Number of SIMPLE iterations.
virtual const dictionary dict() const
Return the solution dictionary.
void checkMeanSolution() const
virtual bool read()
Read controls from optimisationDict.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void readModifiedObjects()
Read the objects that have been modified.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
Mesh data needed to do the Finite Volume discretisation.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
bool criteriaSatisfied()
Return true if all convergence checks are satisfied.
fvMesh & mesh_
Reference to the mesh database.
virtual void storePrevIterFields() const
Store previous iteration fields.
const solver & solver_
Reference to the underlaying solver.
label iter_
Current iteration index.
A class for managing sub-cycling times.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
bool read(const char *buf, int32_t &val)
Same as readInt32.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
constexpr char nl
The newline '\n' character (0x0a).