How to set the weight of particles?

Asked by 孙灿

Now I need to apply uniform load in the simulation. I have two ideas: the first is to generate some particles and then give them weight, but this involves a material, but I can't find it; The second is to apply load directly, but I don't know how to write specific code.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

TLTR: [1,2,3,4,5,6]

> I need to apply uniform load in the simulation

please be more specific.
Body uniform load like gravity [3,4,5,6]?
Surface uniform load like surface pressure [5,6]?
... ?

> to generate some particles and then give them weight, but this involves a material, but I can't find it;

Please be more specific, what you can't find?
as discussed in your previous questions, e.g. [7], you already know how to use material, including density..
Material has density [1], from which is usually computed body.state.mass [2]. But mass can be set independently of density if needed.
You can then use NewtonIntegrator.gravity [3] or one of FieldApplier engines [4].
Is this "give weight"?

> The second is to apply load directly, but I don't know how to write specific code.

Using ForceContainer [5,6].

Cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Material.density
[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.State.mass
[3] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.NewtonIntegrator.gravity
[4] https://yade-dem.org/doc/yade.wrapper.html#fieldapplier
[5] https://yade-dem.org/doc/user.html#imposed-force
[6] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ForceContainer
[7] https://answers.launchpad.net/yade/+question/703041

Revision history for this message
孙灿 (suncan) said :
#2

Sorry, I didn't respond in time.

I think both of the lines you mentioned will solve my problem. However I think the method mentioned in [5] is more suitable. [5] Can the O.forces.setPermF(0,(1,0,0)) mentioned specify the range of applied force? For example, I need to apply force within the interval of (2,3). Also, how to understand "The only way is to place PyRunner in a simulated loop.", I need to set a permanent force, set a function PerpetualPower(), and add PyRunner (command='PerpetualPower()', realPeriod=2) to the engines, is this feasible?

Revision history for this message
Jan Stránský (honzik) said :
#3

> Can the O.forces.setPermF(0,(1,0,0)) mentioned specify the range of applied force? For example, I need to apply force within the interval of (2,3).

what does "range of applied force" mean? force varying in time?
setPermF sets one specific value, no range.
But you can change the value whenever you want (even every time step) to whatever value you want.

> Also, how to understand "The only way is to place PyRunner in a simulated loop.",

It is talking about O.forces.addF (not setPermF).
If you use O.forces.addF after NewtonIntegrator but before ForceResetter (so basically outside O.engines), the force added by addF is reset by ForceResetter.
The only (sensible) way to make it actually applied is to put addF in PyRunner between ForceResetter and NewtonIntegrator.

> I need to set a permanent force, set a function PerpetualPower(), and add PyRunner (command='PerpetualPower()', realPeriod=2) to the engines, is this feasible?

I see nothing making it not feasible.

Cheers
Jan

Revision history for this message
孙灿 (suncan) said :
#4

>what does "range of applied force" mean? force varying in time?
No, I mean I only apply force in the designated area (other than gravity) and the rest of the area uses only gravity. For example, there is a 30m box, I only apply one force in the area of 0 to 15m, and all these 30m will receive the action of gravity.

Also, in O.forces.setPermF(0,(1,0,0)), does 0 refer to the magnitude of the set force? (1, 0, 0) is the position of the applied force? If I'm right, then it's just applying a concentrated load, not the uniform load I need. Maybe I can use O.forces.setPermF(0,((1,0,0),(2,0,0)))?

Revision history for this message
Jan Stránský (honzik) said :
#5

> I mean I only apply force in the designated area (other than gravity) and the rest of the area uses only gravity. For example, there is a 30m box, I only apply one force in the area of 0 to 15m, and all these 30m will receive the action of gravity.

yes, it is possible.
You simply select desired particles and apply force on them.

> Also, in O.forces.setPermF(0,(1,0,0)), does 0 refer to the magnitude of the set force? (1, 0, 0) is the position of the applied force?

See documentation [5,6,8].
0 is particle ID
(1,0,0) is the applied force vector

> If I'm right, then it's just applying a concentrated load,

Yes, force is applied to particle "center" (particle.state.pos).

> not the uniform load I need.

DEM is Discrete element mehod, everything is discrete.
You can think of it such as nothing like uniform load exists in DEM.

> Maybe I can use O.forces.setPermF(0,((1,0,0),(2,0,0)))?

No [8]

Cheers
Jan

[8] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.ForceContainer.setPermF

Revision history for this message
孙灿 (suncan) said :
#6

I get it. If I need to achieve uniform loads, then I have to apply a concentration force to multiple particles. So how is the magnitude of the force determined?Is it done by (1,0,0) force vector? I'm a little unsure how to set the size of a force through a force vector.

Revision history for this message
Best Jan Stránský (honzik) said :
#7

> So how is the magnitude of the force determined?

it is up to you and your problem.
For your case, it could be something like
force = bodyLoad / fictitiousParticleVolume
or
force = surfaceLoad / fictitiousParticleArea

> Is it done by (1,0,0) force vector? I'm a little unsure how to set the size of a force through a force vector.

You can compose force vector from magnitude and direction, like:
magnitude = 123 # scalar
direction = Vector3(1,2,3).normalized() # unit (normalized) vector, with its norm equal to 1
forceVector = magnitude * direction
O.forces.setPermF(bodyID,forceVector)

Cheers
Jan

Revision history for this message
孙灿 (suncan) said :
#8

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