TimeManager

About the TimeManager class

The WaveBlocks Project

@author: R. Bourquin @copyright: Copyright (C) 2010, 2011, 2012 R. Bourquin @license: Modified BSD License

Inheritance diagram

Inheritance diagram of TimeManager

Class documentation

class WaveBlocks.TimeManager(parameters)

This class performs several computation with time, timesteps and so for.

The important quantities here are: T : the fixed simulation end time dt : the size of the timestep N : the overall number of timesteps. t : an unspecified time in the interval [0, T] n : an unspecified timestep in the interval [0, N] The importtant relations that hold are: T = N * dt and in analogy t = n * dt

There are also conversion routines for t and n. Additionally the class contains some routines for determining if and when to save data. But we do not touch any data in here.

add_to_savelist(alist)

Add a list of times and/or timesteps to the list of times which determine when to save data.

Parameters:alist – A list with integers (interpreted as timesteps) and/or floats (interpreted as times)

Note

The times and timesteps can be mixed and needn’t to be given in monotone order.

compute_number_saves()

Compute the number of saves we will perform during the simulation. This can be used to determine how much space to allocate in the output files.

compute_number_timesteps()

Computes the number of time steps we will perform.

compute_time(n)

Compute the time t from a timestep n such that t = n * dt holds.

Parameters:n – The timestep n of which we want to find the corresponding time.
compute_timestep(t)

Compute the timestep n from a time t such that t = n * dt holds.

Parameters:t – The time t of which we want to find the timestep number.

Note

The user has to ensure that time is an integral multiple of dt.

must_save(n)

Determine if we have to save right now.

Parameters:n – The current timestep in question.
set_T(T)

Set the simulation endtime T.

Parameters:T – The simulation end time.
set_dt(dt)

Set the simulation timestep size dt.

Parameters:dt – The simulation timestep size.
set_interval(interval)

Set the inteval for saving results.

Parameters:interval – The interval at which we save simulation results.

Note

A value of 0 means we never save data at any regular interval.

set_nsteps(nsteps)

Set the number of timesteps the simulation runs.

Parameters:nsteps – The number timesteps we do.

Table Of Contents

Previous topic

SimulationLoopHagedornInhomogeneous

Next topic

IOManager

This Page