confused about ForceEngine

Asked by Arthur Mercier on 2011-04-14

Hi everybody,

I'm using Ubuntu 10.10 and bzr2811.

1) I just try to model a sphere subjected to gravity forces with this:
"O.bodies.append([
 utils.sphere([.5,.5,.2],.1,color=(1,0,0)),
 ])

from yade import pack, plot

# create rectangular box from facets
O.bodies.append(utils.facetBox((.5,.5,.5),(.5,.5,1),wallMask=31))

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_L3Geom_FrictPhys_ElPerfPl()]
        ),
    GravityEngine(gravity=(0,0,-9.81)),
    NewtonIntegrator(damping=0.4),
]

O.dt=.5*utils.PWaveTimeStep()"

It's working good until the iteration 300000 (almost) when the sphere moved in the x and y directions. The sphere fell down good in only one direction,z, but after it moves. Do you understand why ? 'cause no force was specified before in the x,y directions; it's just supposed to move depending on z direction, isn't it?

2) I try the same, but I just want to apply a z-axis force on the sphere, in order to model a kind of pull-out test later. That's why I'm using ForceEngine, and I tried a lot of different things with it but I never succeeded, what's not good with mine:

"O.bodies.append([
 utils.sphere([.5,.5,.2],.1,color=(1,0,0)),
 ])

from yade import pack, plot

# create rectangular box from facets
O.bodies.append(utils.facetBox((.5,.5,.5),(.5,.5,1),wallMask=31))

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_L3Geom_FrictPhys_ElPerfPl()]
        ),
    ForceEngine(force=(0,20,20),subscribedBodies=[0]),
    GravityEngine(gravity=(0,0,-9.81)),
    NewtonIntegrator(damping=0.4),
]

O.dt=.5*utils.PWaveTimeStep()"

I only understood that ForceEngine has to be before NewtonIntegrator, and when I compile it, it's written :
"AttributeError Traceback (most recent call last)

/home/arthur/yade/build/lib/yade-new/py/yade/__init__.pyc in <module>()
      8
      9
---> 10
     11
     12

AttributeError: No such attribute: subscribedBodies.".
I just want to apply a force in a sphere but I don't know how to do.

Thanks !

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2011-04-19
Last query:
2011-04-19
Last reply:
2011-04-16
Anton Gladky (gladky-anton) said : #1

Hi

1) Could you please, attach the problem script? It will be easier to
check your problem
2) Replace "subscribedBodies" to "ids", subscribedBodies are not used
any more, I think.

Anton

On Fri, Apr 15, 2011 at 12:55 AM, Arthur Mercier
<email address hidden> wrote:
> New question #152878 on Yade:
> https://answers.launchpad.net/yade/+question/152878
>
> Hi everybody,
>
> I'm using Ubuntu 10.10 and bzr2811.
>
> 1) I just try to model a sphere subjected to gravity forces with this:
> "O.bodies.append([
>  utils.sphere([.5,.5,.2],.1,color=(1,0,0)),
>  ])
>
> from yade import pack, plot
>
> # create rectangular box from facets
> O.bodies.append(utils.facetBox((.5,.5,.5),(.5,.5,1),wallMask=31))
>
> O.engines=[
>    ForceResetter(),
>    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
>    InteractionLoop(
>        [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
>        [Ip2_FrictMat_FrictMat_FrictPhys()],
>        [Law2_L3Geom_FrictPhys_ElPerfPl()]
>        ),
>    GravityEngine(gravity=(0,0,-9.81)),
>    NewtonIntegrator(damping=0.4),
> ]
>
> O.dt=.5*utils.PWaveTimeStep()"
>
> It's working good until the iteration 300000 (almost) when the sphere moved in the x and y directions. The sphere fell down good in only one direction,z, but after it moves. Do you understand why ? 'cause no force was specified before in the x,y directions; it's just supposed to move depending on z direction, isn't it?
>
> 2) I try the same, but I just want to apply a z-axis force on the sphere, in order to model a kind of pull-out test later. That's why I'm using ForceEngine, and I tried a lot of different things with it but I never succeeded, what's not good with mine:
>
> "O.bodies.append([
>  utils.sphere([.5,.5,.2],.1,color=(1,0,0)),
>  ])
>
> from yade import pack, plot
>
> # create rectangular box from facets
> O.bodies.append(utils.facetBox((.5,.5,.5),(.5,.5,1),wallMask=31))
>
> O.engines=[
>    ForceResetter(),
>    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
>    InteractionLoop(
>        [Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom()],
>        [Ip2_FrictMat_FrictMat_FrictPhys()],
>        [Law2_L3Geom_FrictPhys_ElPerfPl()]
>        ),
>    ForceEngine(force=(0,20,20),subscribedBodies=[0]),
>    GravityEngine(gravity=(0,0,-9.81)),
>    NewtonIntegrator(damping=0.4),
> ]
>
> O.dt=.5*utils.PWaveTimeStep()"
>
> I only understood that ForceEngine has to be before NewtonIntegrator, and when I compile it, it's written :
> "AttributeError                            Traceback (most recent call last)
>
> /home/arthur/yade/build/lib/yade-new/py/yade/__init__.pyc in <module>()
>      8
>      9
> ---> 10
>     11
>     12
>
> AttributeError: No such attribute: subscribedBodies.".
> I just want to apply a force in a sphere but I don't know how to do.
>
> Thanks !
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

"1) Could you please, attach the problem script? It will be easier to
check your problem"
The scripts written were the complete ones.

"2) Replace "subscribedBodies" to "ids", subscribedBodies are not used
any more, I think."
Nice, it's working now.

But now, I have another question, I want to apply this force from a given iteration; for instance I want the force begins at the iteration number 30000. How can I do that ?
I tried to enter a pyrunner function but it doesn't work and I don't know how to configure the time "PyRunner(command='ForceEngine(force=(0,0,900),ids=[6])',iterPeriod=1)".
I also tried to create a function, before O.engines I create 'myfunction' and I run this function in O.engines with Pyrunner in O.engines:
"def myFunction():
    if iter()>20000:
        ForceEngine(force=(0,0,900),ids=[6])

[...]

O.engines=[
 [...]
 PyRunner(command='myFunction()',iterPeriod=1),
 ]"

And it's written
"NameError Traceback (most recent call last)

/home/arthur/yade/build/lib/yade-new/py/yade/__init__.pyc in <module>()
----> 1
      2
      3
      4
      5

NameError: name 'myFunction' is not defined"
Each time I try to create a function by 'def something():', the same message occurs, so do I create a function or how do I apply a function/force from a given iteration?

Thanks !

Anton Gladky (gladky-anton) said : #3

Hi, Arthur,

could you please, start a new "question" with new topic?
It is better to solve different questions in different topics. It will
be easier other users to find a solution.

Thank you.

Anton

On Fri, Apr 15, 2011 at 9:46 PM, Arthur Mercier
<email address hidden> wrote:
> Question #152878 on Yade changed:
> https://answers.launchpad.net/yade/+question/152878
>
>    Status: Answered => Open
>
> Arthur Mercier is still having a problem:
> "1) Could you please, attach the problem script? It will be easier to
> check your problem"
> The scripts written were the complete ones.
>
> "2) Replace "subscribedBodies" to "ids", subscribedBodies are not used
> any more, I think."
> Nice, it's working now.
>
> But now, I have another question, I want to apply this force from a given iteration; for instance I want the force begins at the iteration number 30000. How can I do that ?
> I tried to enter a pyrunner function but it doesn't work and I don't know how to configure the time "PyRunner(command='ForceEngine(force=(0,0,900),ids=[6])',iterPeriod=1)".
> I also tried to create a function, before O.engines I create 'myfunction' and I run this function in O.engines with Pyrunner in O.engines:
> "def myFunction():
>    if iter()>20000:
>        ForceEngine(force=(0,0,900),ids=[6])
>
> [...]
>
> O.engines=[
>        [...]
>        PyRunner(command='myFunction()',iterPeriod=1),
>        ]"
>
> And it's written
> "NameError                                 Traceback (most recent call last)
>
> /home/arthur/yade/build/lib/yade-new/py/yade/__init__.pyc in <module>()
> ----> 1
>      2
>      3
>      4
>      5
>
> NameError: name 'myFunction' is not defined"
> Each time I try to create a function by 'def something():', the same message occurs, so do I create a function or how do I apply a function/force from a given iteration?
>
> Thanks !
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

Best Jan Stránský (honzik) said : #4

Hi Arthur,

you can try to solve it with labels:

[...]
>O.engines=[
[...]
ForceEngine(force=(0,0,0),ids=[6],label='fEngine')
[...]
]

[...]
O.run(30000); O.wait()
fEngine.force[2] = 900
O.run();

I am not sure if it works.. if not, sorry for spam :-)
good luck
Jan

______________________________________________________________
> Od: "Arthur Mercier" <email address hidden>
> Komu: <email address hidden>
> Datum: 15.04.2011 21:48
> Předmět: Re: [Yade-users] [Question #152878]: confused about ForceEngine
>
>Question #152878 on Yade changed:
>https://answers.launchpad.net/yade/+question/152878
>
> Status: Answered => Open
>
>Arthur Mercier is still having a problem:
>"1) Could you please, attach the problem script? It will be easier to
>check your problem"
>The scripts written were the complete ones.
>
>"2) Replace "subscribedBodies" to "ids", subscribedBodies are not used
>any more, I think."
>Nice, it's working now.
>
>But now, I have another question, I want to apply this force from a given iteration; for instance I want the force begins at the iteration number 30000. How can I do that ?
>I tried to enter a pyrunner function but it doesn't work and I don't know how to configure the time "PyRunner(command='ForceEngine(force=(0,0,900),ids=[6])',iterPeriod=1)".
>I also tried to create a function, before O.engines I create 'myfunction' and I run this function in O.engines with Pyrunner in O.engines:
>"def myFunction():
> if iter()>20000:
> ForceEngine(force=(0,0,900),ids=[6])
>
>[...]
>
>O.engines=[
> [...]
> PyRunner(command='myFunction()',iterPeriod=1),
> ]"
>
>And it's written
>"NameError Traceback (most recent call last)
>
>/home/arthur/yade/build/lib/yade-new/py/yade/__init__.pyc in <module>()
>----> 1
> 2
> 3
> 4
> 5
>
>NameError: name 'myFunction' is not defined"
>Each time I try to create a function by 'def something():', the same message occurs, so do I create a function or how do I apply a function/force from a given iteration?
>
>Thanks !
>
>--
>You received this question notification because you are a member of
>yade-users, which is an answer contact for Yade.
>
>_______________________________________________
>Mailing list: https://launchpad.net/~yade-users
>Post to : <email address hidden>
>Unsubscribe : https://launchpad.net/~yade-users
>More help : https://help.launchpad.net/ListHelp
>

Thanks honzik, that solved my question.