Go to the documentation of this file.
44 "preconditioner",
"smoother"
52 if (
dict.found(
"cache"))
54 cache_ =
dict.subDict(
"cache");
58 if (
dict.found(
"relaxationFactors"))
62 if (relaxDict.found(
"fields") || relaxDict.found(
"equations"))
64 if (relaxDict.found(
"fields"))
66 fieldRelaxDict_ = relaxDict.
subDict(
"fields");
67 fieldRelaxCache_.clear();
70 if (relaxDict.found(
"equations"))
72 eqnRelaxDict_ = relaxDict.
subDict(
"equations");
73 eqnRelaxCache_.clear();
79 fieldRelaxDict_.
clear();
80 fieldRelaxCache_.clear();
82 for (
const word&
e : relaxDict.toc())
84 scalar value = relaxDict.get<scalar>(
e);
86 if (
e.starts_with(
'p'))
88 fieldRelaxDict_.
add(
e, value);
90 else if (
e.starts_with(
"rho"))
92 fieldRelaxDict_.
add(
e, value);
96 eqnRelaxDict_ = relaxDict;
97 eqnRelaxCache_.clear();
106 if (!fieldRelaxDefault_)
108 fieldRelaxDefault_.reset
110 new Function1Types::Constant<scalar>(
"default", 0)
119 if (!eqnRelaxDefault_)
121 eqnRelaxDefault_.reset
123 new Function1Types::Constant<scalar>(
"default", 0)
128 <<
"Relaxation factors:" <<
nl
129 <<
"fields: " << fieldRelaxDict_ <<
nl
130 <<
"equations: " << eqnRelaxDict_ <<
endl;
133 if (
dict.found(
"solvers"))
135 solvers_ =
dict.subDict(
"solvers");
143 Foam::solution::solution
206 if (!dEntry.isDict())
223 if (eptr && !eptr->
isDict())
242 Info<<
"// using new solver syntax:\n"
243 << dEntry.keyword() << subdict <<
endl;
247 dict.
set(dEntry.keyword(), subdict);
262 return cache_.found(
name);
272 <<
"Field relaxation factor for " <<
name
273 <<
" is " << (fieldRelaxDict_.found(
name) ?
"set" :
"unset") <<
endl;
275 return fieldRelaxDict_.found(
name) || fieldRelaxDict_.found(
"default");
282 return eqnRelaxDict_.found(
name) || eqnRelaxDict_.found(
"default");
290 if (fieldRelaxDict_.found(
name))
298 )().value(time().timeOutputValue());
300 else if (fieldRelaxDefault_)
302 return fieldRelaxDefault_().
value(time().timeOutputValue());
306 <<
"Cannot find variable relaxation factor for '" <<
name
307 <<
"' or a suitable default value." <<
nl
318 if (eqnRelaxDict_.found(
name))
326 )().value(time().timeOutputValue());
328 else if (eqnRelaxDefault_)
330 return eqnRelaxDefault_().
value(time().timeOutputValue());
334 <<
"Cannot find equation relaxation factor for '" <<
name
335 <<
"' or a suitable default value."
346 return subDict(get<word>(
"select"));
356 return solvers_.subDict(
name);
363 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.
dictionary()
Default construct, a top-level empty dictionary.
bool read(const char *buf, int32_t &val)
Same as readInt32.
const word dictName("faMeshDefinition")
virtual bool isDict() const noexcept
Return true if this entry is a dictionary.
virtual bool read()
Read object.
fvSolution solutionDict(runTime)
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 autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType=word::null, const objectRegistry *obrPtr=nullptr)
An optional selector.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
static const Foam::List< Foam::word > subDictNames({ "preconditioner", "smoother" })
Registry of regIOobjects.
scalar fieldRelaxationFactor(const word &name) const
Return the relaxation factor for the given field.
An input stream of tokens.
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool eof() const noexcept
True if end of input seen.
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.
virtual Type value(const scalar x) const
Return value as a function of (scalar) independent variable.
virtual ~solution()
Destructor.
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.
readOption readOpt() const noexcept
The read option.
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.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
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.
const Time & time() const noexcept
Return time registry.