Advertisement
linkos

Untitled

Jan 18th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.60 KB | None | 0 0
  1. # e1=0.618
  2. # confinement stress / contrainte de confinement = 100000 Pa
  3. # ammount of particles: 1000
  4.  
  5. from yade import pack
  6.  
  7. # to create a table to use later
  8. nRead=utils.readParamsFromTable(
  9.     num_spheres=1000,# number of spheres (choose little to have faster result)
  10.     compFricDegree = 0, # contact friction during the confining phase, to avoid the "effet de voute"
  11.     unknownOk=True
  12. )
  13. from yade.params import table # import the table to the data
  14.  
  15. num_spheres=table.num_spheres # number of spheres
  16. targetPorosity = 0.382 #the porosity we want for the packing [indice des vides e=0.618, n=e/(e+1)]
  17. compFricDegree = table.compFricDegree # initial contact friction during the confining phase (will be decreased during the REFD compaction process)
  18. finalFricDegree = 35 # contact friction during the deviatoric loading
  19. rate=0.001 # loading rate (strain rate) initial value=0.02
  20. damp=0.2 # damping coefficient (initial value=0.2)
  21. stabilityThreshold=0.01 # we test unbalancedForce against this value in different loops (see below)
  22. key='_triax_base_' # put you simulation's name here
  23. young=356e6 # contact stiffness kn/Ds
  24. mn,mx=Vector3(-0.1,-0.1,-0.1),Vector3(0.1,0.1,0.1) # corners of the initial packing // page 87 Luc Sibille
  25. thick = 0.01 # thickness of the plates (chose whatever)
  26.  
  27. # create materials for spheres and plates
  28. # in this one poisson=k_t/k_n=042
  29. O.materials.append(FrictMat(young=young,poisson=0.42,frictionAngle=radians(compFricDegree),density=3000,label='spheres'))
  30. O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
  31.  
  32. # the explanation of this definition is at the page 298 in the YADE.pdf
  33. # young and poisson are not always modulus of elasticity and possion coefficient, it depends on the IPhys (look in pdf)
  34.  
  35. # create walls around the packing
  36. walls=utils.aabbWalls([mn,mx],thickness=thick,material='walls') # one always includes the pair of vectors of dimension, mat and epaisseur
  37. wallIds=O.bodies.append(walls) # add it into modelisation
  38.  
  39. # use a SpherePack object to generate a random loose particles packing
  40. sp=pack.SpherePack()
  41. #psdSizes=[0.002,0.003,0.004,0.005,0.006,0.007,0.008,0.0092]
  42. #psdCumm=[0.01,0.09,0.25,0.5,0.69,0.9,0.95,1]
  43. psdSizes=[0.002,0.003,0.004,0.005,0.006,0.007,0.008,0.0092]
  44. psdCumm=[1,9,25,50,69,90,95,100]
  45. # sp.makeCloud(mn,mx,0.00575,0.065,num_spheres,False,porosity=0.3819,psdSizes=[0.002,0.003,0.004,0.005,0.006,0.007,0.008,0.0092],psdCumm=[0.01,0.09,0.25,0.5,0.69,0.9,0.95,1],False) # psd method
  46. # if that not works, try the answered question in YADE launchpad
  47. sp.particleSD(mn,mx,0.00575,True,'GiaHien',num_spheres,psdSizes,psdCumm,False,0)
  48. O.bodies.append([utils.sphere(center,rad,material='spheres') for center,rad in sp])
  49.  
  50. ############################
  51. ###   DEFINING ENGINES   ###
  52. ############################
  53.  
  54. triax=ThreeDTriaxialEngine(
  55.     maxMultiplier=1.01, # spheres growing factor (fast growth)
  56.     finalMaxMultiplier=1.001, # spheres growing factor (slow growth)
  57.     thickness = thick,
  58.     stressControl_1 = True, #switch stress/strain control
  59.     stressControl_2 = False, # on the axis 2 we will use imposed displacement method
  60.     stressControl_3 = True, # essayer a garder la contrainte de confinement
  61.     ## The stress used for (isotropic) internal compaction
  62.     sigma_iso = 100000,
  63.     ## Independant stress values for anisotropic loadings
  64.     internalCompaction=True, # If true the confining pressure is generated by growing particles
  65.     Key=key, # passed to the engine so that the output file will have the correct name
  66.     wallDamping=0.8,   
  67. )
  68.  
  69. #comp=TriaxialStressController(
  70. #   sigma1=100000,
  71. #   sigma3=100000,
  72. #)
  73.  
  74. newton=NewtonIntegrator(damping=damp)
  75.  
  76. O.engines=[
  77.     ForceResetter(),
  78.     InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
  79.     InteractionLoop(
  80.         [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
  81.         [Ip2_FrictMat_FrictMat_FrictPhys()],
  82.         [Law2_ScGeom_FrictPhys_CundallStrack()]
  83.     ),
  84.     GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
  85.     triax,
  86.     TriaxialStateRecorder(iterPeriod=100,file='WallStresses'+key),
  87.     newton
  88. ]
  89.  
  90. #Display spheres with 2 colors for seeing rotations better
  91. Gl1_Sphere.stripes=0
  92. if nRead==0: yade.qt.Controller(), yade.qt.View()
  93.  
  94. #######################################
  95. ###   APPLYING CONFINING PRESSURE   ###
  96. #######################################
  97.  
  98. while 1:
  99.   O.run(1000, True)
  100.   ##the global unbalanced force on dynamic bodies, thus excluding boundaries, which are not at equilibrium
  101.   unb=unbalancedForce()
  102.   ##average stress
  103.   ##note: triax.stress(k) returns a stress vector, so we need to keep only the normal component
  104.   meanS=(triax.stress(triax.wall_right_id)[0]+triax.stress(triax.wall_top_id)[1]+triax.stress(triax.wall_front_id)[2])/3
  105.   print 'unbalanced force:',unb,' mean stress: ',meanS
  106.   if unb<stabilityThreshold and abs(meanS-triax.sigma_iso)/triax.sigma_iso<0.001:
  107.     break
  108.  
  109. O.save('confinedState'+key+'.yade.gz')
  110. print "###      Isotropic state saved      ###"
  111. print "current porosity",triax.porosity
  112.  
  113.  
  114. ###################################################
  115. ###   REACHING A SPECIFIED POROSITY PRECISELY   ###
  116. ###################################################
  117.  
  118. import sys #this is only for the flush() below
  119. while triax.porosity>targetPorosity:
  120.     ## we decrease friction value and apply it to all the bodies and contacts
  121.     compFricDegree = 0.95*compFricDegree
  122.     setContactFriction(radians(compFricDegree))
  123.     print "\r Friction: ",compFricDegree," porosity:",triax.porosity,
  124.     sys.stdout.flush()
  125.     ## while we run steps, triax will tend to grow particles as the packing
  126.     ## keeps shrinking as a consequence of decreasing friction. Consequently
  127.     ## porosity will decrease
  128.     O.run(500,1)
  129.  
  130. O.save('compactedState'+key+'.yade.gz')
  131. print "###    Compacted state saved      ###"
  132.  
  133. ##############################
  134. ###   DEVIATORIC LOADING   ###
  135. ##############################
  136.  
  137. ##We move to deviatoric loading, let us turn internal compaction off to keep particles sizes constant
  138. triax.internalCompaction=False
  139. triax.isAxisymetric=True
  140. ## Change contact friction (remember that decreasing it would generate instantaneous instabilities)
  141. triax.setContactProperties(finalFricDegree)
  142.  
  143. ## We turn all these flags true, else boundaries will be fixed
  144. triax.wall_bottom_activated=False #fix the bottom plate
  145. triax.wall_top_activated=True
  146. triax.wall_left_activated=True
  147. triax.wall_right_activated=True
  148. triax.wall_back_activated=True
  149. triax.wall_front_activated=True
  150.  
  151. ##If we want a triaxial loading at imposed strain rate, let's assign srain rate instead of stress
  152. triax.stressControl_2=0 # for boolean variety, 1 means True and 0 means False
  153. triax.strainRate2=rate
  154. triax.sigma1=100000,
  155. triax.sigma2=0,
  156. triax.sigma3=100000,
  157. #wall_left_id=0 # coordinate 0-
  158. #wall_right_id=1 # coordinate 0+
  159. #wall_bottom_id=2 # coordinate 1-
  160. #wall_top_id=3 # coordinate 1+
  161. #wall_back_id=4 # id of boundary, coordinate 2+
  162. #wall_front_id=5 # coordinate 2+
  163.  
  164. ##Save temporary state in live memory. This state will be reloaded from the interface with the "reload" button.
  165. O.saveTmp()
  166.  
  167. #####################################################
  168. ###                  Plot data                    ###
  169. #####################################################
  170.  
  171. from yade import plot
  172.  
  173. ### a function saving variables
  174. def history():
  175.     plot.addData(e11=triax.strain[0], e22=triax.strain[1], e33=triax.strain[2],
  176.             ev=-triax.strain[0]-triax.strain[1]-triax.strain[2],
  177.             s11=triax.stress(triax.wall_right_id)[0],
  178.             s22=triax.stress(triax.wall_top_id)[1],
  179.             s33=triax.stress(triax.wall_front_id)[2],
  180.             q=abs(triax.stress(triax.wall_top_id)[1]-triax.stress(triax.wall_front_id)[2]),
  181.             i=O.iter)
  182.  
  183. if 1:
  184.   ## include a periodic engine calling that function in the simulation loop
  185.   O.engines=O.engines[0:5]+[PyRunner(iterPeriod=20,command='history()',label='recorder')]+O.engines[5:7]
  186.   ##O.engines.insert(4,PyRunner(iterPeriod=20,command='history()',label='recorder'))
  187. else:
  188.   ## With the line above, we are recording some variables twice. We could in fact replace the previous
  189.   ## TriaxialRecorder
  190.   ## by our periodic engine. Uncomment the following line:
  191.   O.engines[4]=PyRunner(iterPeriod=20,command='history()',label='recorder')
  192.  
  193. O.run(100,True)
  194.  
  195. ### declare what is to plot. "None" is for separating y and y2 axis
  196. #plot.plots={'i':('e11','e22','e33',None,'s11','s22','s33')}
  197. ### the traditional triaxial curves would be more like this:
  198. # plot.plots={'e22':('s11','s22','s33',None,'ev')}
  199. plot.plots={'e22':'q'}
  200. plot.saveGnuplot('04_withsave'+key) # awesome, save data and plot script at the same time
  201. ## display on the screen (doesn't work on VMware image it seems)
  202. plot.plot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement