Commit c1d6f266 authored by mattijs's avatar mattijs
Browse files

prevent outputIndex calculation upon subcycling

parent c3d4f899
......@@ -662,83 +662,89 @@ Foam::Time& Foam::Time::operator++()
deltaTSave_ = deltaT_;
setTime(value() + deltaT_, timeIndex_ + 1);
// If the time is very close to zero reset to zero
if (mag(value()) < 10*SMALL*deltaT_)
{
setTime(0.0, timeIndex_);
}
switch (writeControl_)
if (!subCycling_)
{
case wcTimeStep:
outputTime_ = !(timeIndex_ % label(writeInterval_));
break;
// If the time is very close to zero reset to zero
if (mag(value()) < 10*SMALL*deltaT_)
{
setTime(0.0, timeIndex_);
}
case wcRunTime:
case wcAdjustableRunTime:
switch (writeControl_)
{
label outputIndex =
label(((value() - startTime_) + 0.5*deltaT_)/writeInterval_);
case wcTimeStep:
outputTime_ = !(timeIndex_ % label(writeInterval_));
break;
if (outputIndex > outputTimeIndex_)
case wcRunTime:
case wcAdjustableRunTime:
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
label outputIndex = label
(
((value() - startTime_) + 0.5*deltaT_)
/ writeInterval_
);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
}
break;
break;
case wcCpuTime:
{
label outputIndex = label(elapsedCpuTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
case wcCpuTime:
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
label outputIndex = label(elapsedCpuTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
else
break;
case wcClockTime:
{
outputTime_ = false;
label outputIndex = label(elapsedClockTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
{
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
{
outputTime_ = false;
}
}
break;
}
break;
case wcClockTime:
// see if endTime needs adjustment to stop at the next run()/end() check
if (!end())
{
label outputIndex = label(elapsedClockTime()/writeInterval_);
if (outputIndex > outputTimeIndex_)
if (stopAt_ == saNoWriteNow)
{
endTime_ = value();
}
else if (stopAt_ == saWriteNow)
{
endTime_ = value();
outputTime_ = true;
outputTimeIndex_ = outputIndex;
}
else
else if (stopAt_ == saNextWrite && outputTime_ == true)
{
outputTime_ = false;
endTime_ = value();
}
}
break;
}
// see if endTime needs adjustment to stop at the next run()/end() check
if (!end())
{
if (stopAt_ == saNoWriteNow)
{
endTime_ = value();
}
else if (stopAt_ == saWriteNow)
{
endTime_ = value();
outputTime_ = true;
}
else if (stopAt_ == saNextWrite && outputTime_ == true)
{
endTime_ = value();
}
}
return *this;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment