/[escript]/trunk/modellib/py_src/crustal/setups.py
ViewVC logotype

Diff of /trunk/modellib/py_src/crustal/setups.py

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

revision 997 by gross, Mon Feb 26 06:31:45 2007 UTC revision 1000 by gross, Wed Feb 28 00:34:42 2007 UTC
# Line 18  __url__="http://www.iservo.edu.au/esys/e Line 18  __url__="http://www.iservo.edu.au/esys/e
18  __version__="$Revision$"  __version__="$Revision$"
19  __date__="$Date$"  __date__="$Date$"
20    
21  from esys.escript.modelframe import Model  from esys.escript.modelframe import Model, ParameterSet
22  from esys.escript import *  from esys.escript import *
23  from esys.escript.linearPDEs import LinearPDE  from esys.escript.linearPDEs import LinearPDE
24  from mines import parse  from mines import parse
25    import numarray
26    
27  class MiningHistory(Model):  class MiningHistory(Model):
28      """      """
# Line 94  class DensityChange(Model): Line 95  class DensityChange(Model):
95           self.density_rate=Scalar(0.,Function(self.domain))           self.density_rate=Scalar(0.,Function(self.domain))
96           d={}           d={}
97           for i in self.__volumes:           for i in self.__volumes:
98              if self.mass_rate.has_key(i): d[i]=self.mass_rate[i]/self.__volumes[i]              if self.mass_rate.has_key(i): d[i]=-self.mass_rate[i]/self.__volumes[i]
99           self.tag_map.insert(self.density_rate,**d)           self.tag_map.insert(self.density_rate,**d)
100    
101  class LinearElasticStressChange(Model):  class LinearElasticStressChange(Model):
# Line 162  class LinearElasticStressChange(Model): Line 163  class LinearElasticStressChange(Model):
163      def doInitialStep(self):      def doInitialStep(self):
164          """          """
165          """          """
166            d=self.domain.getDim()
167          self.__pde.setValue(Y=-kronecker(Function(self.domain))[d-1]*9.81*self.density)          self.__pde.setValue(Y=-kronecker(Function(self.domain))[d-1]*9.81*self.density)
168          ddisp=self.__pde.getSolution()          ddisp=self.__pde.getSolution()
169          deps=symmetric(grad(ddisp))          deps=symmetric(grad(ddisp))
# Line 175  class LinearElasticStressChange(Model): Line 177  class LinearElasticStressChange(Model):
177      def terminateIteration(self):      def terminateIteration(self):
178          return not self.__first          return not self.__first
179    
180      def doInitialStepPostprocessing(self):      def doInitialPostprocessing(self):
181          self.__stress=self.stress          self.__stress=self.stress
182          self.__displacement=self.displacement          self.__displacement=self.displacement
183            self.trace("initial displacement range : %s: %s"%(inf(self.displacement[2]),sup(self.displacement[2])))
184            self.trace("initial stress range : %s: %s"%(inf(self.stress),sup(self.stress)))
185    
186      def doStepPreprocessing(self,dt):      def doStepPreprocessing(self,dt):
187          self.stress=self.__stress          self.stress=self.__stress
188          self.displacement=self.__displacement          self.displacement=self.__displacement
189          self.__first=True          self.__first=True
190                    
191      def doStep(self):      def doStep(self,dt):
192          """          """
193          """          """
194            d=self.domain.getDim()
195          if not self.density_rate == None:          if not self.density_rate == None:
196             self.__pde.setValue(Y=-kronecker(Function(self.domain))[d-1]*9.81*self.density_rate)             self.__pde.setValue(Y=-kronecker(Function(self.domain))[d-1]*9.81*self.density_rate)
197          ddisp=self.__pde.getSolution()          ddisp=self.__pde.getSolution()
# Line 198  class LinearElasticStressChange(Model): Line 203  class LinearElasticStressChange(Model):
203      def doStepPostprocessing(self, dt):      def doStepPostprocessing(self, dt):
204          self.__stress=self.stress          self.__stress=self.stress
205          self.__displacement=self.displacement          self.__displacement=self.displacement
206            self.trace("displacement range : %s: %s"%(inf(self.displacement[2]),sup(self.displacement[2])))
207            self.trace("stress range : %s: %s"%(inf(self.stress),sup(self.stress)))
208    
209    class CoulombFailureStress(ParameterSet):
210        """
211        calculates the Coulomb failure stress an planes of a given orientation.
212    
213        @ivar domain: mining region
214        @type domain: L{Domian}
215        @ivar tag_map: a tagmap
216        @type tag_map: L{TagMap}
217        @ivar displacement: displacement field
218        @type displacement: L{Vector} or C{None}
219        @ivar stress: displacement field
220        @type stress: L{Vector}  or C{None}
221        @ivar density: initial density distribution
222        @type density: C{float} or L{Scalar}
223        @ivar density_rate: density rate by tag (may be changed of time)
224        @type density_rate:  C{dict}
225        @ivar lame_lambda: elasticity coefficient lambda (assumed to be constant over time)
226        @type lame_lambda: C{float} or L{Scalar}
227        @ivar lame_mu: elasticity coefficient mu (assumed to be constant over time)
228        @type lame_mu: C{float} or L{Scalar}
229        @ivar location_of_fixed_displacement: mask of locations and component with zero displacements
230        @type location_of_fixed_displacement: L{Vector} or C{None}
231        """
232        def __init__(self,**kwargs):
233            """
234            """
235            super(CoulombFailureStress,self).__init__(**kwargs)
236            self.declareParameter(stress=numarray.zeros((3,3)),
237                                  friction_coefficient=0.,
238                                  normal=numarray.array([1.,0.,0.]))
239        def cfs(self):
240            """
241            returns  Coulomb failure stress
242            """
243            sn=matrixmult(self.stress,self.normal)
244            nsn=inner(self.normal,sn)
245            nssn=inner(sn,sn)
246            return (sqrt(nssn-nsn**2)-self.friction_coefficient*nsn)/length(self.normal)
247    

Legend:
Removed from v.997  
changed lines
  Added in v.1000

  ViewVC Help
Powered by ViewVC 1.1.26