← Back to team overview

yade-users team mailing list archive

[Question #647595]: save and loading

 

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

Hello
I am a new user that is why this question may seems to be simple one. :)
I want to simulate a cylinder filled with spherical particles .  After reaching to specific unbal force cylindrical confining wall is going to move upward with specific velocity. I am going to look to the height of the particles after several steps with different material properties. 
I want to use two script files for it. At the first one particles are falling down due to gravity to fill the cylinder. At the second one cylinder is moving up. The problem is that after running the first part and saving it, loaded file at the second script is in initial state ( before particles fall). Can you help me to solve this problem.


from yade import pack,utils, plot,ymport,qt
#######################################################################################

fr = 0.455;rho=2650.0

Mat1 = O.materials.append(ViscElMat(kn=10.0e4,ks=10.0e4,frictionAngle=fr,density=rho))
Mat2 = O.materials.append(ViscElMat(kn=10.0e4,ks=10.0e4,frictionAngle=fr,density=rho))


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


# create Cylinder from facets
Cylinder_mo=O.bodies.append(geom.facetCylinder((0,0,5),1.0,height=10.0,segmentsNumber=15,wallMask=4,material=Mat1))
Wall_below=O.bodies.append(utils.wall(position=(0,0,0),axis=2,sense=0,material=Mat1))
# create empty sphere packing
# sphere packing is not equivalent to particles in simulation, it contains only the pure geometry
sp=pack.SpherePack()
# generate randomly spheres with uniform radius distribution
sp.makeCloud((-0.5,-0.5,0.0),(0.5,0.5,8.0),rMean=.05)
# add the sphere pack to the simulation
sp.toSimulation(material=Mat2)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
   InteractionLoop(
      # handle sphere+sphere and facet+sphere collisions
   [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
  
   # call the checkUnbalanced function (defined below) every 2 seconds
   #PyRunner(command='checkUnbalanced()',realPeriod=2),

   PyRunner(command='hightcontrol()',iterPeriod=50000),
  

  #TranslationEngine(translationAxis=(0,0,1),velocity=0.05,ids=Cylinder_mo,label='trans'),
    NewtonIntegrator(gravity=(0,0,-9.81),damping=0.0),
    # call the addPlotData function every 200 steps
     PyRunner(command='addPlotData()',iterPeriod=100),
   ]



O.dt=.5*PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy['energyName'] subsequently
O.trackEnergy=True

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
####################################################################
#def checkUnbalanced():
  # if unbalancedForce()<.01:
     # O.pause()
     # plot.saveDataTxt('bbb.txt.bz2')
      #plot.saveGnuplot('bbb') is also possible
####################################################################
####################################################################
def hightcontrol():
 for b in range(31,len(O.bodies)):
 # if isinstance(O.bodies[b],Sphere):
   if O.bodies[b].state.pos[2]>0.5:
      O.bodies.erase(b);
     # O.pause()
     # plot.saveDataTxt('bbb.txt.bz2')
      #plot.saveGnuplot('bbb') is also possible
#################################################################### 




# collect history of data which will be plotted
def addPlotData():
   # each item is given a names, by which it can be the unsed in plot.plots
   # the **O.energy converts dictionary-like O.energy to plot.addData arguments
   plot.addData(i=O.iter,unbalanced=unbalancedForce(),**O.energy)

# define how to plot data: 'i' (step number) on the x-axis, unbalanced force
# on the left y-axis, all energies on the right y-axis
# (O.energy.keys is function which will be called to get all defined energies)
# None separates left and right y-axis
plot.plots={'i':('unbalanced',None,O.energy.keys)}

# show the plot on the screen, and update while the simulation runs
plot.plot()
O.run(100000)
O.save('Mymodel2.yade')







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