mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: runTimeControl valueAverage condition - added start-up iterations option
This commit is contained in:
@ -75,7 +75,9 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
||||
: windowType::NONE
|
||||
),
|
||||
totalTime_(fieldNames_.size(), scalar(0)),
|
||||
resetOnRestart_(dict.lookupOrDefault<bool>("resetOnRestart", false))
|
||||
resetOnRestart_(dict.lookupOrDefault<bool>("resetOnRestart", false)),
|
||||
nIterStartUp_(dict.lookupOrDefault<label>("nIterStartUp", 10)),
|
||||
iter_(-1)
|
||||
{
|
||||
dictionary& conditionDict = this->conditionDict();
|
||||
|
||||
@ -100,6 +102,8 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conditionDict.readIfPresent("iter", iter_);
|
||||
}
|
||||
|
||||
|
||||
@ -107,13 +111,15 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
||||
|
||||
bool Foam::functionObjects::runTimeControls::averageCondition::apply()
|
||||
{
|
||||
bool satisfied = true;
|
||||
|
||||
if (!active_)
|
||||
{
|
||||
return satisfied;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool satisfied = iter_ > nIterStartUp_ ? true : false;
|
||||
|
||||
++iter_;
|
||||
|
||||
const scalar dt = obr_.time().deltaTValue();
|
||||
|
||||
Log << " " << type() << ": " << name_ << " averages:" << nl;
|
||||
@ -175,6 +181,8 @@ void Foam::functionObjects::runTimeControls::averageCondition::write()
|
||||
conditionDict.add(fieldName, valueDict);
|
||||
}
|
||||
}
|
||||
|
||||
conditionDict.set("iter", iter_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -97,6 +97,11 @@ protected:
|
||||
//- Reset the averaging process on restart flag
|
||||
Switch resetOnRestart_;
|
||||
|
||||
//- Number of start-up iterations before allowing satisfied checks
|
||||
label nIterStartUp_;
|
||||
|
||||
//- Current iteration count
|
||||
label iter_;
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user