← Back to team overview

yade-users team mailing list archive

[Question #247465]: Shear force histogram

 

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

hi all, I want to create shear force histogram. So I thought of the following script to use for calculation and plotting the shear force histogram. my question is that is the algorithm presneted correct or not? thank for you help.
my script:

def Sintrhisto():
	# axis normal to the plane in which we do the histogram
	pylab.clf()	
	axis=2 # x, i.e. plot the xy plane
	ax1,ax2=(axis+0)%3,(axis+1)%3 ## get the other two indices, i.e. 0 and 1 in this case
	angles,forces=[],[]
	for z in O.interactions:
		if not z.isReal: continue
		if z.id1<6 or z.id2<6: continue
		norm=z.geom.normal
		if norm[ax1]==0:
			angle=0
			force=z.phys.normalForce.norm()
		else:		
			angle=atan(norm[ax2]/norm[ax1])
			force=z.phys.shearForce.norm()
		angles.append(angle+pi/2)
		forces.append(force*10e-6)
	pylab.figure()
	values,bins=numpy.histogram(angles,weights=forces,bins=30)
	subp=pylab.subplot(111,polar=True)	
	pylab.bar(left=bins[:-1],height=values,width=np.pi/(1.05*30),alpha=.7,label=['xy'])
	pylab.xlabel('Shear Force Histogram-XY Plane')
	pylab.plot()
	pylab.savefig("interaction histogram-shear.JPEG")

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.