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_);
147 fieldRelaxDefault_(0),
158 read(solutionDict());
177 if (!iter().isDict())
183 subdict.
add(
"solver", name);
195 if (ePtr && !ePtr->
isDict())
203 newDict.
add(dictName, name);
206 subdict.
set(dictName, newDict);
214 Info<<
"// using new solver syntax:\n" 215 << iter().keyword() << subdict <<
endl;
219 dict.
set(iter().keyword(), subdict);
235 Info<<
"Cache: find entry for " << name <<
endl;
238 return cache_.found(name);
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." 346 Info<<
"Lookup solver for " << name <<
endl;
349 return solvers_.subDict(name);
357 read(solutionDict());
scalar equationRelaxationFactor(const word &name) const
Return the relaxation factor for the given eqation.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
const dictionary & solutionDict() const
Return the selected sub-dictionary of solvers if the "select".
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.
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.
readOption readOpt() const
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.
A keyword and a list of tokens is an 'entry'.