47 if (dict.found(
"cache"))
49 cache_ = dict.subDict(
"cache");
50 caching_ = cache_.lookupOrDefault(
"active",
true);
53 if (dict.found(
"relaxationFactors"))
55 const dictionary& relaxDict(dict.subDict(
"relaxationFactors"));
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;
97 fieldRelaxDict_.lookupOrDefault<scalar>(
"default", 0.0);
100 eqnRelaxDict_.lookupOrDefault<scalar>(
"default", 0.0);
104 Info<<
"Relaxation factors:" <<
nl 105 <<
"fields: " << fieldRelaxDict_ <<
nl 106 <<
"equations: " << eqnRelaxDict_ <<
endl;
111 if (dict.found(
"solvers"))
113 solvers_ = dict.subDict(
"solvers");
114 upgradeSolverDict(solvers_);
142 fieldRelaxDefault_(0),
164 if (!iter().isDict())
170 subdict.
add(
"solver", name);
182 if (ePtr && !ePtr->
isDict())
190 newDict.
add(dictName, name);
193 subdict.
set(dictName, newDict);
201 Info<<
"// using new solver syntax:\n" 202 << iter().keyword() << subdict <<
endl;
206 dict.
set(iter().keyword(), subdict);
222 Info<<
"Cache: find entry for " << name <<
endl;
225 return cache_.found(name);
238 Info<<
"Field relaxation factor for " << name
239 <<
" is " << (fieldRelaxDict_.found(name) ?
"set" :
"unset")
243 return fieldRelaxDict_.found(name) || fieldRelaxDict_.found(
"default");
251 Info<<
"Find equation relaxation factor for " << name <<
endl;
254 return eqnRelaxDict_.found(name) || eqnRelaxDict_.found(
"default");
262 Info<<
"Lookup variable relaxation factor for " << name <<
endl;
265 if (fieldRelaxDict_.found(name))
267 return fieldRelaxDict_.lookup<scalar>(
name);
269 else if (fieldRelaxDefault_ > small)
271 return fieldRelaxDefault_;
278 ) <<
"Cannot find variable relaxation factor for '" << name
279 <<
"' or a suitable default value." 291 Info<<
"Lookup equation relaxation factor for " << name <<
endl;
294 if (eqnRelaxDict_.found(name))
296 return eqnRelaxDict_.lookup<scalar>(
name);
298 else if (eqnRelaxDefault_ > small)
300 return eqnRelaxDefault_;
307 ) <<
"Cannot find equation relaxation factor for '" << name
308 <<
"' or a suitable default value." 339 Info<<
"Lookup solver for " << name <<
endl;
342 return solvers_.subDict(name);
scalar equationRelaxationFactor(const word &name) const
Return the relaxation factor for the given eqation.
#define forAll(list, i)
Loop across all elements in list.
A class for handling file names.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool read()
Read object.
A list of keyword definitions, which are a keyword followed by any number of values (e...
bool read()
Read the solution dictionary.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
bool relaxField(const word &name) const
Return true if the relaxation factor is given for the field.
const dictionary & solverDict(const word &name) const
Return the solver controls dictionary for the given field.
bool relaxEquation(const word &name) const
Return true if the relaxation factor is given for the equation.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
bool read(const char *, int32_t &)
stressControl lookup("compactNormalStress") >> compactNormalStress
static const Foam::List< Foam::word > subDictNames(Foam::IStringStream("(preconditioner smoother)")())
A class for handling words, derived from string.
bool cache(const word &name) const
Return true if the given field should be cached.
static const dictionary null
Null dictionary.
bool eof() const
Return true if end of input seen.
const word & system() const
Return system name.
virtual bool isDict() const
Return true if this entry is a dictionary.
solution(const objectRegistry &obr, const fileName &dictName)
Construct for given objectRegistry and dictionary.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
const dictionary & solversDict() const
Return the solver controls dictionary.
List< word > wordList
A List of words.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Input from memory buffer stream.
scalar fieldRelaxationFactor(const word &name) const
Return the relaxation factor for the given field.
void set(entry *)
Assign a new entry, overwrite any existing entry.
const doubleScalar e
Elementary charge.
Registry of regIOobjects.
virtual ITstream & stream() const =0
Return token stream if this entry is a primitive entry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static label upgradeSolverDict(dictionary &dict, const bool verbose=true)
Update from older solver controls syntax.
const dictionary & dict() const
Return the selected sub-dictionary of solvers if the "select".
A keyword and a list of tokens is an 'entry'.