# What are the forces on the particle from function O.forces.f()

Asked by Zhicheng Gao on 2021-05-26

I get the fluid force on all the particles of an assembly through the flow engine by function flow.fluidForce(ballid) , then I apply the force on all particles for 1000 steps by function O.forces.setPermF(ballid,force) during the isotropic compression experiment. When the program is finished, I want to get the contact force on each particle, so I use the function O.forces.f(ballid) to get the resultant force on each body, and then I take O.forces.f(ballid) minus flow.fluidForce(ballid) to get resultant contact force. Is that right?

The function O.forces.f(ballid) get resultant force on body, excluding gravity, so should imposing forces be included?

Another question, How does Yade add and subtract vectors and calculate the magnitude of a vector.

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Zhicheng Gao
Solved:
Last query:
 Revision history for this message Zhicheng Gao (zhichenggao) said on 2021-05-26: #1

I also want to know how to get the magnitude of each contact force of a particle.
Thank you

 Revision history for this message Jan Stránský (honzik) said on 2021-05-26: #2

Hello,

> Another question

> How does Yade add and subtract vectors and calculate the magnitude of a vector.

please read [1] and provide more information. How is it implemented? What is the equation? How to use it in Python? How to use it in C++? ... ?

> I also want to know how to get the magnitude of each contact force of a particle.

Iterate over particle's interactions and compute the magnitude from the interaction forces.
Could be something like:
###
particle = O.bodies[123]
for interaction in particle.intrs():
force = interactipn.phys.normalForce + interaction.phys.shearForce
magnitude = force.norm()
###

Cheers
Jan

 Revision history for this message Zhicheng Gao (zhichenggao) said on 2021-05-27: #3

Thank you for your response. The problem is that I apply a force on a body via function O.forces.setPermF(), and then I use function O.forces.f() to get the resultant force on the body. Whether the resultant force includes the applied force and the contact force. In the documentation, the function O.forces.f() is described as:
Resultant force on body, excluding gravity.

 Revision history for this message Jan Stránský (honzik) said on 2021-05-27: #4

In such a simple case, you can test it yourself:
###
b = sphere((0,0,0),1)
O.bodies.append(b)
O.forces.setPermF(0,(1,2,3))
O.step()
print(O.forces.f(0)) # Vector3(1,2,3)
###

So yes, "the resultant force includes the applied force and the contact forces"

Cheers
Jan

 Revision history for this message Zhicheng Gao (zhichenggao) said on 2021-05-27: #5

Thank you for your answer, which also brings me some ideas to solve the problem