[MBDyn-users] How to get the actual simulation time step width

Pierangelo Masarati masarati at aero.polimi.it
Wed May 21 17:25:54 CEST 2008


Rix, Patrick wrote:
> Dear MBDyn-team, dear MBDyn-users,
> 
> I'd like to know if there is a possibility to get the value of the
> actual simulation time step width at run time. I thought of a special
> variable like "Time" or something similar like a DOF or element drive
> to access the simulation time step.

If you're writing your own piece of code, e.g. an element, right now the 
best way is to:
- keep a variable "old_time"
- keep a "TimeDriveCaller tdc" object
- compute "curr_time = tdc.dGet() - old_time" when needed
- update "old_time" from inside AfterConvergence().

> The background is that we try to construct an OutputMeter which
> outputs the results every X seconds (not X steps) when using an
> adaptive time step strategy. (This will give not exactly an output
> rate of X seconds, due to the varying adaptive simulation time step,
> but it tries to be as close as possible to the specified output rate,
> writing a time step when the actual simulation time has past the last
> output time mark).

Probably, you'll have to make sure you only output once for each closest 
neighbor of the time you want to use :)

> If someone knows a method how to control MBDyn's output rate in terms
> of seconds instead of steps this would be very appreciated.

Perhaps the output meter functionality could be modified accordingly.

>> From the work of the last days I'd like to make some suggestions
>> for improvement:
> 
> 1.) Would it be possible to add to the "Time" variable another one
> for the time step width and for the time step index, e.g. "TimeStep"
> and "Step" ?

Yes.  I can add them both as variables available to the "string" drive, 
and as specific drives (like the TimeDriveCaller).

> 2.) How about adding an element for buffering previous value(s) of
> nodes/elements, maybe at least the last one.

There is something like that: it's the parameter node "sample and hold". 
  Not sure how it could be useful to you, though, since it is intended 
to keep the previous time step value of a node handy.

I'll add (some of) the requested features and make a snapshot available 
shortly, unless I can push out a release very soon.

Cheers, p.





More information about the Mbdyn-users mailing list