/[escript]/trunk/modellib/py_src/mechanics.py
ViewVC logotype

Diff of /trunk/modellib/py_src/mechanics.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 840 by gross, Tue Sep 5 22:45:55 2006 UTC revision 841 by gross, Wed Sep 6 09:48:37 2006 UTC
# Line 74  class Mechanics(Model): Line 74  class Mechanics(Model):
74             # open PDE:             # open PDE:
75             self.__pde=LinearPDE(self.domain)             self.__pde=LinearPDE(self.domain)
76             self.__pde.setSolverMethod(self.__pde.DIRECT)             self.__pde.setSolverMethod(self.__pde.DIRECT)
77             self.__pde.setSymmetryOn()             # self.__pde.setSymmetryOn()
78    
79        def doStepPreprocessing(self,dt):        def doStepPreprocessing(self,dt):
80              """              """
# Line 90  class Mechanics(Model): Line 90  class Mechanics(Model):
90              self.displacement=self.__displacement_safe              self.displacement=self.__displacement_safe
91              self.stress=self.__stress_safe              self.stress=self.__stress_safe
92              self.velocity=self.__velocity_safe              self.velocity=self.__velocity_safe
             self.__velocity_old=self.__velocity_safe  
             self.__very_old_dt, self.__old_dt= self.__old_dt, dt  
93              # update geometry              # update geometry
94              self.domain.setX(self.__x+self.displacement)              self.domain.setX(self.__x+self.displacement)
95    
# Line 140  class Mechanics(Model): Line 138  class Mechanics(Model):
138            else:            else:
139               self.__diff,diff_safe=Lsup(self.stress-self.__stress_last),self.__diff               self.__diff,diff_safe=Lsup(self.stress-self.__stress_last),self.__diff
140               s_sup=Lsup(self.stress)               s_sup=Lsup(self.stress)
              # self.__diff,diff_safe=Lsup(self.du),self.__diff  
              # s_sup=Lsup(self.displacement)  
141               self.trace("stress max and increment :%e, %e"%(s_sup,self.__diff))               self.trace("stress max and increment :%e, %e"%(s_sup,self.__diff))
142               if self.__iter>2 and diff_safe<self.__diff:               if self.__iter>2 and diff_safe<self.__diff:
143                   raise IterationDivergenceError,"no improvement in stress iteration"                   raise IterationDivergenceError,"no improvement in stress iteration"
# Line 155  class Mechanics(Model): Line 151  class Mechanics(Model):
151             self.__temperature_safe=self.temperature             self.__temperature_safe=self.temperature
152             self.__stress_safe=self.stress             self.__stress_safe=self.stress
153             self.__velocity_safe=self.velocity             self.__velocity_safe=self.velocity
            self.__old_dt=dt  
154    
155        def getSafeTimeStepSize(self,dt):        def getSafeTimeStepSize(self,dt):
156             """             """
157             returns new step size             returns new step size
158             """             """
159             print self.__very_old_dt, self.__old_dt, dt             a=sup(length(self.velocity)/self.domain.getSize())
160             if self.__very_old_dt:             if a>0:
161                a=2*Lsup(self.velocity-self.__velocity_old)/(self.__very_old_dt+self.__old_dt)                return 1./a
               if a>0:  
                  print "new dt:= ",Lsup(self.velocity)/a*self.rel_tol,dt,self.__old_dt,a  
                  # return Lsup(self.displacement)/a*self.rel_tol  
                  return self.UNDEF_DT  
               else:  
                  return self.UNDEF_DT  
162             else:             else:
163                return self.UNDEF_DT                return self.UNDEF_DT
164    
# Line 275  class DruckerPrager(Mechanics): Line 264  class DruckerPrager(Mechanics):
264    
265             self.S=G*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3)) \             self.S=G*(swap_axes(k3Xk3,0,3)+swap_axes(k3Xk3,1,3)) \
266                   + (K-2./3*G)*k3Xk3 \                   + (K-2./3*G)*k3Xk3 \
267                   + sXk3-swap_axes(swap_axes(sXk3,1,2),2,3)   \                   + (sXk3-swap_axes(swap_axes(sXk3,1,2),2,3))   \
268                   + 1./2*(swap_axes(swap_axes(sXk3,0,2),2,3)   \                   + 1./2*(swap_axes(swap_axes(sXk3,0,2),2,3)   \
269                          -swap_axes(swap_axes(sXk3,0,3),2,3)   \                          -swap_axes(swap_axes(sXk3,0,3),2,3)   \
270                          -swap_axes(sXk3,1,2)                  \                          -swap_axes(sXk3,1,2)                  \

Legend:
Removed from v.840  
changed lines
  Added in v.841

  ViewVC Help
Powered by ViewVC 1.1.26