← Back to team overview

yade-users team mailing list archive

[Question #670072]: vtk recoder

 

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

hi i m new on YADE. I have problems with vtk recoder. I m able to export the particles positions of my deposition and the facets that i have , but i can't export my "impact mass". This mass is a sphere too, and i specified in the vtk exportSpheres to take all ( ids='all'), but it is taking only the particles deposition. So i try to use again exportSpheres saying to take only sp : ( ids=sp, #line 69 and in pyrunner #line 90) but the terminal say that sp is not an iterable object. How can i do? this is my code but you ll not have the particle depositions , so it can't work. thank you to help me.

CODE:
from yade import pack, plot
from yade import export, ymport
from yade import utils

#####################################
########### INITIAL DATA ############
#####################################

h=18.45	               #initial falling position
v=(2*9.81*h)**0.5      #falling velocity before impact
		
secVirt=0.9	       #desired max virtual time [s]
fps=200		       #frame per seconds (per vtk)
	

maxIt=int(secVirt/O.dt)		# max iterations
term=maxIt-1			# used to stop and print the results just one iteration before the end
vtk_it=int(term/(fps*secVirt))	# number of iterations between each VTK
#desired frames per second





##################################
##### CREATING CONTAINER #########
##################################
O.bodies.append(geom.facetCylinder(center=(0,0,1.25), radius=5.35, height=2.5, orientation=Quaternion((0, 0, 1), 0), segmentsNumber=100, wallMask=6, angleRange=None, closeGap=False, radiusTopInner=-1, radiusBottomInner=-1))




##################################
#### DEFINING SOIL MATERIAL ######
##################################
idSoil=FrictMat(density=1500,frictionAngle=radians(30),label='soil',young=17161637.5,poisson=0.33)	

O.materials.append(idSoil)													

##positions and radii particles is added and material defined##
s=ymport.textExt('DEP_R01Y175P33F30.txt',format='x_y_z_r', material='soil',color=(0,0,1))
	
sfere=O.bodies.append(s)

###############################
##### CREATING FALLING MASS ###
###############################

##material##
idCA=FrictMat(density=2227,frictionAngle=radians(0.5),label='CA',young=30e9,poisson=0.15)

O.materials.append(idCA)
 
sp=utils.sphere((0,0,2.45),radius=0.45,material='CA')

#defining impact velocity##
sp.state.vel=(0,0,-v)

##add impact mass to simulation
O.bodies.append(sp)


#############
#### VTK ####
#############
vtkExporter=export.VTKExporter('VTK_simulazione')																							# vtk exporter dedicated to the AirBag facets.
vtkExporter.exportSpheres(ids='all', what=[('Sphere_Force','abs(O.forces.f(b.id))')])
vtkExporter.exportFacets(ids='all')
#vtkExporter.exportSpheres(ids=sp)


#############################################################################
# DEFINITION OF TYPE OF CONTACTS,LAW AND FUNCTIONS NEEDED TO RUN SIMULATION #
#############################################################################


O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(0,0,-9.81),damping=0),
#  PyRunner(command='addPlotData()',iterPeriod=1),
   PyRunner(command="vtkExporter.exportSpheres(ids='all', what=[('Sphere_Force','abs(O.forces.f(b.id))')])", iterPeriod=vtk_it),
   PyRunner(command="vtkExporter.exportFacets(ids='all')",iterPeriod=vtk_it),
   #PyRunner(command="vtkExporter.exportSpheres(ids=sp)",iterPeriod=vtk_it),
   PyRunner(command='BlockRotation()',iterPeriod=1),
   PyRunner(command='EndSimulation()',iterPeriod=10),
]

O.trackEnergy=True

############################################################################
######################### DEFINING FUNCTIONS ###############################
############################################################################



def EndSimulation():
   if O.time > 0.6 :
       O.pause()
       plot.saveDataTxt('IMP_R01Y175P33F30_H18.txt')



# Function that blocks the particles rotations#
def BlockRotation():
     for b in O.bodies :
        b.state.angVel=(0,0,0)
     
#plotting general data
#def addPlotData():
   
#   plot.addData(i=O.time,Force=O.forces.f(184081).norm(),**O.energy)
#   b=O.bodies[184081]
#   plot.addData(i=O.time,Force=O.forces.f(184081)[2],vel=-b.state.vel[2])
#   plot.addData(i=O.time,vel=-b.state.vel[2],pos=b.state.pos[2],Force=O.forces.f(184081).norm())
#plot.plots={'i':('pos',None,('vel','r')),'i ':'Force'}
#plot.plot(subPlots=False)
#plot.plots={'i':('Force',None,O.energy.keys)}

# show the plot on the screen, and update while the simulation runs
#plot.plot()
############################################################################

O.dt=.8*PWaveTimeStep()
O.run()
O.stopAtIter=maxIt;
O.saveTmp()

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