Go to the documentation of this file.
42 "preconditioner",
"smoother"
50 if (
dict.found(
"cache"))
52 cache_ =
dict.subDict(
"cache");
56 if (
dict.found(
"relaxationFactors"))
59 if (relaxDict.found(
"fields") || relaxDict.found(
"equations"))
61 if (relaxDict.found(
"fields"))
63 fieldRelaxDict_ = relaxDict.
subDict(
"fields");
66 if (relaxDict.found(
"equations"))
68 eqnRelaxDict_ = relaxDict.
subDict(
"equations");
74 fieldRelaxDict_.
clear();
76 for (
const word&
e : relaxDict.toc())
78 scalar value = relaxDict.get<scalar>(
e);
80 if (
e.starts_with(
'p'))
82 fieldRelaxDict_.
add(
e, value);
84 else if (
e.starts_with(
"rho"))
86 fieldRelaxDict_.
add(
e, value);
91 eqnRelaxDict_ = relaxDict;
101 <<
"Relaxation factors:" <<
nl
102 <<
"fields: " << fieldRelaxDict_ <<
nl
103 <<
"equations: " << eqnRelaxDict_ <<
endl;
106 if (
dict.found(
"solvers"))
108 solvers_ =
dict.subDict(
"solvers");
116 Foam::solution::solution
142 fieldRelaxDefault_(0),
158 Foam::solution::solution
186 fieldRelaxDefault_(0),
216 if (!dEntry.isDict())
233 if (eptr && !eptr->
isDict())
252 Info<<
"// using new solver syntax:\n"
253 << dEntry.keyword() << subdict <<
endl;
257 dict.
set(dEntry.keyword(), subdict);
272 <<
"Cache: find entry for " <<
name <<
endl;
274 return cache_.found(
name);
284 <<
"Field relaxation factor for " <<
name
285 <<
" is " << (fieldRelaxDict_.found(
name) ?
"set" :
"unset") <<
endl;
287 return fieldRelaxDict_.found(
name) || fieldRelaxDict_.found(
"default");
294 <<
"Find equation relaxation factor for " <<
name <<
endl;
296 return eqnRelaxDict_.found(
name) || eqnRelaxDict_.found(
"default");
303 <<
"Lookup variable relaxation factor for " <<
name <<
endl;
305 if (fieldRelaxDict_.found(
name))
307 return fieldRelaxDict_.get<scalar>(
name);
309 else if (fieldRelaxDefault_ > SMALL)
311 return fieldRelaxDefault_;
315 <<
"Cannot find variable relaxation factor for '" <<
name
316 <<
"' or a suitable default value." <<
nl
326 <<
"Lookup equation relaxation factor for " <<
name <<
endl;
328 if (eqnRelaxDict_.found(
name))
330 return eqnRelaxDict_.get<scalar>(
name);
332 else if (eqnRelaxDefault_ > SMALL)
334 return eqnRelaxDefault_;
338 <<
"Cannot find equation relaxation factor for '" <<
name
339 <<
"' or a suitable default value."
350 return subDict(get<word>(
"select"));
360 <<
"Lookup solver for " <<
name <<
endl;
362 return solvers_.subDict(
name);
369 <<
"Lookup solver for " <<
name <<
endl;
371 return solvers_.subDict(
name);
A keyword and a list of tokens is an 'entry'.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const dictionary & solverDict(const word &name) const
Return the solver controls dictionary for the given field.
A class for handling words, derived from Foam::string.
A class for handling file names.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
defineDebugSwitchWithName(pointMVCWeight, "pointMVCWeight", 0)
bool cache(const word &name) const
Return true if the given field should be cached.
bool eof() const
Return true if end of input seen.
dictionary()
Default construct, a top-level empty dictionary.
bool read(const char *buf, int32_t &val)
Same as readInt32.
const Time & time() const
Return time.
virtual bool read()
Read object.
fvSolution solutionDict(runTime)
const word dictName("blockMeshDict")
static label upgradeSolverDict(dictionary &dict, const bool verbose=true)
Update from older solver controls syntax.
static bool master(const label communicator=worldComm)
Am I the master process.
Ostream & endl(Ostream &os)
Add newline and flush stream.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
static const Foam::List< Foam::word > subDictNames({ "preconditioner", "smoother" })
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Registry of regIOobjects.
scalar fieldRelaxationFactor(const word &name) const
Return the relaxation factor for the given field.
virtual bool isDict() const
Return true if this entry is a dictionary.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool read()
Read the solution dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool relaxEquation(const word &name) const
Return true if the relaxation factor is given for the equation.
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar equationRelaxationFactor(const word &name) const
Return the relaxation factor for the given equation.
const word & system() const
Return system name.
const dictionary & solutionDict() const
Return the selected sub-dictionary of solvers if the "select".
#define DebugInfo
Report an information message using Foam::Info.
readOption readOpt() const
The read option.
entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find for an entry (non-const access) with the given keyword.
const dimensionedScalar e
Elementary charge.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const dictionary & solver(const word &name) const
Return the solver controls dictionary for the given field.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
void clear()
Clear the dictionary.
bool relaxField(const word &name) const
Return true if the relaxation factor is given for the field.