nicogodet

Untitled

Jun 29th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.96 KB | None | 0 0
  1. ########################################## encoding: utf-8 #######################################
  2. #-*- coding: utf-8 -*-
  3. from yade import plot,qt
  4. from yade.gridpfacet import *
  5. import math
  6.  
  7. O.dt = 0.000001
  8.  
  9. Rad = 0.1
  10. Factor=1.5
  11. m_viscosity=3
  12. m_roughness=0.02
  13.  
  14. MaskCyl = 3
  15. MaskCollider = 2
  16.  
  17. E1_1 = 500e6
  18. E2_1 = 1460e6
  19. Ef_1 = 5869.565e6
  20. Defini_1 = 0.0001
  21. Def1_1 = 0.060
  22. Def2_1 = 0.015+Def1_1
  23. Deff_1 = 0.041+Def2_1
  24. SSVal_Simple=[(Defini_1,2*Defini_1*Ef_1),(Def1_1,Def1_1*E1_1),(Def2_1,Def2_1*E2_1),(Deff_1,2*Deff_1*Ef_1)]#[(0.0001,5.09e6),(0.030,50e6),(0.043,155e6),(0.067,1250e6)]
  25.  
  26. O.materials.append( WireMat( young=5e9,poisson=0.3,frictionAngle=radians(10),density=7850,diameter=2*0.006,isDoubleTwist=False,label='gridNodeNetPackSimple',strainStressValues=SSVal_Simple) ) # Material to create the GridNode
  27.  
  28. O.materials.append(
  29. FrictMat(
  30. density=2500,
  31. frictionAngle=math.radians(35.),
  32. poisson=0.2,
  33. young=1e7,
  34. label='Frict'
  35. ))
  36.  
  37.  
  38. #S1 = O.bodies.append(sphere(center=[0,0,0],radius=Rad,material='Frict',fixed=True))
  39. S2 = O.bodies.append(sphere(center=[1.5*Rad,0,Factor*2.1*Rad],radius=Rad,material='Frict',fixed=False))
  40. Stest = O.bodies.append(sphere(center=[1.5*Rad,0,3*Factor*2.1*Rad],radius=Rad,material='Frict',fixed=False))
  41. #S3 = O.bodies.append(sphere(center=[0,((Factor+0.05)*2*Rad),0],radius=Rad,material=material,fixed=False))
  42. #S4 = O.bodies.append(sphere(center=[0,0,-((Factor+0.05)*2*Rad)],radius=Rad,material=material,fixed=False))
  43. W1 = O.bodies.append(aabbWalls([(4*Rad,-2*Rad,10*Rad),(0,-2*Rad,0)],thickness=0.,material='Frict',oversizeFactor=1.0))
  44. #for i in W1[:-1]:
  45. # O.bodies.erase(i)
  46.  
  47. G1 = O.bodies.append(gridNode([0,0,0],radius = Rad/4.,material='gridNodeNetPackSimple',fixed=True))
  48. G2 = O.bodies.append(gridNode([+3*Rad,0,0],radius = Rad/4.,material='gridNodeNetPackSimple',fixed=True))
  49. G3 = O.bodies.append(gridNode([+1.5*Rad,-1.5*Rad,0],radius = Rad/4.,material='gridNodeNetPackSimple',fixed=True))
  50. C1 = O.bodies.append(gridConnection(G1,G2,radius = Rad/4.,material='Frict', mask = MaskCyl))
  51. C2 = O.bodies.append(gridConnection(G2,G3,radius = Rad/4.,material='Frict', mask = MaskCyl))
  52. C3 = O.bodies.append(gridConnection(G1,G3,radius = Rad/4.,material='Frict', mask = MaskCyl))
  53.  
  54. #O.bodies[S2].state.vel[2]=-3.
  55. #O.bodies[Stest].state.vel[2]=-10.
  56. #O.bodies[S3].state.vel[1]=-5.
  57. #O.bodies[S4].state.vel[2]=5.
  58.  
  59.  
  60. theta_method= 0.55 #1 : Euler Backward, 0.5 : trapezoidal rule, 0 : not used, 0.55 : suggested optimum
  61. resolution=1 #Change normal component resolution method, 0: Iterative exact resolution (theta method, linear contact), 1: Newton-Rafson dimentionless resolution (theta method, linear contact), 2: Newton-Rafson with nonlinear surface deflection (Hertzian-like contact)
  62. NewtonRafsonTol = 1e-6 #Precision of the resolution of Newton-Rafson's method
  63. O.engines=[
  64. ForceResetter(),
  65. InsertionSortCollider(
  66. [
  67. Bo1_Sphere_Aabb(aabbEnlargeFactor=Factor, label="aabb"),
  68. Bo1_Box_Aabb(),
  69. Bo1_Wall_Aabb(),
  70. Bo1_GridConnection_Aabb()
  71. ],
  72. verletDist=-0.1,
  73. allowBiggerThanPeriod=False),
  74.  
  75. InteractionLoop(
  76. [Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=Factor,label="Ig2"),
  77. Ig2_Box_Sphere_ScGeom6D(),
  78. Ig2_GridNode_GridNode_GridNodeGeom6D(),
  79. Ig2_Sphere_GridConnection_ScGridCoGeom()
  80. ],
  81.  
  82. [#Ip2_FrictMat_FrictMat_FrictPhys(),
  83. Ip2_WireMat_WireMat_WirePhys(),
  84. Ip2_FrictMat_FrictMat_LubricationPhys(eta=m_viscosity,eps=m_roughness),
  85. ],
  86.  
  87. [
  88. Law2_ScGeom_ImplicitLubricationPhys(activateNormalLubrication=True,
  89. activateTangencialLubrication=True,
  90. activateTwistLubrication=False,
  91. activateRollLubrication=False,
  92. theta=theta_method,
  93. resolution=resolution,
  94. NewtonRafsonTol=NewtonRafsonTol,
  95. warnedOnce=True,
  96. maxSubSteps=20,
  97. debug=False,),
  98. Law2_ScGeom_WirePhys_WirePM(),
  99. Law2_ScGeom_FrictPhys_CundallStrack(),
  100. ]
  101. ),
  102. NewtonIntegrator(damping=0.,gravity=[0,-5,-5]),
  103. ]
  104.  
  105. collider.avoidSelfInteractionMask = MaskCollider
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112. #def maf():
  113. # if (O.bodies[S2].state.pos[2]-O.bodies[S1].state.pos[2])<2*Rad+0.02:
  114. # O.bodies[S2].state.vel[2]=0.
  115. # O.bodies[S2].state.blockedDOFs='xyzXYZ'
  116.  
  117. #maxFnL=0.
  118. #Ekin=0.5*O.bodies[S2].state.mass*O.bodies[S2].state.vel.norm()**2
  119. #Epot=O.bodies[S2].state.mass*9.81*(O.bodies[S2].state.pos[2]-O.bodies[S1].state.pos[2])
  120. #Etot=Ekin+Epot
  121. #def addPlotData():
  122. # global maxFnL,Etot,Ekin,Epot
  123. # try:
  124. # Fnc = O.interactions[0,1].phys.normalContactForce[2]
  125. # FnL = O.interactions[0,1].phys.normalLubricationForce[2]
  126. # maxFnL=max(maxFnL,FnL)
  127. # except:
  128. # Fnc=0
  129. # FnL=0
  130. # try:
  131. # O.interactions[0,1].isActive
  132. # active=1
  133. # except:
  134. # active=0
  135. # Ekin=0.5*O.bodies[S2].state.mass*O.bodies[S2].state.vel.norm()**2
  136. # Epot=O.bodies[S2].state.mass*9.81*(O.bodies[S2].state.pos[2]-O.bodies[Stest].state.pos[2])
  137. # Etot=Ekin+Epot
  138. # if (O.bodies[S2].state.pos[2]-O.bodies[Stest].state.pos[2]-2*Rad)<0:
  139. # pene=O.bodies[S2].state.pos[2]-O.bodies[Stest].state.pos[2]-2*Rad
  140. # else:
  141. # pene=0
  142. #
  143.  
  144. # delta = (O.bodies[S2].state.pos[2]-O.bodies[Stest].state.pos[2])-(2*Factor*Rad)
  145. # deltaDot = O.bodies[S2].state.vel[2] - O.bodies[Stest].state.vel[2]
  146. # plot.addData(delta=delta, time1=O.time, time2=O.time, time3=O.time, time4=O.time,Fnc = Fnc,FnL = FnL,deltaDot = deltaDot,active=active,Ekin=Ekin,Epot=Epot,Etot=Etot,pene=pene)
  147.  
  148. #addPlotData()
  149. #plot.plots={'time1':('delta',None,'active'), 'time2':('deltaDot'), 'time3':('Fnc',None,('FnL','g')), 'time4':('pene')}
  150. ##plot.plots={'time4':('Fnc',None,('FnL','g')),'time1':'active'};
  151. #plot.plot(subPlots=True)
  152. #def stopMe():
  153. # if O.iter>10000 and O.bodies[S2].state.pos[2]>((Factor+0.05)*2*Rad):
  154. # O.pause()
  155. # plot.saveGnuplot('graphs/'+O.bodies[S1].material.label+'Lubrication_visco'+str(m_viscosity)+'_rought'+str(m_roughness),term='png',extension='png')
  156.  
  157. qt.View()
Add Comment
Please, Sign In to add comment