Extract normal force
Hi,
I'm working on a tumbling ball mill simulation and I am interested on the extraction of the normal contact forces between the balls and the mill wall;
I use i.phys.
How can i do to have the length of the vector normal force, with the same length of the total number of iteration?
Can someone help me?
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Hello,
> I am interested on the extraction of the normal contact forces
What is "the extraction"? printing, saving, ...?
What is "the normal contact forces"? individual force vectors? magnitudes? sum of the vectors? sum of magnitudes? ... ?
> I use i.phys.
what is "i"?
> the length of the simulation is 4098
"length" is number of time steps?
> by extracting the normal forces
what is "extracting"?
what is "the normal forces"? vectors? magnitudes? ... ?
> I expected to have a force vector of the same length as the number of simulation
what is "the number of simulation"?
what is "a force vector"? I would expect "a force vector" to be a "standard Euclidean vector"..
> I would like to know why I don't get the length of the vector equal to the length of the simulation?
> How can i do to have the length of the vector normal force, with the same length of the total number of iteration?
What is "the vector"?
What is "the length of the vector"?
What is "the length of the simulation" and why would it equal to "the length of the vector"?
What is "the vector normal force"?
From the question, we can hardly even guess, please read [1] and provide more information.
> Can someone help me?
Yes, but first please help us. E.g. by providing a MWE [1], which would (should) have answered most of the "what is ..." questions..
cheers
Jan
Revision history for this message
|
#2 |
Hi,
Thanks for your response, and you can find here after some response at your questions;
What is "the extraction"? printing, saving, ...?
The term extraction used here means , Saving force
What is "the normal contact forces"? individual force vectors? magnitudes? sum of the vectors? sum of magnitudes? ... ?
I call normal contact force, the magnitudes of the force of contact between ball and mill in the normal direction, saving at each step time; i need to save this force of contact at each time step. To know the evolution of this in time.
what is "the number of simulation"?
the number of simulation is the number of iteration here is 4098
what is "a force vector"? I would expect "a force vector" to be a "standard Euclidean vector"..
I call force vector, or normal force, in my question here, the vector contenning the value of magnitudes force in normal direction saving at each step time.
the force at each step time. if the length of simulation, or the vector time length is 4098, i expect to have the saving vector force with the same length.
Briefly i want to save the evolution of interaction force in time; reason why i insert a loop for j in O.time in my script; But i can't have the result i need.
I don't know if there is an other way, to save the contact force at each step time, and to plot his evolution in time;
I' m trying to do it in my mwe here after:
# Material
rho = 7640.0 # [kg/m^3] density (of the balls)
kn = 1.0e5 # [N/m] equivalent normal stiffness
kt = kn # [N/m] equivalent tangential stiffness
en = 0.3 # [-] normal coefficient of restitution (sphere/sphere)
mu = 0.75 # [-] friction coefficient
cn = 0.75
ct = cn
# Geometry/Filling
length = 0.4 # [m] axial length of the mill
rMean = 0.772/2.0 # [m] liner profile mean radius
rBall = 0.01 # [m] ball radius
fRatio = 1.0 # [%] filling ratio
sphRadFuzz = 0.8
# Simulation
tEnd = 1.0 # [s] total simulation time
O.dt = 2.44140e-4 # [s] fixed time step
tRec = 1.0e-2 # [s] recording interval
#material of cylinder
cylMat = O.materials.
#material of spheres
ballMat = O.materials.
ids=O.bodies.
# define domains for initial cloud of red and blue spheres
packHt=.8*rMean # size of the area
bboxes=
colors=
for i in (0,1): # red and blue spheres
sp=pack.
bb=bboxes[i];
vol=(bb[
sp.makeCloud(
O.bodies.
O.engines = [
ForceResett
InsertionSo
Interaction
),
#GravityEngi
RotationEngi
NewtonIntegr
PyRunner(
]
def exportForces():
# get data
for j in O.time:
for i in O.interactions:
if isinstance(
and isinstance(
totalNormalForce = i.phys.normalForce
# Save data
out=open(
out.write(
out.close()
###
O.run(int(
Revision history for this message
|
#3 |
Hello,
> I call normal contact force, the magnitudes of the force of contact between ball and mill in the normal direction
> > the force at each step time
> i want to save the evolution of interaction force in time
still this is very confusing.
In the simulation, you have (possibly) many balls and many ball-mill interactions and many forces.
What is "(the) force"?
- force of one specific interaction?
- sum of force vectors?
- sum of force magnitudes?
- ... ?
> I call force vector, or normal force, in my question here, the vector contenning the value of magnitudes force in normal direction saving at each step time.
I strongly recommend to use a different name for the "vector" in this case not to be confused with "ordinary" force vector.
Maybe array? field?
> i insert a loop for j in O.time in my script; But i can't have the result i need.
it results in an error, no surprise you do not have the result.
Fix errors first.
> I don't know if there is an other way, to save the contact force at each step time
There are many ways.
To choose a suitable one, first of all you need to know (or explain it properly in the case you want help from others) what you want. Which does not seem to be the case (see above).
> ... mwe ...
W = working, which is not the case here. Please, fix the indentation to be valid Python code.
Moreover, O.time is a number and you cannot iterate it "for j in O.time"
> totalNormalForce = i.phys.normalForce
**guessing** it should be inside the sphere-facet condition:
- why the equal sign? Shouldn't the value of totalNormalForce be incremented by i.phys.normalForce instead of rewriting?
- you write you want normal force magnitudes. here you assign/sum normal force vector. What exactly do you want?
- you can save the data "manually" as you do here. But you should clear the output file first (the code appends data to whatever already is in the file)
- instead of "manual" saving, Yade "standardly" uses plot module for this purposes [1]
cheers
Jan
Revision history for this message
|
#4 |
Hi, Thank you, This some response,
still this is very confusing.
In the simulation, you have (possibly) many balls and many ball-mill interactions and many forces.
What is "(the) force"?
- force of one specific interaction?
- sum of force vectors?
- sum of force magnitudes?
Exactly you are right. In the simulation, several interactions take place between balls and mill, because of the presence of several balls. That's why I want to save at each iteration (or step time), the sum of forces magnitudes.
I'will provide my mwe soon
Revision history for this message
|
#5 |
This is my MWE;
As I said before, I want to save for each iteration, the sum of force (amplitude) of interactions between balls and mill;
In this MWE, I have rather calculated the forces when there is interaction; But I wish to calculate it rather for each iteration; this will allow me to represent the evolution of its forces in time;
from yade import pack,utils, plot,ymport,qt
#######
fr = 0.1;rho=
MillMat = O.materials.
ballMat = O.materials.
#######
# Create Mill from facets
Mill=O.
#Walls=
# utils.wall(
# ])
# define domains for initial cloud of red and blue spheres
packHt=.8*rMean # size of the area
bboxes=
colors=
for i in (0,1):
sp=pack.
bb=bboxes[i];
vol=(bb[
sp.makeCloud(
O.bodies.
O.engines=[
ForceResetter(),
InsertionSor
InteractionLoop(
[Ig2_
[
[
),
NewtonInteg
RotationEng
]
O.dt=.5*
def saveForces():
for i in O.interactions:
if isinstance(
else :
# out=open(
# out.write(
# out.close()
O.run(100000)
#O.save(
Revision history for this message
|
#6 |
You defined saveForces, but it is not used anywhere.
You have to use saveForces somehow, most likely form a PyRunner (as you already had in the previous codes).
cheers
Jan
Revision history for this message
|
#7 |
Hi Jan,
This is my updated MWE, as i tell you before, i need the simulation show the plot on the screen, and update while the simulation runs in time, and save the result in txt format.
rom yade import pack,utils, plot,ymport,qt
#######
fr = 0.1;rho=
MillMat = O.materials.
ballMat = O.materials.
#######
# Create Mill from facets
Mill=O.
#Walls=
# utils.wall(
# ])
# define domains for initial cloud of red and blue spheres
packHt=.8*rMean # size of the area
bboxes=
colors=
for i in (0,1):
sp=pack.
bb=bboxes[i];
vol=(bb[
sp.makeCloud(
O.bodies.
O.engines=[
ForceResetter(),
InsertionSor
InteractionLoop(
[Ig2_
[
[
),
NewtonInteg
RotationEng
PyRunner(
]
O.dt=.5*
# collect history of data which will be plotted
def addPlotData():
for i in O.interactions:
if isinstance(
Force = sum((O.
else :
Force = 0
plot.
plot.plots=
# show the plot on the screen, and update while the simulation runs
plot.plot()
O.run(100000)
#O.save(
but when i run the simulation i get this error;
ArgumentError: Python argument types in
ForceContai
did not match C++ signature:
f(yade:
In [1]: Erreur de segmentation (core dumped)
Can i have some correction in my code please?
Revision history for this message
|
#8 |
code 1:
> def exportForces():
> totalNormalForce = i.phys.normalForce
code 2:
> def saveForces():
> MagnitudeNormal
code 3:
> def addPlotData():
> Force = sum((O.
Every update, you completely changed the namings. Yes, it is just naming and here it is clear, but next time please try to stay consistent.
There is no reason for such renaming and then I would prefer not to rename the stuff to prevent confusion.
Every update, you changed the force computation method, without any comment. Next time please consider giving some comment about the reasons.
Ok, from the discussion it came out that the magnitude should be force.norm() instead of force vector itself, so i.phys.normalForce -> i.phys.
But why the sum (inside for loop)?
And why i.phys.normalForce -> O.forces.f ?(!?!?)
> This is my updated MWE
> rom yade import pack,utils, plot,ymport,qt
W=working, starting a script with "rom yade..." surely is not :-)
> for i in O.interactions:
> ... O.forces.f(i)
O.forces.f needs body ID, see documentation [1]. In your code you pass "i", which is Interaction... (this is what the error says)
O.forces.f returns resulting force on the body. It has no relation to individual interaction forces.
(O.forces.f is sum of all interaction forces on the body, but with no backwards influence)
> sum((O.
force.norm() is one number.
What you expect from sum(number)?
try it in python. e.g. sum(2)
> for i in O.interactions:
> if ...:
> Force = sum((O.
> else :
> Force = 0
this way, you loop over all interactions just to assign Force to be the force from the very last interaction or 0...
A possible solution:
###
def addPlotData():
Force = 0.0 # initial zero value
for i in O.interactions:
if isinstance(
Force += i.phys.
# or even a one liner
# Force = sum(i.phys.
plot.
###
You can save the data with plot.saveDataTxt [2], either inside addPlotData, or in some other PyRunner with lower frequency, or after the simulation is finished, or ... whenever you need.
cheers
Jan
[1] https:/
[2] https:/
Revision history for this message
|
#9 |
Hi, Jan thank you for your response;
What can i do, if i want to save de force on a specific point on the mill?
Can you help me ?
Revision history for this message
|
#10 |
What is the problem? getting the value? saving the value to a file? ... ?
What is "a specific point"?
cheers
Jan
Revision history for this message
|
#11 |
Thank's Jan,
Plaese find the raison why i need to save the forces (Forces&Torques) at the specific point.
During the operation of a ball mill, the drum lifts the balls along one side of the mill until it reaches a falling point. From this position the particles begin to fall independently of the movement of the mill. The balls then fall onto the inner surface of the mill drum, creating impact forces (forces and torques). It is these forces that I wish to save.However, there is a region of the mill where the magnitude of the forces is maximum around the circumference of the mill. Exactly between 180 and 360 degrees in the third and fourth quadrant, if we consider that the mill rotates anti-clockwise. It is in this zone that I wish to record the efforts (forces and torque), and trace the evolution of its efforts in space (angle in degrees) and in time (time in seconds). To know exactly at which angular positions of the drum to place different sensors.
But I don't know yet how I can do it.
Revision history for this message
|
#12 |
Thank's Jan,
Plaese find the raison why i need to save the forces (Forces&Torques) at the specific point.
During the operation of a ball mill, the drum lifts the balls along one side of the mill until it reaches a falling point. From this position the particles begin to fall independently of the movement of the mill. The balls then fall onto the inner surface of the mill drum, creating impact forces (forces and torques). It is these forces that I wish to save.However, there is a region of the mill where the magnitude of the forces is maximum around the circumference of the mill. Exactly between 180 and 360 degrees in the third and fourth quadrant, if we consider that the mill rotates anti-clockwise. It is in this zone that I wish to record the efforts (forces and torque), and trace the evolution of its efforts in space (angular position in degrees) and in time (time in seconds). To know exactly at which angular positions of the drum to place different sensors.
But I don't know yet how I can do it.
Revision history for this message
|
#13 |
Hello,
thanks for more information.
If I got it correctly, there are several approaches, depending on your actual needs. Basically all of them are consists of:
1) getting all forces and contact points (action points of the forces)
2) do some postprocessing (averaging, smoothing, ...)
1) must be done in Yade, 2) may be done in the Yade script or somehow externally from saved data.
I **personally** would save the raw data from Yade and do external postprocessing (probably using Python or some dedicated tool).
This way, you can do the postprocessing from the same data with different parameters / methods.
The postprocessing may be both in space and time sense, summing / averaging / smoothing / ... , really many options, depending what you want..
cheers
Jan
Can you help with this problem?
Provide an answer of your own, or ask NGANDU KALALA Gauthier for more information if necessary.