A class for managing arbitrary loops with the ability to invoke function object execution. More...
Public Member Functions | |
loopControl (Time &runTime, const label nCycles, const word &dictName="loop") | |
Construct from time with fixed number of cycles. More... | |
loopControl (Time &runTime, const word &algorithmName, const word &dictName="loop") | |
loopControl (Time &runTime, const dictionary &algorithmDict, const word &dictName="loop") | |
~loopControl () | |
Destructor. More... | |
const word & | name () const |
Name of the loop control. More... | |
label | interval () const |
The interval to execute onLoop function-objects. More... | |
bool | loop () |
Public Member Functions inherited from subLoopTime | |
subLoopTime (Time &runTime, const label nCycles) | |
Construct from time with fixed number of cycles. More... | |
~subLoopTime () | |
Destructor. More... | |
label | index () const |
The current cycle index. More... | |
label | nCycles () const |
The total number of cycles. More... | |
bool | status () const |
Return true if looping is active. More... | |
void | stop () |
Force terminate the loop. More... | |
bool | loop () |
True if looping is active, increments the index. More... | |
subLoopTime & | operator++ () |
Prefix increment. More... | |
Protected Attributes | |
word | name_ |
Name of the loop control (the lookup dictionary name). More... | |
label | interval_ |
The interval to execute onLoop function-objects. More... | |
dictionary | convergenceDict_ |
Dictionary for checking convergence (all regions) More... | |
wordRes | onLoop_ |
Function object names to fire during the loop (at executeInterval) More... | |
wordRes | onConverged_ |
Function object names to fire on convergence. More... | |
wordRes | onEnd_ |
bool | converged_ |
Convergence tests passed. More... | |
Protected Attributes inherited from subLoopTime | |
Time & | time_ |
label | index_ |
The current sub-cycle index. More... | |
label | total_ |
The total number of cycles in the sub-cycle. More... | |
A class for managing arbitrary loops with the ability to invoke function object execution.
SIMPLE { energyCoupling { iterations 100; onLoop (); onConverged ( externalCoupled "loopThings.*" ); convergence { "h" 1e-3; } } }
Where the loop entries comprise:
Property | Description | Required | Default |
---|---|---|---|
enabled | activate/deactivate loop | no | true |
iteration | times to loop | no | 0 |
timeStart | begin time for loop activation | no | -VGREAT |
timeEnd | end time of loop activation | no | VGREAT |
interval | sub-interval to execute onLoop | no | 0 |
onLoop | function object names to call at executeInterval | no | |
onConverged | function object names to call when converged | no | |
onEnd | function object names to call when loop ends | no | |
convergence | dictionary of convergence values to check | no |
The function object names listed by onLoop
, onConverged
, onEnd
must implement an execute(int)
method. If the time controls timeStart
or timeEnd
are used for the loop, these values are only inspected upon creation, not during execution.
Definition at line 140 of file loopControl.H.
loopControl | ( | Time & | runTime, |
const label | nCycles, | ||
const word & | dictName = "loop" |
||
) |
Construct from time with fixed number of cycles.
runTime | the top-level time |
nCycles | the number of times to loop |
loopName | the name of the loop |
Definition at line 144 of file loopControl.C.
loopControl | ( | Time & | runTime, |
const word & | algorithmName, | ||
const word & | dictName = "loop" |
||
) |
Construct from fvSolution dictionary based on time and the name of the controlling algorithm
runTime | the top-level time |
algorithmName | the name of the fvSolution dictionary, typically PIMPLE or SIMPLE |
dictName | the name of the control dictionary |
Definition at line 182 of file loopControl.C.
References dictName(), dictionary::findDict(), solution::solutionDict(), and subLoopTime::time_.
loopControl | ( | Time & | runTime, |
const dictionary & | algorithmDict, | ||
const word & | dictName = "loop" |
||
) |
Construct from fvSolution dictionary based on time and the name of the controlling algorithm
runTime | the top-level time |
algorithmDict | the fvSolution algorithm dictionary, typically PIMPLE or SIMPLE |
dictName | the name of the control dictionary |
Definition at line 162 of file loopControl.C.
References dictName(), and dictionary::findDict().
~loopControl | ( | ) |
Destructor.
Definition at line 212 of file loopControl.C.
|
inline |
Name of the loop control.
Definition at line 237 of file loopControl.H.
References loopControl::name_.
Referenced by Foam::operator<<().
|
inline |
The interval to execute onLoop function-objects.
Definition at line 243 of file loopControl.H.
References loopControl::interval_.
bool loop | ( | ) |
True if looping is active, increments the index and executes the onLoop and onConverged functions.
Example usage,
Definition at line 220 of file loopControl.C.
|
protected |
Name of the loop control (the lookup dictionary name).
Definition at line 167 of file loopControl.H.
Referenced by loopControl::name().
|
protected |
The interval to execute onLoop function-objects.
Definition at line 170 of file loopControl.H.
Referenced by loopControl::interval().
|
protected |
Dictionary for checking convergence (all regions)
Definition at line 173 of file loopControl.H.
|
protected |
Function object names to fire during the loop (at executeInterval)
Definition at line 176 of file loopControl.H.
|
protected |
Function object names to fire on convergence.
Definition at line 179 of file loopControl.H.
|
protected |
Function object names to fire when the loop exits without convergence
Definition at line 183 of file loopControl.H.
|
protected |
Convergence tests passed.
Definition at line 186 of file loopControl.H.