47 solutionDict.
getOrDefault<label>(
"nNonOrthogonalCorrectors", 0);
62 for (
const entry& dEntry : residualDict)
64 const word& fName = dEntry.keyword();
69 fd.
name = fName.c_str();
73 fd.
absTol = residualDict.
get<scalar>(fName);
77 else if (dEntry.isDict())
80 fd.
absTol = fieldDict.
get<scalar>(
"tolerance");
81 fd.
relTol = fieldDict.
get<scalar>(
"relTol");
87 <<
"Residual data for " << dEntry.keyword()
88 <<
" must be specified as a dictionary"
99 fd.
absTol = residualDict.
get<scalar>(fName);
101 else if (dEntry.isDict())
104 fd.
absTol = fieldDict.
get<scalar>(
"tolerance");
105 fd.
relTol = fieldDict.
get<scalar>(
"relTol");
110 <<
"Residual data for " << dEntry.keyword()
111 <<
" must be specified as a dictionary"
124 Info<<
"residualControl[" << i <<
"]:" <<
nl
125 <<
" name : " << fd.
name <<
nl
144 const word& fieldName,
148 forAll(residualControl_, i)
150 if (residualControl_[i].
name.
match(fieldName, !useRegEx))
163 storePrevIter<scalar>();
164 storePrevIter<vector>();
165 storePrevIter<sphericalTensor>();
166 storePrevIter<symmTensor>();
167 storePrevIter<tensor>();
173 const entry& solverPerfDictEntry
176 return maxResidual(mesh_, solverPerfDictEntry);
187 <<
"solutionControl: force:" << force
188 <<
" check: " <<
check
189 <<
" corr: " << corr_
190 <<
" corrNonOrtho:" << corrNonOrtho_
193 if (force || (
check && corr_ <= 1 && corrNonOrtho_ == 0))
195 DebugInfo<<
"solutionControl: set firstIteration flag" <<
endl;
196 mesh_.data::set(
"firstIteration",
true);
200 DebugInfo<<
"solutionControl: remove firstIteration flag" <<
endl;
201 mesh_.data::remove(
"firstIteration");
220 const entry& solverPerfDictEntry,
226 const word& fieldName = solverPerfDictEntry.
keyword();
245 const entry& solverPerfDictEntry
253 maxTypeResidual<scalar>(fvmesh, solverPerfDictEntry, residuals)
254 || maxTypeResidual<vector>(fvmesh, solverPerfDictEntry, residuals)
255 || maxTypeResidual<sphericalTensor>(fvmesh, solverPerfDictEntry, residuals)
256 || maxTypeResidual<symmTensor>(fvmesh, solverPerfDictEntry, residuals)
257 || maxTypeResidual<tensor>(fvmesh, solverPerfDictEntry, residuals)
260 if (!ok && solutionControl::debug)
262 Info<<
"no residual for " << solverPerfDictEntry.
keyword()
263 <<
" on mesh " << fvmesh.
name() <<
nl;
287 algorithmName_(algorithmName),
289 momentumPredictor_(true),
fvSolution solutionDict(runTime)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
T & first() noexcept
The first element of the list, position [0].
T & last() noexcept
The last element of the list, position [N-1].
Generic GeometricField class.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
An ordered pair of two objects of type <T> with first() and second() elements.
T & first()
Return the first element of the list.
T & last()
Return the last element of the list.
Database for solution data, solver performance and other reduced data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
const keyType & keyword() const noexcept
Return keyword.
Mesh data needed to do the Finite Volume discretisation.
const word & name() const
Return reference to name.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Base class for solution control classes.
bool frozenFlow_
Flag to indicate that the flow system of equations should not.
bool transonic_
Flag to indicate to solve using transonic algorithm.
virtual bool writeData(Ostream &) const
Dummy write for regIOobject.
static bool maxTypeResidual(const fvMesh &fvmesh, const entry &solverPerfDictEntry, Pair< scalar > &residuals)
bool momentumPredictor_
Flag to indicate to solve for momentum.
List< fieldData > residualControl_
List of residual data per field.
virtual const dictionary dict() const
Return the solution dictionary.
bool consistent_
Flag to indicate to relax pressure using the.
virtual void storePrevIterFields() const
Store previous iteration fields.
virtual label applyToField(const word &fieldName, const bool useRegEx=true) const
Return index of field in residualControl_ if present.
label nNonOrthCorr_
Maximum number of non-orthogonal correctors.
static Pair< scalar > maxResidual(const fvMesh &fvmesh, const entry &dataDictEntry)
virtual void setFirstIterFlag(const bool check=true, const bool force=false)
Set the firstIteration flag on the mesh data dictionary.
virtual bool read()
Read controls from fvSolution dictionary.
bool match(const std::string &text) const
Test for equality.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
bool read(const char *buf, int32_t &val)
Same as readInt32.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void check(const int retVal, const char *what)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
Simple convenient storage of field residuals.