3.1.20. c3po.TimeAccumulator module
Contain the class TimeAccumulator.
- class c3po.TimeAccumulator.SaveAtInitTimeStep
Bases:
objectEnum defining
TimeAccumulatorsaving mode.- Values:
never:TimeAccumulatornever calls thesave()/restore()methods.abortTimeStep()is not available if not in StationaryMode.
always:TimeAccumulatorsaves at everyinitTimeStep()call and restores at everyabortTimeStep, even in StationaryMode.
transient:TimeAccumulatorsaves at everyinitTimeStep()call and restores at everyabortTimeStep(), if not in StationaryMode.
transientExceptAfterAbort:- If not in StationaryMode:
TimeAccumulatorsaves at everyinitTimeStep()call that does not follow anabortTimeStep()(the first attempt to compute a time-step).It restores at every
abortTimeStep(), if not in StationaryMode.
- always = 1
- never = 0
- transient = 2
- transientExceptAfterAbort = 3
- class c3po.TimeAccumulator.TimeAccumulator(physics, saveParameters=None, stabilizedTransient=(False, 100.0))
Bases:
PhysicsDriverWrapperTimeAccumulatorwraps aPhysicsDriverinto a macro time step procedure (for transients or stationaries (through stabilized transients)).In transient calculations, the
TimeAccumulatorobject is driven like anyPhysicsDriver, but it will use macro time steps (chosen withinitTimeStep()) whereas the wrapedPhysicsDrivermay use smaller internal time steps (given by its owncomputeTimeStep()method).In stationary calculations, if the stabilizedTransient mode is activated, when a steady-state is asked to the
TimeAccumulatorobject (initTimeStep(0)in stationaryMode), a time loop over the wrapedPhysicsDriverobject is run until steady-state is reached (isStationary()return True). If the stabilizedTransient mode is not activated, steady-state calculations (initTimeStep(0)in stationaryMode) are directly asked to the wrapedPhysicsDriver.- __init__(physics, saveParameters=None, stabilizedTransient=(False, 100.0))
Build a
TimeAccumulatorobject.- Parameters:
physics (PhysicsDriver) – The
PhysicsDriverto wrap.saveParameters (tuple) – The tuple
(label, method)that can be used to save / restore results in order to provideabortTimeStep()capabilities in transient. The methodsetSavingMode()allows to choose when saving is done.stabilizedTransient (tuple) – A tuple
(activated, tMax). Ifactivatedis set to True, it computes steady states (dt = 0) as stabilized transients (untilphysics.isStationary()returns True or the current time reachestInit + tMax) and then usesresetTime(tInit)in order to keep time consistency (tInitis the returned value ofphysics.presentTime()before solving). Ifactivatedis set to False (default value), steady-states (dt = 0) are directly asked tophysics. The methodsetStabilizedTransient()allows to modify these data.
- abortTimeStep()
- computeTimeStep()
See
PhysicsDriver.computeTimeStep().Return the asked macro time step if set (by
setValue("macrodt", dt)), the preferred time step of thePhysicsDriverotherwise.
- getInputValuesNames()
- getValueType(name)
- getValueUnit(name)
- initTimeStep(dt)
- initialize()
- presentTime()
- setComputedTimeStep(dt)
Set time-step size returned by
computeTimeStep().- Parameters:
dt (float) – Time-step size returned by
computeTimeStep(). None can be set to use the time step recommended by the holdPhysicsDriver. Default: None.
- setInputDoubleValue(name, value)
See
c3po.DataAccessor.DataAccessor.setInputDoubleValue().The value associated with the name “macrodt” can be used to set the time-step size returned by
computeTimeStep().
- setSavingMode(savingMode)
Set a saving mode.
- Parameters:
savingMode – See
SaveAtInitTimeStepdocumentation for available options. Default value isSaveAtInitTimeStep.transient.
- setStabilizedTransient(stabilizedTransient)
Set stabilized transient data.
- Parameters:
stabilizedTransient – See parameter
stabilizedTransientof the__init__()method.
- solveTimeStep()
Make the
PhysicsDriverto reach the end of the macro time step asked toTimeAccumulatorusing its own time advance procedure.
- terminate()
- validateTimeStep()