← Back to team overview

yade-users team mailing list archive

Re: [Question #689131]: Basic Problem using parallel run in Yade

 

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

    Status: Answered => Open

Rioual is still having a problem:
.... OK, here is a self contained shorter script that reproduces the
problem, I got rid of the stl importations.

Thanks for your feed-back,
Best,
Vincent,

#***************************************************************
#SCRIPT:
#***************************************************************


#gravity deposition (1), (2) continuing with oedometric test after stabilization (3)

# load parameters from file if run in batch
# default values are used if not run from batch
readParamsFromTable(rMean=0.005,rRelFuzz=0.002,maxLoad=1e7,minLoad=1e5)
# make rMean, rRelFuzz, maxLoad accessible directly as variables later
from yade.params.table import *

# create box with free top, and ceate loose packing inside the box
from yade import pack, plot

## PhysicalParameters 
Density=2400
frictionAngle=radians(25)
tc = 0.01
en = 0.0001
et = 0.0001

## Import wall's geometry
facetMat=O.materials.append(ViscElMat(frictionAngle=frictionAngle,tc=tc, en=en, et=et)) 
sphereMat=O.materials.append(ViscElMat(density=Density,frictionAngle=frictionAngle,tc=tc,en=en,et=et))
from yade import ymport


fctIdscylinder = O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=55,material=facetMat))

###########################################


sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=rMean,rRelFuzz=rRelFuzz)
sp.toSimulation(color=(0,0,1),material=sphereMat)


O.engines=[
	ForceResetter(),
	# sphere, facet, wall
	InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
	InteractionLoop(
		# the loading plate is a wall, we need to handle sphere+sphere, sphere+facet, sphere+wall
		[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
		[Ip2_FrictMat_FrictMat_FrictPhys()],
		[Law2_ScGeom_FrictPhys_CundallStrack()]
	),
	NewtonIntegrator(gravity=(0,-9.81,0),damping=0.1),
	# the label creates an automatic variable referring to this engine
	# we use it below to change its attributes from the functions called
	PyRunner(command='checkUnbalanced()',realPeriod=2,label='checker'),
]
O.dt=.5*PWaveTimeStep()

# the following checkUnbalanced, unloadPlate and stopUnloading functions are all called by the 'checker'
# (the last engine) one after another; this sequence defines progression of different stages of the
# simulation, as each of the functions, when the condition is satisfied, updates 'checker' to call
# the next function when it is run from within the simulation next time

# check whether the gravity deposition has already finished
# if so, add wall on the top of the packing and start the oedometric test

def checkUnbalanced():
	# at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable
	if O.iter<9000: return 
	# the rest will be run only if unbalanced is < .1 (stabilized packing)
	if unbalancedForce()>0.2: return


	# add plate at the position on the top of the packing
	
	fctIdsbouchonI = O.bodies.append(wall(max([b.state.pos[1]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)]),axis=1,material=facetMat))


	global fctIdsbouchon	

	fctIdsbouchon=[]
        fctIdsbouchon.append(fctIdsbouchonI)

        TransEngload=
TranslationEngine(ids=fctIdsbouchon,translationAxis=[0,-1,0],velocity=1,label='load')

        O.engines=O.engines+[TransEngload]

        global TransEngload

	# next time, do not call this function anymore, but the next one (unloadPlate) instead
	checker.command='unloadPlate()'

def unloadPlate():
	# if the force on plate exceeds maximum load, start unloading

        Fn = sum(O.forces.f(O.bodies[facetid].id)[1] for facetid in
fctIdsbouchon)

        if abs(Fn)>maxLoad:

		TransEngload.Velocity = 0
		TransEngunload = TranslationEngine(ids=fctIdsbouchon,translationAxis=[0,1,0],velocity=0.1,label='unload')
		O.engines=O.engines+[TransEngunload]
		# next time, do not call this function anymore, but the next one (stopUnloading) instead
		checker.command='stopUnloading()'

def stopUnloading():

        Fn = sum(O.forces.f(O.bodies[facetid].id)[1] for facetid in
fctIdsbouchon)

        if abs(Fn)<minLoad:

#	On supprime le bouchon
		for facet in fctIdsbouchon:
			O.bodies.erase(facet)

		O.save('init_Final_state_packing.yade')	# on enregistre le resultats de la simulation au format .yade 
		print '********fin de la construction de l''empilement***********' # impression d'un message de fin
		O.pause()


from yade import timing

O.run()

O.wait()

timing.stats()

#***************************************************************
#END SCRIPT:
#***************************************************************

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