Get force on Facet

Asked by GINNA TORRES

Hi,

I am trying to find the result force from a pack of spheres on facet.

I am trying to get it by O.forces.f(barrier)

Barrier is the form that i call the facet.

However I haven't result.

What can I have wrong?
Or what another form to do it?

Thanku

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#1

Hi,

please provide more information (e.g., MVE [1]). Do you have any errors, or just nothing happens? You need to pass body id to the O.forces.f() function. If 'barrier' is references directly to your facet (body) you should try something like this:

F = O.forces.f(barrier.id)
print(F)

Cheers,
Karol

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

Revision history for this message
GINNA TORRES (gmtorres61) said :
#2

Thanku Karol,

1. When I place O.force.f(Barrera1.id) I get an error:

AttributeError Traceback (most recent call last)
/usr/bin/yade in <module>

/usr/bin/yade in addPlotData()
    234 # each item is given a names, by which it can be the unsed in plot.plots
    235 # the **O.energy converts dictionary-like O.energy to plot.addData arguments
--> 236 Fz= sum(O.forces.f(Barrera1.id))
    237 plot.addData(Fz=Fz,i=O.iter, unbalanced=unbalancedForce(), **O.energy)
    238

AttributeError: 'int' object has no attribute 'id'

2. When leaving only the code without id, it works, however I am trying to graph this force and it does not work.

My code:

#BARRERA MÒVIL
Barrera1 = O.bodies.append(facet([(412,706,-100),(412,706,200),(412,635,0)],material='pFacetMat',color=[255,0,0]))
[10:41 a. m., 6/11/2022] G: #Definición de los motores de calculo

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
    InteractionLoop(
        # handle sphere+sphere and facet+sphere collisions
        [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()]
    ),
    NewtonIntegrator(gravity=(0,-9.81,0),damping=0.4),
[10:41 a. m., 6/11/2022] G: # call the checkUnbalanced function (defined below) every 2 seconds
    PyRunner(command='checkUnbalanced()',realPeriod=2),
    # call the addPlotData function every 200 steps
    PyRunner(command='addPlotData()', iterPeriod=100)

]

 # set timestep to a fraction of the critical timestep
# the fraction is very small, so that the simulation is not too fast
# and the motion can be observed
O.dt = .9e-1 * PWaveTimeStep()

O.trackEnergy = True

# if the unbalanced forces goes below .1, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
    if O.iter < 5000 :
        return

    #cuando las fuerzas se desbalanceen
    if unbalancedForce() < 0.1:
        O.bodies.erase(Barrera1)
        O.bodies.erase(Barrera2)
        O.bodies.erase(Barrera3)
        O.bodies.erase(Barrera4)
        O.pause()
        plot.saveDataTxt('tesis')
        plot.saveDataTxt('Fuerzab', vars= ('i','Fz'))

def addPlotData():
     # each item is given a names, by which it can be the unsed in plot.plots
     # the **O.energy converts dictionary-like O.energy to plot.addData arguments
        Fz= sum(O.forces.f(Barrera1.id))
        plot.addData(Fz=Fz,i=O.iter, unbalanced=unbalancedForce(), **O.energy)

plot.plots = {'i': ('unbalanced', None, O.energy.keys), 'w': ('Fz',)}
plot.plot()

Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#3

Hi Ginna,

Are you sure that you provided the working example (except for the plotting issue of course)?

- There are no spheres in your simulation, so there won't be any forces acting on your facet.
- Module plot is not imported from yade.
- While defining plots you use 'O.energy.keys', but I think it should be 'O.energy.keys()'.
- Also you want to plot 'Fz' vs 'w', but 'w' is not added to the plot data.
- BTW, why do you sum all the components of the force acting on the facet?

Regarding my previous guess, I see now that the "Barrera1" stores the id of the facet. So the previous version was ok 'O.force.f(Barrera1)".

Best wishes,
Karol

Revision history for this message
Launchpad Janitor (janitor) said :
#4

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.