yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #01469
Re: Time Series Forcing implementation in python
Ok, now I can read the force data from file, and I believe it is applying
the forces to the particles (it now does not give me an error when I run the
simulation but the particles do not move). Based on my understanding of the
program, they do not move because I now need an interpolating engine to
interpolate between each point to make integration possible.
I looked at the LinearInterpolate.hpp file in
trunk/pkg/common/Engine/DeusExMachina
but I did not see a LinearInterpolate.cpp file. I think this engine would
serve my purposes, but I can't get python to recognize it. (I tried calling
DeusExMachina('LinearInterpolate',....). Can python currently run the
engine?
If it cannot, do I need to write a new interpolating engine? I imagine this
would be written in C++, so could you give me some guidance on how to
accomplish this if it is necessary?
Thank you,
Roger
2009/3/30 Václav Šmilauer <eudoxos@xxxxxxxx>
>
> >
> > 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
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> Post to : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References