TimeGrid¶
Class describing and containing the descritization in time.
-
class
TimeGrid
¶
Properties¶
Time advance¶
-
dt
¶
timestep size (normalized). Distance between different time steps in uniform grid. In case of nonuniform, determines the order of magnitude of timedifference
-
tMax
¶
maximum time (minimum is so far always 0) (normalized). Maximum time to simulate to. This will always be exact (to machine precision)
-
timeStepMode
¶
specifies how the time step vector is generated
- Constant time step (dt), in units of timeUnit
2. Logarithmic – use progressively longer time steps. Usefull for convergence towards a steady state. dt is used for the first time step.
3. Stepwise logarithmic – like 2, except that several time steps are taken with each step length. This is to avoid rebuilding the matrix in every time step.
-
logGridScaling
¶
step size scaling for the logarithmic grid
-
logGridSubSteps
¶
how many steps to take for each time step length with timeStepMode 3
-
logGridMaxStep
¶
maximum time step allowed in timeStepModes 2 and 3
-
timesteps
¶
actual times the distribution is calculated in (normalized)
-
dts
¶
vector of all small timechanges in (normalized)
-
dtsHasChanged
¶
vector contantaining if the a element in dts vector has changed or not
-
nTimeSteps
¶
number of times where the distribution is defined (actually one greater than the number of timesteps that should be taken)
Misc¶
-
PhysicalParams
¶
PhysicalParams
object.
Design note: intention is that physicalParameters containing an instance of this class also is contained in this object, think of it as pairs. Right now it is possible to ‘hack’ the construction by creating a TimeGrid object, and a PhysicalParams. Then setting the TimeGrid in the PhysicalParams. Afterwards it is possible to create a new PhysicalParams and set the already created TimeGrid in the new PhysicalParams. The firstly created PhysicalParams now has a TimeGrid object in it with a PhysicalParams object in it which is not pointing to itself. The ‘pair’ structure is then broken. Two fixes are availible: one seperating the TimeGrid to a copy of itself (new pointer) and using the copy for the old TimeGrid or save both TimeGrid objects in the same reference object. properties (SetAccess = protected) physicalParams
-
reference
¶
Reference
object shared amongst all state objects, containing reference values.
Functions¶
Constructor¶
-
TimeGrid
(reference, varargin)
Set functions¶
-
setPhysicalParams
(this, phP)¶
Sets phP to passed value and also reinitializes the time grid
-
setResolution
(this, varargin)¶
Sets varargin to passed value and also reinitializes the time grid
-
setdt
(this, dt)¶
Sets dt to passed value and also reinitializes the time grid
-
settMax
(this, tMax)¶
Sets tMax to passed value and also reinitializes the time grid
-
settimeStepMode
(this, timeStepMode)¶
Sets timeStepMode to passed value and also reinitializes the time grid
-
setlogGridScaling
(this, logGridScaling)¶
Sets logGridScaling to passed value and also reinitializes the time grid
-
setlogGridSubSteps
(this, logGridSubSteps)¶
Sets logGridSubSteps to passed value and also reinitializes the time grid
-
setlogGridMaxStep
(this, logGridMaxStep)¶
Sets logGridMaxStep to passed value and also reinitializes the time grid
-
initializeTimeGrid
(this)¶
-
getdt
(this, timeUnit)¶
Returns dt in specified time unit
Input:
timeUnit
s - seconds
ms - milliseconds
normalized - in nueeRef from
-
gettMax
(this, timeUnit)¶
Returns tMax in specified time unit
Input:
timeUnit
s - seconds
ms - milliseconds
normalized - in nueeRef from
-
gettimeStepMode
(this)¶
Returns timeStepMode
Returns timeStepMode
-
getlogGridScaling
(this)¶
Returns logGridScaling
Returns logGridScaling
-
getlogGridSubSteps
(this)¶
Returns logGridSubSteps
Returns logGridSubSteps
-
getlogGridMaxStep
(this)¶
Returns logGridMaxStep
Returns logGridMaxStep
-
gettimesteps
(this, timeUnit)¶
Returns timesteps in specified time unit
Input:
timeUnit
s - seconds
ms - milliseconds
normalized - in nueeRef from
-
getdts
(this, pts, timeUnit)¶
Returns dts in specified timeUnit
Input:
timeUnit
s - seconds
ms - milliseconds
normalized - in nueeRef from
-
getdtsHasChanged
(this)¶
Returns dtsHasChanged
-
getnTimeSteps
(this)¶
Returns nTimeSteps