83 startExpr_(rhs.startExpr_),
84 settingResult_(rhs.settingResult_),
85 storedValues_(rhs.storedValues_),
86 storeInterval_(rhs.storeInterval_),
99 storeInterval_(
dict.get<scalar>(
"storeInterval")),
100 delay_(
dict.get<scalar>(
"delay"))
115 const scalar& timeVal
118 if (storedValues_.empty())
125 if (first.
first() > (timeVal-delay_))
131 if (storedValues_.size() <= 1)
134 <<
"Only one stored value at time " << timeVal
135 <<
" for delayedVariable " <<
name() <<
nl
136 <<
"Check the values for the interval " << storeInterval_
137 <<
" and delay " << delay_ <<
nl
138 <<
"Probably the interval is too large" <<
nl <<
endl
142 auto current = storedValues_.cbegin();
147 const scalar newTime = (timeVal - delay_);
149 while (next != storedValues_.end())
151 if (newTime >= current().first() && newTime <= next().first())
162 (newTime - current().first())
163 / (next().first() - current().first())
166 exprResult val((1-
f)*current().second() +
f*next().second());
185 const scalar& currTime
188 bool append = storedValues_.empty();
192 const scalar lastTime = storedValues_.last().first();
194 if (lastTime + SMALL >= currTime)
198 else if ((currTime - lastTime) >= 0.999*storeInterval_)
213 const scalar oldLastTime =
215 storedValues_.empty()
217 : storedValues_.last().first()
220 storedValues_.append(
ValueAtTime(currTime, settingResult_));
224 storedValues_.size() > 1
225 && (oldLastTime - storedValues_.first().first()) >= delay_
229 storedValues_.removeHead();
236 storedValues_.last().second() = settingResult_;
245 os.writeEntry(
"name", name_);
247 os.writeEntry(
"startupValue", startExpr_);
249 if (!settingResult_.valueType().empty())
251 os.writeEntry(
"settingResult", settingResult_);
254 os.writeEntry(
"storedValues", storedValues_);
255 os.writeEntry(
"storeInterval", storeInterval_);
256 os.writeEntry(
"delay", delay_);
258 os.writeKeyword(
"value");
259 os << static_cast<const exprResult&>(*
this);
280 startExpr_ = rhs.startExpr_;
281 settingResult_ = rhs.settingResult_;
282 storedValues_ = rhs.storedValues_;
283 storeInterval_ = rhs.storeInterval_;
293 settingResult_ = rhs;
302 settingResult_ = std::move(rhs);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Template class for non-intrusive linked lists.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const T1 & first() const noexcept
Return first.
Database for solution data, solver performance and other reduced data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find for an entry (non-const access) with the given keyword.
A keyword and a list of tokens is an 'entry'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
An exprResult with an additional delay before evaluation.
void storeValue(const scalar &timeVal)
Add a stored value.
bool updateReadValue(const scalar &timeVal)
Update the read-value.
exprResultDelayed()
Default construct.
void setReadValue(const exprResult &val)
Set the readValue with a calculated value.
A polymorphic field/result from evaluating an expression.
virtual void operator=(const exprResult &rhs)
Copy assignment.
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
Foam::dictionary writeDict() const
Write to dictionary.
A class for handling character strings derived from std::string.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
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)