← Back to team overview

yade-users team mailing list archive

Re: [Question #707210]: seeking help in VTKRecorder

 

Question #707210 on Yade changed:
https://answers.launchpad.net/yade/+question/707210

    Status: Answered => Open

Yuri Bezmenov is still having a problem:
Hi Jan, 
I modify the code to use VTKExporter but cannot visualize the force at each grid element.  For interaction, I created two matrices, one has the ids of balls and the other with grid-connection to the ball id. In first case that is the matrix b, I an able to export interaction but they have constant value over the simulation. In second case, it shows an error "interaction does not exist". 
Could you please help me out. 
Thank You 

MWE:
from builtins import range
from yade import pack, geom, plot, export
from yade.gridpfacet import *
rate=-0.5 #1.66e-4
compFricDegree=30
finalFricDegree = 40
stabilityThreshold = 0.1
young = 5e6
mn, mx = Vector3(0, 0, 0), Vector3(0.9, 0.6, 0.6)
O.engines = [
        ForceResetter(),
        InsertionSortCollider([
                Bo1_Sphere_Aabb(),
                Bo1_GridConnection_Aabb(),
		Bo1_Facet_Aabb(), Bo1_Wall_Aabb()
        ]),
        InteractionLoop(
                [       Ig2_Sphere_Sphere_ScGeom(),
			Ig2_Facet_Sphere_ScGeom(), Ig2_Wall_Sphere_ScGeom(), 
                        Ig2_Sphere_GridConnection_ScGridCoGeom(),
                        Ig2_GridNode_GridNode_GridNodeGeom6D(),
                        Ig2_GridConnection_GridConnection_GridCoGridCoGeom()], 
		[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True, setCohesionOnNewContacts=True), Ip2_FrictMat_FrictMat_FrictPhys()], 
		[Law2_ScGeom_FrictPhys_CundallStrack(), Law2_ScGridCoGeom_FrictPhys_CundallStrack(), Law2_GridCoGridCoGeom_FrictPhys_CundallStrack(), 
		Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),]
        ),
        GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1, label='ts'),
        NewtonIntegrator(gravity=(0,-10,0), damping=.5, label='newton'),
	PyRunner(command='addPlotData()', iterPeriod=500),
	PyRunner(command='expo()', iterPeriod=500),
	VTKRecorder(fileName='/files/Geogrid/paraview/pullout', recorders=['all'], iterPeriod=500),
]
def addPlotData():
	plot.addData(
		unbalanced=unbalancedForce(), 
		i=O.iter
	)
plot.plots = {
        'i':('unbalanced'),
}
plot.plot()
O.materials.append(FrictMat(young=young, poisson=0.5, frictionAngle=radians(compFricDegree), density=2600, label='spheres'))
O.materials.append(FrictMat(young=young, poisson=0.5, frictionAngle=0, density=0, label='walls'))
O.materials.append(CohFrictMat(young=1.325e8, poisson=0.40, density=900, frictionAngle=radians(10), normalCohesion=1.1e8, shearCohesion=1.1e8, momentRotationLaw=True, label='spheremat'))
L = 0.608  #length [m]
l = 0.304  #width [m]
nbL = 16+1  #number of nodes for the length	[#]
nbl = 8+1  #number of nodes for the width	[#]
r = 0.008/2	# L / 100.  #radius
color = [255. / 255., 102. / 255., 0. / 255.]
nodesIds = []
for i in range(0, nbL):
	for j in range(0, nbl):
		nodesIds.append(O.bodies.append(gridNode([i*L/nbL, 0.3, 0.15+j*l/nbl], r, wire=False, fixed=False, material='spheremat', color=color)))
a=[]
b=[]
#Create connection between the nodes
for i in range(0, len(nodesIds)):
	for j in range(i + 1, len(nodesIds)):
		dist = (O.bodies[i].state.pos-O.bodies[j].state.pos).norm()
		if (dist <= (L/nbL)*1.05):
			O.bodies.append(gridConnection(i, j, r, color=color))
			a=a+[(i,O.bodies[-1].id), (O.bodies[-1].id,j)]
			b=b+[(i,j)]
O.bodies.append(geom.facetBox((.45, .5, .3), (.45, .5, .3), wallMask=55, material='walls'))
sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (0.9, 0.2, 0.6), rMean=.05, rRelFuzz=.3)
sp.makeCloud((0, 0.4, 0), (0.9, 0.6, 0.6), rMean=.05, rRelFuzz=.3)
O.bodies.append([sphere(center, rad, material='spheres') for center, rad in sp])
vtkExporter = export.VTKExporter('/files/Geogrid/paraview1/geogrid')
def expo():
	vtkExporter.exportSpheres(what=dict(dist='b.state.pos.norm()',pos='b.state.pos'), ids=range(0,433)) 
	vtkExporter.exportInteractions(what=dict(kn='i.phys.kn', kr='i.phys.kr', ks='i.phys.ks'), ids=b)   ###Here I replace a and b 
	# vtkExporter.exportContactPoints(what={'nn': 'i.geom.normal'})
	# vtkExporter.exportPolyhedra(what=dict(n='b.state.pos.norm()'), ids=plate.id)
O.run(10000,True)
for i in range (0,nbl):
	O.bodies[i].state.blockedDOFs='x'
	O.bodies[i].state.vel = (rate,0,0)
O.run(15000,True)

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