← Back to team overview

yade-users team mailing list archive

[Question #694513]: How to generate stress in PARAVIEW when the boulder dropped on the grains, and why my amount of grains model in PARAVIEW is not as much as in YADE simulation?

 

New question #694513 on Yade:
https://answers.launchpad.net/yade/+question/694513

Dear all,

I have some doubts:
1. Based on my script (attachment on below), why I cannot run "readParamsFromTable" from my YADE script? it appeared like this on PARAVIEW when I run script:
Traceback (most recent call last):
  File "<string>", line 3, in <module>
NameError: name 'readParamsFromTable' is not defined

What should I do?

2. How to generate stress in PARAVIEW when the boulder dropped on the grains? I don't know how to make on script using vtkExporter..please help me..

3.  Why is my amount of grains model in PARAVIEW not as much as in YADE simulation? if you could run my script, I already applied Glyph method to see the particles/grains, but it is not as much as I want like in YADE.

###SCRIPT###

##Sphere Cylinder pack
readParamsFromTable(maxLoad=1000,minLoad=0)
from yade.params.table import *
from yade import export
from yade import pack, plot
from pylab import rand #for sand color

O.bodies.append(geom.facetCylinder(Vector3(1,1,25),4,50,wallMask=6))

##Define material of the grains
O.bodies[0].state.blockedDOFs='xyzXYZ'
O.bodies[0].state.vel=(0,0,0)
O.materials.append(FrictMat(young=1e7,poisson=.3,density=2000,frictionAngle=18))

sp=pack.SpherePack()
sp.makeCloud((-1.6,2.6,.1),(3,-1,20),rMean=.3,rRelFuzz=.5,num=950,)
sp.toSimulation(color=(0.6+0.15*rand(),0.5+0.15*rand(),0.15+0.15*rand()))

##Make a floor
O.bodies.append(wall((0,0,0),axis=2))

##Engines and Constitutive Law
O.engines=[ForceResetter(),
 	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]), #move for sphere, facet, wall
 	InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()], #interaction between them
   [Ip2_FrictMat_FrictMat_FrictPhys()], # ip2 list (just one list!)
   [Law2_ScGeom_FrictPhys_CundallStrack()]), # law2 list
   NewtonIntegrator(damping=.3,gravity=[0,0,-9.81]),
   PyRunner(command='checkUnbalanced()',realPeriod=2,label='checker'),
   PyRunner(iterPeriod=7000,command='doExport()'),]

O.dt=.8*PWaveTimeStep()

def checkUnbalanced():
	if O.iter<1000:return # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing 										is stable
	if unbalancedForce()>1:return 	# the rest will be run only if unbalanced is < 1 (stabilized packing)
	O.bodies.append([utils.sphere(center=(1,1,50),radius=3.4)])
	O.bodies[0].state.mass=2000
	O.materials.append(FrictMat(young=100e7,poisson=.2,density=2700))
	global boulder # without this line, the BOULDER variable would only exist inside this function
	boulder=O.bodies[-1] 	# the last particles is the boulder
	boulder.state.vel=(0,0,-.1) # start plotting the data now, it was not interesting before
	O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=50)]
	checker.command='unloadBoulder()'

def unloadBoulder():
	# if the force on boulder exceeds maximum load, start unloading
	if abs(O.forces.f(boulder.id)[2])>maxLoad:
		boulder.state.vel*=-1 # prescribing a velocity will therefore make it move at constant velocity (downwards)
		checker.command='stopUnloading()'

def stopUnloading():
	if abs(O.forces.f(boulder.id)[2])<minLoad:
		O.run()
		
def addPlotData():
		b=O.bodies[-1]
		plot.addData(position=b.state.pos[2], velocity=b.state.vel.norm(), itera=O.iter, time=O.time, time_=O.time, accel=Force/O.bodies[0].state.mass, Impact_Force=Force, itera_=O.iter)
		
plot.plots={'time':('velocity',), 'itera':('position',), 'time_':('accel',), 'itera_':('Impact_Force')}
plot.plot()

def doExport():
	vtkExporter = export.VTKExporter('1')
	vtkExporter.exportContactPoints(useRef=True, what=[('displacement','b.state.displ()')])
	vtkExporter.exportSpheres(useRef=True, what=[('displacement','b.state.displ()')])
	vtkExporter.exportFacets(numLabel=7000, what=[('displacement','b.state.displ()')])
	vtkExporter.exportInteractions(useRef=True, what=dict(kn='i.phys.kn'))
	vtkExporter.exportPeriodicCell('1')
	vtkExporter.exportPotentialBlocks(what=[('displacement','b.state.displ()')])
	vtkExporter.exportPolyhedra(what=dict(n='b.id'))

yade.qt.Controller();

O.saveTmp()
##########################################################

Thank you in advance!

Cheers!!

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.