how to move a wall by applying a specific force?

Asked by Aaron Liu on 2019-05-01

Hi all,

I need to move a wall by applying a specific force in the simulation. This force may change within the processs. I have tried to use the command

O.forces.addF(wall_id,Vector3(10,0.,0.))

but the position of the wall is not chnaged. Can you please give some suggestions on how to do that?

Xin

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2019-05-02
Last query:
2019-05-02
Last reply:
2019-05-02
Jan Stránský (honzik) said : #1

Hello,
please read [1] and provide a MWE. E.g. we do not know what body with wall_id ID actually is (Wall? Box? ...)
thanks
Jan

[1] https://yade-dem.org/wiki/Howtoask

Aaron Liu (liuxin9) said : #2

Hi Jan,

Thanks for your kind reply. I am sorry for the vague expression. The body with wall_id ID is a Wall.

Thanks,

Xin

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

Hello,

thanks for the info. But next time please also try provide a MWE [1], it is then much more clear what you have done and what not
Like how you created the wall, what values you have assigned it etc. It might happen that your wall is parallel to x axis and applying force also parallel to x axis has no effect..

Using yade.utils.wall function (**gussing/assuming** you use this one), walls are made fixed (with blocked all degrees of freedom) and with zero mass.
To make applying force work, you have to un-fix the DOF perpendicular to the wall and assign non-zero mass.

To change the force during simulation, there are several options depending on your use case:
- use setPermF, then O.run(...,True), then setPermF, then O.run(...,True), then ......
- use addF or setPermF inside a PyRunner
- use ForceEngine
- ...

### MWE
wall = utils.wall((0,0,0),axis=0)
wall_id = O.bodies.append(wall)
# wall default values
print wall.state.blockedDOFs # walls are fixed by default
print wall.state.mass # walls has zero mass by default
# modify necessary attributes
wall.state.blockedDOFs = 'yzXYZ'
wall.state.mass = 1 # assign your own value
# set force (for example this way)
O.forces.setPermF(wall_id,(10,0,0)) # or O.forces.addF(wall_id,(10,0,0),permanent=True) for older versions
O.step()
print wall.state.vel
print wall.state.pos
O.step()
print wall.state.vel
print wall.state.pos
###

cheers
Jan

Aaron Liu (liuxin9) said : #4

Thanks Jan, that solved my question. And next time I'll follow you advise to provide a MWE and make the question clearer.

Aaron Liu (liuxin9) said : #5

Thanks Jan Stránský, that solved my question.