56 if (relaxDict.found(
"fields") || relaxDict.found(
"equations"))
58 if (relaxDict.found(
"fields"))
60 fieldRelaxDict_ = relaxDict.
subDict(
"fields");
63 if (relaxDict.found(
"equations"))
65 eqnRelaxDict_ = relaxDict.
subDict(
"equations");
71 fieldRelaxDict_.
clear();
73 const wordList entryNames(relaxDict.toc());
76 const word&
e = entryNames[i];
77 scalar value = relaxDict.lookup<scalar>(
e);
81 fieldRelaxDict_.
add(
e, value);
83 else if (
e.length() >= 3)
87 fieldRelaxDict_.
add(
e, value);
93 eqnRelaxDict_ = relaxDict;
104 Info<<
"Relaxation factors:" <<
nl
105 <<
"fields: " << fieldRelaxDict_ <<
nl
106 <<
"equations: " << eqnRelaxDict_ <<
endl;
142 fieldRelaxDefault_(0),
164 if (!iter().isDict())
182 if (ePtr && !ePtr->
isDict())
193 subdict.
set(dictName, newDict);
201 Info<<
"// using new solver syntax:\n"
202 << iter().keyword() << subdict <<
endl;
206 dict.
set(iter().keyword(), subdict);
225 return cache_.found(
name);
243 cache_.add(
name,
true);
251 Info<<
"Field relaxation factor for " <<
name
252 <<
" is " << (fieldRelaxDict_.found(
name) ?
"set" :
"unset")
256 return fieldRelaxDict_.found(
name) || fieldRelaxDict_.found(
"default");
264 Info<<
"Find equation relaxation factor for " <<
name <<
endl;
267 return eqnRelaxDict_.found(
name) || eqnRelaxDict_.found(
"default");
275 Info<<
"Lookup variable relaxation factor for " <<
name <<
endl;
278 if (fieldRelaxDict_.found(
name))
280 return fieldRelaxDict_.lookup<scalar>(
name);
282 else if (fieldRelaxDefault_ > small)
284 return fieldRelaxDefault_;
291 ) <<
"Cannot find variable relaxation factor for '" <<
name
292 <<
"' or a suitable default value."
304 Info<<
"Lookup equation relaxation factor for " <<
name <<
endl;
307 if (eqnRelaxDict_.found(
name))
309 return eqnRelaxDict_.lookup<scalar>(
name);
311 else if (eqnRelaxDefault_ > small)
313 return eqnRelaxDefault_;
320 ) <<
"Cannot find equation relaxation factor for '" <<
name
321 <<
"' or a suitable default value."
333 return subDict(
word(lookup(
"select")));
355 return solvers_.subDict(
name);
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
bool eof() const
Return true if end of input seen.
Input from memory buffer stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static bool master(const label communicator=0)
Am I the master process.
A list of keyword definitions, which are a keyword followed by any number of values (e....
dictionary()
Construct top-level dictionary null.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
void set(entry *)
Assign a new entry, overwrite any existing entry.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
void clear()
Clear the dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
A keyword and a list of tokens is an 'entry'.
virtual bool isDict() const
Return true if this entry is a dictionary.
virtual ITstream & stream() const =0
Return token stream if this entry is a primitive entry.
A class for handling file names.
Registry of regIOobjects.
virtual bool read()
Read object.
Selector class for relaxation factors, solver type and solution.
void enableCache(const word &name) const
Enable caching of the given field.
solution(const objectRegistry &obr, const fileName &dictName)
Construct for given objectRegistry and dictionary.
bool cache(const word &name) const
Return true if the given field should be cached.
const dictionary & solversDict() const
Return the solver controls dictionary.
bool relaxField(const word &name) const
Return true if the relaxation factor is given for the field.
scalar fieldRelaxationFactor(const word &name) const
Return the relaxation factor for the given field.
const dictionary & solverDict(const word &name) const
Return the solver controls dictionary for the given field.
static label upgradeSolverDict(dictionary &dict, const bool verbose=true)
Update from older solver controls syntax.
scalar equationRelaxationFactor(const word &name) const
Return the relaxation factor for the given eqation.
const dictionary & dict() const
Return the selected sub-dictionary of solvers if the "select".
bool relaxEquation(const word &name) const
Return true if the relaxation factor is given for the equation.
bool read()
Read the solution dictionary.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
int system(const std::string &command)
Execute the specified command.
List< word > wordList
A List of words.
bool read(const char *, int32_t &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
defineTypeNameAndDebug(combustionModel, 0)
static const Foam::List< Foam::word > subDictNames(Foam::IStringStream("(preconditioner smoother)")())