← Back to team overview

yade-users team mailing list archive

Re: Time Series Forcing implementation in python


> There will be about 50 dynamic particles in the simulation, and at each
> time step, each particle should have a different force from the times
> series applied to it.  There is only one component of the force.  I have
> been working only with python so far, and I would prefer to use it
> instead of C++.  What is the maximum number of data points that could be
> used with python?
> It would be helpful if you could tell me the syntax for using the
> InterpolatingSpiralEngine in python.

You can try in python first and then see if it is fast enough. One of
your engines will be 


(note that this engine must be before NewtonsDampedLaw) and you do all
the rest in applyForces that you define somewhere before you call

def applyForces():
	for b in O.bodies:
		f=... # your stuff

To see the performance impact, go
http://yade.wikia.com/wiki/Speed_profiling_using_TimingInfo_and_TimingDeltas_classes ; basically you say O.timingEnabled=True before running the simulation and

 import yade.timing

when finished.


For InterpolatingSpiralEngine, the syntax is like this:

velocities=[10.1,10.2,10.7,9.1,8.2,7.5,6.1] # velocities
times=[0.1,.3,.4,.6,.8,1.0,1.2] # t at which the velocities were measures

In your case, you would have to pass to your hypothetical engine a list
of readings for each body, probably as list of lists (but that is not
supported at this moment from python to yade, unless you play dirty
tricks that I can show you), and the time points. Reading the data from
file to memory at the point of engine construction would be another