← Back to team overview

yade-users team mailing list archive

Re: [Question #404328]: contact position at the end of the simulation

 

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

Yor1 posted a new comment:
Hello Jan and Bruno,

Thank you for your answers.
To resolve the problem, i put a loop with the condition inside a function with pyrunner like this :

O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb(aabbEnlargeFactor=intR,label='Saabb')]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR,label='SSgeom'),Ig2_Box_Sphere_ScGeom()],
		[Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
		[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(recordCracks=True,Key=OUT,label='interactionLaw')]
	),
        TriaxialStressController(internalCompaction=False,label='triax'),
        GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.4, defaultDt=0.1*utils.PWaveTimeStep()),
        NewtonIntegrator(damping=DAMP,label="newton"),
        PyRunner(iterPeriod=int(saveData),initRun=True,command='recorder()',label='data'),
        PyRunner(firstIterRun=iterMax,initRun=True,command='position()',label='position')

x1=x2=x3=0
def position():    
    global x1,x2,x3
    
    for j in O.interactions:
      if not j.isReal : continue
      if isinstance(O.bodies[j.id1].shape,Sphere) and isinstance(O.bodies[j.id2].shape,Sphere):
	x1=j.geom.contactPoint[0]
	x2=j.geom.contactPoint[1]
	x3=j.geom.contactPoint[2]
	yade.plot.addData(x1=x1,x2=x2,x3=x3)
    plot.saveDataTxt(OUT1)

with these lines i obtain the text file when O.iter=iterMax but the problem is that i don't obtain the coordiantes in file text and i don't understand the origin of the error, in the loop i put the coordinates but in the file i don't obtain them.
The script improved is blow
https://filex.univ-lorraine.fr/get?k=rLbLreQcfBFv94hXaEZ

Best regards
Jabrane

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