← Back to team overview

yade-users team mailing list archive

Re: [Question #432837]: how to get stress values with VTKExporter

 

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

Gary Pekmezi posted a new comment:
Thanks for the reply Jan,

I was able to get the output I needed otherwise. However, I did go back
and created a MWE to replicate the issue. My problem seems to stem from
loading a saved simulation. The MWE below replicates it after saving
then reloading a self-contained simulation.


from yade import pack,export
############################################
###             DEFINING SCENE           ###
############################################
O.materials.append(FrictMat(young=15e6,
                            poisson=0.4,
                            frictionAngle=radians(20),
                            density=2600,
                            label='spheres'))
O.materials.append(FrictMat(young=15e6,
                            poisson=0.4,
                            frictionAngle=0,
                            density=0,
                            label='walls'))
sp=pack.SpherePack()
mn,mx=Vector3(0,0,0),Vector3(10,10,10)
sp.makeCloud(minCorner=mn,maxCorner=mx,rRelFuzz=.2,num=600)
walls=aabbWalls([mn,mx],thickness=0,oversizeFactor=2.0,material='walls')
wallIds=O.bodies.append(walls)
sp.toSimulation(material='spheres')
#######################################
###          CONFINE THE MODEL      ###
#######################################
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
	InteractionLoop(
        	  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
                  [Ip2_FrictMat_FrictMat_MindlinPhys(label='mindlinContact',
              							betan=0.20,
              							betas=0.05)],
                  [Law2_ScGeom_MindlinPhys_Mindlin(label="mindlinLaw2",
              							neverErase=False)], ),
	GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5),
	TriaxialStressController(thickness = -1,stressMask = 7,label="triax"),
	NewtonIntegrator(damping=.4)
]

triax.goal1=triax.goal2=triax.goal3=-50e3
while 1:	
  O.run(1000, True) 
  unb=unbalancedForce()
  triDiff=abs((triax.goal1-triax.meanStress)/(triax.goal1))
  if unb<0.05 and triDiff<0.05:
  	break
O.save('confinedState.yade.gz')                      
O.load('confinedState.yade.gz')
#######################################
###     EXPORT STRESSES IN MODEL    ###
#######################################
s=bodyStressTensors()
for b in O.bodies:
    b.mystress=s[b.id]
vtkExporter = export.VTKExporter("stress.vtk")
vtkExporter.exportSpheres(what=[('stress','b.mystress')])

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