← Back to team overview

yade-users team mailing list archive

Re: Engines Python

 

Hi! Thanks for your answer. I have tried to include the ForceEngine as
ForceEngine(force=(100000000,0,0))
in the list of the engines (so at the moment it is just a simple case, not
using PyRunner) but I do not see any force applied to my bodies... If I use
ForceEngine should I also specify the id of the body/ies I want to apply the
force on?
I am still learning..;)

Cheers, Chiara

2010/3/19 Benoit Charlas <benoit.charlas@xxxxxxxxxxx>

>  Hi Chiara
>
> I don't really understand your question. What I don't understand the most
> is do you want to apply this force once (for tot iteration) or every x
> TimeStep.
> But i'll try to answer with my very little knowledge!
>
> The function PeriodicPythonRunner allows you to apply an action (for
> example a Python function) periodically every : virtPeriod, realPeriod or
> iterPeriod
> For example let's write that you want to apply your force every 1000
> iteration steps
> forceengine=ForceEngine(*...*)
> PeriodicPythonRunner(iterPeriod=1000,command='forceengine()')
>
> But then you'll apply the same force every 1000 steps.
>
> You can also apply an evolution to your force or anything you want while
> defining another function
>
> Let's call your function "applyAForce()" and let's suppose you want to
> increment 10 times your force
>
> O.engines=[
>     ...
>     PeriodicPythonRunner(iterPeriod=1000,command='applyAForce()')
> ]
> ...
> def applyAForce():
>     *your function with (nearly) everything you want like ForceEngine(...)
> *
>
> You should check in the directory yade/examples. There are some useful tips
> in those examples !
>
> Cheers,
> Benoit
>
>
> Václav Šmilauer a écrit :
>
>  is it possible to call an engine inside another engine in python? For
> instance, can I use PeriodicPythonRunner to define a function that
>
>
>  having
>
>
>  satisfied a certain condition (say after tot iterations) call an engine
> (say
> apply a force)?
>
>
>  Hi Chiara, engines are callable objects (define the __call__ method), so
> you can call them with ():
>
> forceEngine=ForceEngine(...)
> forceEngine()
> # ForceEngine(...)() would also work
>
> You can make the forceEngine a variable so that the engine is not
> constructed every time.
>
> Cheers, 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
>
>
>
> _______________________________________________
> 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