mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: OutputFilter function object updates from internal development line
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,10 +47,14 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
|
||||
template<class OutputFilter>
|
||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
|
||||
{
|
||||
// The logic here mimics that of Time itself and uses 0.5*deltaT
|
||||
// as the tolerance to account for numerical precision errors
|
||||
// (see e.g. Time::run()) since the current time might be e.g.
|
||||
// 0.3000000000001 instead of exactly 0.3.
|
||||
return
|
||||
enabled_
|
||||
&& time_.value() >= timeStart_
|
||||
&& time_.value() <= timeEnd_;
|
||||
&& time_.value() >= (timeStart_ - 0.5*time_.deltaTValue())
|
||||
&& time_.value() <= (timeEnd_ + 0.5*time_.deltaTValue());
|
||||
}
|
||||
|
||||
|
||||
@ -179,6 +183,13 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
|
||||
destroyFilter();
|
||||
}
|
||||
}
|
||||
else if (enabled_ && time_.value() > timeEnd_)
|
||||
{
|
||||
// End early if the time is controlled by the user timeEnd entry
|
||||
end();
|
||||
|
||||
enabled_ = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -196,7 +207,10 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
|
||||
|
||||
ptr_->end();
|
||||
|
||||
if (outputControl_.output())
|
||||
// Only write if
|
||||
// - time within timeStart_ and timeEnd_
|
||||
// - it is an output time
|
||||
if (active() && outputControl_.output())
|
||||
{
|
||||
ptr_->write();
|
||||
}
|
||||
@ -236,6 +250,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::adjustTimeStep()
|
||||
const label outputTimeIndex = outputControl_.outputTimeLastDump();
|
||||
const scalar writeInterval = outputControl_.writeInterval();
|
||||
|
||||
// Logic mimics that of Time::adjustDeltaT() except we only allow
|
||||
// making the time step lower.
|
||||
|
||||
scalar timeToNextWrite = max
|
||||
(
|
||||
0.0,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,6 +34,15 @@ Note
|
||||
writeInterval to be degrees crank angle, but the functionObject
|
||||
execution \a interval would still be in timestep.
|
||||
|
||||
The function object can be limited to operate within a time range using
|
||||
the timeStart and timEnd options. All objects are read (and the
|
||||
OutputFilter allocated) on construction. However, if a timeEnd is
|
||||
supplied, the object will call the 'end' function of the filter
|
||||
at the timeEnd time and destroy the filter.
|
||||
Any other callback (execute(), write(), timeSet() etc) will only operate
|
||||
if within the timeStart, timeEnd time range. Note that the time range
|
||||
uses 0.5 * deltaT as a comparison tolerance to account for precision errors.
|
||||
|
||||
SourceFiles
|
||||
OutputFilterFunctionObject.C
|
||||
|
||||
|
||||
Reference in New Issue
Block a user