How to know the force applied to each particle when Flowengine is activited

Asked by Huang peilun on 2020-05-16

Hi, I just begin to learn the Flowengine. My code is as followed:

import numpy as np
from yade import pack, plot, polyhedra_utils

#define the material(Fontainebleau Sand)
SteelMat = PolyhedraMat(young=2.06e11,poisson=.3,density=7890,frictionAngle=0.3)
SoilMat=FrictMat(young=1e7,poisson=0.2,density=2650,frictionAngle=0.273)
O.materials.append((SteelMat,SoilMat))

#define the chamber

#create foundation by making spheres in the cylinder.
sp=pack.SpherePack()
sp.makeCloud((-.4,-.4,0),(.4,.4,4),rMean=.04,rRelFuzz=.5)
sp.toSimulation(material=SoilMat)

#Engine of the simulation
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Polyhedra_ScGeom(),Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_FrictMat_PolyhedraMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.2),
#introduced as a dead engine for the moment
#Run the specific controlled motion.
PyRunner(command='start()',realPeriod=2,label='checker'),
]

#Time step
O.dt=PWaveTimeStep()

def start():
print('\n##### Simulation begins #####')
print('Stage: Gravitity desposition.')
print('Time step is %ss.' % O.dt)
checker.command='checkUnbalanced()'

def checkUnbalanced():
print('%s:UnbalancedForce=%s' % (O.iter,unbalancedForce()))
if max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)])>2: return
if unbalancedForce()>0.01: return
checker.command='Active_Flowengine()'

#Compress the soil to achieve a certain dry density of 1.5g/cm^3.
def Active_Flowengine():
flow.meshUpdateInterval=200
flow.useSolver=3
flow.permeabilityFactor=1
flow.viscosity=10
flow.bndCondIsPressure=[0,0,0,0,0,1]
flow.bndCondValue=[0,0,0,0,0,0]
flow.boundaryUseMaxMin=[1,1,1,1,1,1]
newton.damping=0
checker.command='Create_Ball()'

def Create_Ball():
#Ball=sphere((0,0,1.6),0.1243186,material=SteelMat)
Cube=polyhedra_utils.polyhedra(SteelMat,(.1,.1,.1),v=((0.05,0.05,1.6),(-0.05,0.05,1.6),(0.05,-0.05,1.6),(-0.05,-0.05,1.6),(0.05,0.05,1.7),(-0.05,0.05,1.7),(0.05,-0.05,1.7),(-0.05,-0.05,1.7)))
O.bodies.append(Cube)
global Cube
#flow.ignoredBody=Cube.id
checker.command='Fall()'

def Fall():
print(O.forces.f(Cube.id)[2])

Here's my question. After the gravity deposition completed and the FlowEngine activated, it shows that the force of the cube element is always zero. Even if the cube element has a direct contact with other balls. There must be something wrong.
Can anyone help me out?

Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Robert Caulk
Solved:
Last query:
 Robert Caulk (rcaulk) said on 2020-05-17: #1

Hello,

FlowEngine is not designed to triangulate polyhedra bodies or estimate forces on polyhedra bodies, thus I would expect undefined behavior in this type of scenario.

BTW for future questions please ensure your MWE works. This one throws:

"SyntaxError: name 'Cube' is used prior to global declaration"

However, after fixing it I was able to reproduce the problem you describe.

Cheers,

Robert

 Huang peilun (hpl16) said on 2020-05-18: #2

Thanks Robert Caulk, that solved my question.