yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #01466
Re: Time Series Forcing implementation in python
>
> forces,times=[],[]
> for line in
> file('your.text.file.with.2.numbers.per.line.separated.by.whitespace')
> if len(line.split())<2: continue # skip empty lines
> f,t=[float(s) for s in line.split()]
> forces.append(f)
> times.append(t)
>
> def applyForce():
> # find index of the time we are at or just after now in the
> series
> # this is quite suboptimal, since it traverses the array
> every time
> i=0;
> while times[i]<O.time: i+=1
> # and use force at that index
> f=force[i]
>
> Using the method above, yade will read my force data from file, but it
> will not apply it to the particles. (I know that it is reading the
> force data properly because I have it print the force data from the
> file). I do not get an error when I run the simulation, but the
> particles do not move. I have tried larger magnitudes of forces to be
> sure that the particles would move if exposed to the applied force.
> Also, I am now running revision 1732.
well, you have to apply the force after f=force[i] in applyForce(), like
we had that before! Something like
for id in bodiesIWantToApplyForceTo:
O.actions.addF(id,f)
> Second, when I use InterpolatingSpiralEngine, I get the following
> error: "RuntimeError: Number sequence argument required." The
> arguements for this engine include an angular velocity time series,
> but I have no knowledge of this data. Therefore I do not understand
> why I need this engine. Perhaps I should use a different
> interpolating engine?
I meant it as an example of interpolating engine. Of course it serves
you for nothing as you don't need spiral motion. As said, once you're
clear about what you need, no problem to write an engine LIKE that for
your case.
Vaclav
Follow ups
References