Advertisement
linkos

2nd state

Jun 17th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.06 KB | None | 0 0
  1. import os
  2. from yade import pack
  3.  
  4. dSnorm = 5000.0 #norm of the stress increment
  5. nbProbes = 36 #number of stress directions tested
  6. rampIte = 20 #nb iterations to increase the stress state until the final desired stress value
  7. stabIte = 5000 #nb iterations to stabilize sample after reaching the final stress value
  8. key='_probing_envelope_'
  9.  
  10. stabilityThreshold=0.001 # leave it too low can have a super stable state, but will eat onion for waiting so long
  11.  
  12.  
  13. triax=TriaxialStressController()
  14. stickLoad=triax.strain[1]
  15. REC=TriaxialStateRecorder()
  16. # an array for saving stress increments and strain responses; arrays are in "numpy" extension
  17. import numpy
  18. probings=numpy.zeros((3,nbProbes))
  19.  
  20. def increment(dsr=0,dsa=1):
  21. #   rampIte = 20
  22.     for ite in range(rampIte):# progressivaly increase of stress state
  23.         O.run(20, True)
  24.         #incrementation of stress state
  25.         triax.goal2 = initSa+dsa/rampIte*ite
  26.         triax.goal1 = triax.goal3 = initSr+dsr/rampIte*ite
  27.         print triax.goal1, triax.goal2, '(stress value)'
  28.  
  29.     # fix the stress value for stabilization at the final state
  30.     #REC.file=('WallStresses'+key2)
  31.     triax.goal2 = initSa+dsa
  32.     triax.goal1 = triax.goal3 = initSr+dsr
  33.  
  34.     while 1:
  35.         O.run(100, True)
  36.         unb=unbalancedForce()
  37.         print 'unbalanced force:',unb,' strain: ',triax.strain
  38.         O.save('checkpoint.xml') # reload this file to check if we see mistakes
  39.         if unb<stabilityThreshold: break
  40.  
  41.  
  42.  
  43. # loop over all the stress directions
  44. for i in range(nbProbes):
  45.  
  46.     # computation of the stress direction of the current stress probe
  47.     alphaS = 2*pi/nbProbes*(i-1)
  48.     print 'stress probe nb:',i,' stress direction (deg): ',degrees(alphaS)
  49.  
  50.     # computation of the stress increment in the axial direction
  51.     dSa = dSnorm*sin(alphaS)
  52.  
  53.     # computation of the stress increment in the radial direction
  54.     dSr = dSnorm*cos(alphaS)/sqrt(2.0)
  55.  
  56.     #Load the initial anisotropic state before running a new stress probe
  57.     O.load('firstpoint.xml')
  58.     #key2='_DIR%d'%i
  59.     #REC.file=('WallStresses'+key2)
  60.     triax.stressMask=7
  61.     triax.goal2=stickLoad
  62.     triax.goal1=triax.goal3=100000
  63.     #We redefine the "triax" label, else it would point to inactive engine from previous simulation that is still in memory
  64.     triax=O.engines[4]
  65.  
  66.     initSa=triax.goal2  #save of the initial axial stress
  67.     initSr=triax.goal1  #save of the initial radial stress
  68.  
  69.     # define the final stress state to be reached
  70.     finalSa = initSa+dSa
  71.     finalSr = initSr+dSr
  72.  
  73.     #... need to active stress control in 3 directions if not yet done
  74. #   triax.stressControl_1=triax.stressControl_2=triax.stressControl_3=True
  75.     triax.stressMask=7  # Hien: the previous is 7, that means the stress control is on, but the following code is focus on strain control so I turn this off
  76.  
  77.     # fix a high value of maximum strain rate, the progressive loading will be done by progressively increasing the desired stress state at each iteration
  78. #   triax.strainRate1=triax.strainRate2=triax.strainRate3=1000.0
  79. #   triax.goal1=triax.goal2=triax.goal3=1000.0 #!!!!!!
  80.     increment(dSr,dSa)
  81.     O.wait()
  82. #   O.save('Direction_%d.xml'%(i-1))
  83.     os.rename('WallStresses_probing_envelope_','Dir_%d'%(i-1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement