functionObject: Added executeAtStart
By default most functionObjects now execute and write at the start-time except those that perform averaging (fieldAverage, dsmcFields) which cannot be executed until the end of the first time-step. There is also a new optional functionObject dictionary entry "executeAtStart" which defaults to true but can be set false if the execution and results of the functionObject are not required or appropriate at the start-time. A result of this change is that time logs of forces, sampling etc. now include a values for time 0.
This commit is contained in:
@ -93,9 +93,23 @@ Foam::functionObjects::timeControl::timeControl
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::timeControl::executeAtStart() const
|
||||
{
|
||||
return foPtr_->executeAtStart();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::timeControl::execute()
|
||||
{
|
||||
if (active() && (postProcess || executeControl_.execute()))
|
||||
if
|
||||
(
|
||||
active()
|
||||
&& (
|
||||
postProcess
|
||||
|| executeControl_.execute()
|
||||
|| (executeAtStart() && time_.timeIndex() == time_.startTimeIndex())
|
||||
)
|
||||
)
|
||||
{
|
||||
foPtr_->execute();
|
||||
}
|
||||
@ -106,7 +120,15 @@ bool Foam::functionObjects::timeControl::execute()
|
||||
|
||||
bool Foam::functionObjects::timeControl::write()
|
||||
{
|
||||
if (active() && (postProcess || writeControl_.execute()))
|
||||
if
|
||||
(
|
||||
active()
|
||||
&& (
|
||||
postProcess
|
||||
|| writeControl_.execute()
|
||||
|| (executeAtStart() && time_.timeIndex() == time_.startTimeIndex())
|
||||
)
|
||||
)
|
||||
{
|
||||
foPtr_->write();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user