44 "preconditioner",
"smoother"
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;
219 if (!dEntry.isDict())
236 if (eptr && !eptr->
isDict())
255 Info<<
"// using new solver syntax:\n"
256 << dEntry.keyword() << subdict <<
endl;
260 dict.
set(dEntry.keyword(), subdict);
275 return cache_.found(
name);
285 <<
"Field relaxation factor for " <<
name
286 <<
" is " << (fieldRelaxDict_.found(
name) ?
"set" :
"unset") <<
endl;
288 return fieldRelaxDict_.found(
name) || fieldRelaxDict_.found(
"default");
295 return eqnRelaxDict_.found(
name) || eqnRelaxDict_.found(
"default");
303 if (fieldRelaxDict_.found(
name))
311 )().value(time().timeOutputValue());
313 else if (fieldRelaxDefault_)
315 return fieldRelaxDefault_().value(time().timeOutputValue());
319 <<
"Cannot find variable relaxation factor for '" <<
name
320 <<
"' or a suitable default value." <<
nl
331 if (eqnRelaxDict_.found(
name))
339 )().value(time().timeOutputValue());
341 else if (eqnRelaxDefault_)
343 return eqnRelaxDefault_().value(time().timeOutputValue());
347 <<
"Cannot find equation relaxation factor for '" <<
name
348 <<
"' or a suitable default value."
359 return subDict(get<word>(
"select"));
369 return solvers_.subDict(
name);
376 return solvers_.subDict(
name);
fvSolution solutionDict(runTime)
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType=word::null, const objectRegistry *obrPtr=nullptr)
An optional selector.
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,...
readOption readOpt() const noexcept
The read option.
readOption
Enumeration defining the read options.
bool eof() const noexcept
True if end of input seen.
An input stream of tokens.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
dictionary()
Default construct, a top-level empty dictionary.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find for an entry (non-const access) with the given keyword.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
void clear()
Clear the dictionary.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
virtual bool isDict() const noexcept
Return true if this entry is a dictionary.
A class for handling file names.
const dictionary & solverDict() const
Return the solver dictionary taking into account finalIteration.
@ REGEX
Regular expression.
Abstract base-class for lduMatrix solvers.
Registry of regIOobjects.
bool headerOk()
Read and check header info. Does not check the headerClassName.
virtual void addWatch()
Add file watch on object (if registered and READ_IF_MODIFIED)
virtual bool read()
Read object.
Selector class for relaxation factors, solver type and solution.
bool cache(const word &name) const
Return true if the given field should be cached.
virtual ~solution()
Destructor.
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.
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 equation.
bool relaxEquation(const word &name) const
Return true if the relaxation factor is given for the equation.
const dictionary & solutionDict() const
bool read()
Read the solution dictionary.
splitCell * master() const
A class for handling words, derived from Foam::string.
#define defineDebugSwitchWithName(Type, Name, Value)
Define the debug information, lookup as Name.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const word dictName("faMeshDefinition")
#define DebugInfo
Report an information message using Foam::Info.
bool read(const char *buf, int32_t &val)
Same as readInt32.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
static const Foam::List< Foam::word > subDictNames({ "preconditioner", "smoother" })