39 void Foam::solution::readDict()
43 printDictionary print(
subDict(
"cache"));
50 if (
found(
"relaxationFactors"))
53 printDictionary print(relaxDict);
55 if (relaxDict.found(
"fields") || relaxDict.found(
"equations"))
57 if (relaxDict.found(
"fields"))
59 fieldRelaxDict_ = &relaxDict.
subDict(
"fields");
62 if (relaxDict.found(
"equations"))
64 eqnRelaxDict_ = &relaxDict.
subDict(
"equations");
70 <<
"Neither fields nor equations specified" <<
endl;
77 printDictionary print(*solvers_);
105 cache_(
"cache", *this),
107 fieldRelaxDict_(nullptr),
108 eqnRelaxDict_(nullptr),
109 fieldRelaxDefault_(0),
128 return cache_.found(
name);
146 cache_.add(
name,
true);
154 Info<<
"Field relaxation factor for " <<
name
155 <<
" is " << (fieldRelaxDict_->found(
name) ?
"set" :
"unset")
159 return fieldRelaxDict_->found(
name) || fieldRelaxDict_->found(
"default");
167 Info<<
"Find equation relaxation factor for " <<
name <<
endl;
170 return eqnRelaxDict_->found(
name) || eqnRelaxDict_->found(
"default");
178 Info<<
"Lookup variable relaxation factor for " <<
name <<
endl;
181 if (fieldRelaxDict_->found(
name))
183 return fieldRelaxDict_->lookup<scalar>(
name);
185 else if (fieldRelaxDefault_ > small)
187 return fieldRelaxDefault_;
194 ) <<
"Cannot find variable relaxation factor for '" <<
name
195 <<
"' or a suitable default value."
207 Info<<
"Lookup equation relaxation factor for " <<
name <<
endl;
210 if (eqnRelaxDict_->found(
name))
212 return eqnRelaxDict_->lookup<scalar>(
name);
214 else if (eqnRelaxDefault_ > small)
216 return eqnRelaxDefault_;
223 ) <<
"Cannot find equation relaxation factor for '" <<
name
224 <<
"' or a suitable default value."
245 return solvers_->subDict(
name);
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...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
dictionary()
Construct top-level dictionary null.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
static const dictionary null
Null dictionary.
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.
scalar equationRelaxationFactor(const word &name) const
Return the relaxation factor for the given eqation.
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.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
int system(const std::string &command)
Execute the specified command.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)