IFEM  90A354
Public Member Functions | Public Attributes | Private Types | Private Attributes | List of all members
TimeStep Class Reference

Class for encapsulation of general time stepping parameters. More...

#include <TimeStep.h>

Collaboration diagram for TimeStep:
Collaboration graph
[legend]

Public Member Functions

 TimeStep ()
 The constructor initializes the counters to zero.
 
 TimeStep (const TimeStep &ts)
 Copy constructor.
 
TimeStepoperator= (const TimeStep &ts)
 Assigment operator.
 
bool parse (char *keyWord, std::istream &is)
 Parses a data section from an input stream. More...
 
bool parse (const tinyxml2::XMLElement *elem)
 Parses a data section from an XML document. More...
 
bool multiSteps () const
 Returns true if the simulation consists of several time steps.
 
bool hasReached (double t) const
 Returns true if the given time t has been reached.
 
bool reset (int istep=0)
 Resets the time step to the specified step. More...
 
bool increment ()
 Advances the time increments one step further. More...
 
bool cutback ()
 Restarts current increment with a smaller step size on divergence. More...
 
bool finished () const
 Returns true if the end of the simulation has been reached.
 
bool serialize (std::map< std::string, std::string > &data) const
 Serialize internal state for restarting purposes. More...
 
bool deSerialize (const std::map< std::string, std::string > &data)
 Set internal state from a serialized state. More...
 

Public Attributes

int step
 Time step counter.
 
int & iter
 Iteration counter.
 
TimeDomain time
 Time domain data.
 
double starTime
 Start time of simulation.
 
double stopTime
 Stop time of simulation.
 
double maxCFL
 CFL restriction on time step size (0.0: no restriction)
 

Private Types

typedef std::pair< std::vector< double >, double > Step
 Time step definition.
 
typedef std::vector< StepTimeSteps
 Time step container.
 

Private Attributes

int niter
 Number of iterations in previous time step.
 
int nInitStep
 Number of fixed timesteps in the beginning.
 
int maxStep
 Maximum number of time steps.
 
double dtMin
 Minimum time increment size.
 
double dtMax
 Maximun time increment size.
 
double f1
 Scale factor for increased time step size.
 
double f2
 Scale factor for reduced time step size.
 
TimeSteps mySteps
 Time step definitions.
 
TimeSteps::iterator stepIt
 Running iterator over the time steps.
 
size_t lstep
 Local step counter, i.e., within current *stepIt.
 

Detailed Description

Class for encapsulation of general time stepping parameters.

Member Function Documentation

◆ cutback()

bool TimeStep::cutback ( )

Restarts current increment with a smaller step size on divergence.

Returns
false Cannot do further cut-back, time step size too small

References IFEM::cout, TimeDomain::dt, dtMin, f2, TimeDomain::first, iter, mySteps, niter, stepIt, TimeDomain::t, and time.

Referenced by TimeIntegration::SIMExplicitRKE< Solver >::solveStep().

◆ deSerialize()

bool TimeStep::deSerialize ( const std::map< std::string, std::string > &  data)

Set internal state from a serialized state.

Parameters
[in]dataContainer for serialized data

References reset(), and step.

Referenced by SIMSolver< T1 >::deSerialize().

◆ increment()

bool TimeStep::increment ( )

Advances the time increments one step further.

Returns
false, if we have reached the end of the simulation

References TimeDomain::CFL, IFEM::cout, TimeDomain::dt, dtMax, dtMin, TimeDomain::dtn, f1, f2, hasReached(), iter, lstep, maxCFL, maxStep, mySteps, nInitStep, niter, step, stepIt, stopTime, TimeDomain::t, and time.

Referenced by SIMSolver< T1 >::advanceStep(), MultiStepSIM::advanceStep(), and reset().

◆ parse() [1/2]

bool TimeStep::parse ( char *  keyWord,
std::istream &  is 
)

Parses a data section from an input stream.

Parameters
[in]keyWordKeyword of current data section to read
isThe file stream to read from

References maxCFL, mySteps, utl::readLine(), reset(), starTime, TimeDomain::t, and time.

Referenced by SIMSolver< T1 >::parse().

◆ parse() [2/2]

bool TimeStep::parse ( const tinyxml2::XMLElement *  elem)

Parses a data section from an XML document.

Parameters
[in]elemThe XML element to parse

References IFEM::cout, TimeDomain::dt, dtMax, dtMin, f1, f2, utl::getAttribute(), maxCFL, maxStep, mySteps, nInitStep, reset(), starTime, stopTime, TimeDomain::t, and time.

◆ reset()

bool TimeStep::reset ( int  istep = 0)

Resets the time step to the specified step.

Returns
false, if the istep is passed the end of the simulation

References TimeDomain::CFL, TimeDomain::dt, TimeDomain::dtn, increment(), lstep, mySteps, step, stepIt, stopTime, TimeDomain::t, and time.

Referenced by deSerialize(), parse(), and SIMSolverTS< T1 >::solveProblem().

◆ serialize()

bool TimeStep::serialize ( std::map< std::string, std::string > &  data) const

Serialize internal state for restarting purposes.

Parameters
dataContainer for serialized data

Referenced by SIMSolver< T1 >::serialize().


The documentation for this class was generated from the following files: