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

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

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

trunk/esys2/modellib/py_src/flow.py revision 148 by jgs, Tue Aug 23 01:24:31 2005 UTC trunk/modellib/py_src/flow.py revision 628 by elspeth, Thu Mar 23 02:27:57 2006 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  from escript.escript import *  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
4  from escript.modelframe import Model,IterationDivergenceError                      http://www.access.edu.au
5  from escript.linearPDEs import LameEquation                  Primary Business: Queensland, Australia"""
6    __license__="""Licensed under the Open Software License version 3.0
7                 http://www.opensource.org/licenses/osl-3.0.php"""
8    
9    from esys.escript import *
10    from esys.escript.modelframe import Model,IterationDivergenceError
11    from esys.escript.linearPDEs import LameEquation
12    
13  class SteadyIncompressibleFlow(Model):  class SteadyIncompressibleFlow(Model):
14         """         """
15    
16                     \f[         M{-\left(\eta\left(v_{i,j}+v_{j,i}\right)\right)_{,j}+p_{,i}=F_i}
17                     -\left(\eta\left(v_{i,j}+v_{j,i}\right)\right)_{,j}+p_{,i}=F_i        
18                     \f]         M{\sigma_{ij}=2\eta D_{ij}-p\,\delta_{ij}}
19    
20                     \f[         M{D_{ij}=\frac{1}{2}\left( v_{j,i} + v_{i,j }\right)}
21                     \sigma_{ij}=2\eta D_{ij}-p\,\delta_{ij}        
22                     \f[         M{v_{k,k} = 0}
                    D_{ij}=\frac{1}{2}\left( v_{j,i} + v_{i,j }\right) \; .  
                    \f]  
   
                    \f[  
                    -v_{k,k} = 0 \; .  
                    \f]  
23    
24         """         """
25    
26         def __init__(self,debug=False):         def __init__(self,debug=False):
27             """set up model"""             """
28               set up model
29               """
30             Model.__init__(self,debug=debug)             Model.__init__(self,debug=debug)
31             self.declareParameter(domain=None, \             self.declareParameter(domain=None, \
32                                   velocity=0., \                                   velocity=0., \
# Line 37  class SteadyIncompressibleFlow(Model): Line 39  class SteadyIncompressibleFlow(Model):
39             self.__iter=0             self.__iter=0
40    
41         def doInitialization(self):         def doInitialization(self):
42             """initialize model"""             """
43               initialize model
44               """
45             self.__p_old=None             self.__p_old=None
46             self.__p_very_old=None             self.__p_very_old=None
47             self.__dt_old=None             self.__dt_old=None
48             self.__pde=LameEquation(self.domain)             self.__pde=LameEquation(self.domain)
49    
50         def stress(self):         def stress(self):
51             """returns current stress"""             """
52               returns current stress"""
53             return 2*self.viscosity*self.stretching-self.pressure*kronecker(self.domain)             return 2*self.viscosity*self.stretching-self.pressure*kronecker(self.domain)
54    
55         def stretching(self):         def stretching(self):
56             """returns stertching tensor"""             """
57               returns stertching tensor
58               """
59             g=grad(self.velocity)             g=grad(self.velocity)
60             return (g+transpose(g))/2             return (g+transpose(g))/2
61    
62         def doStepPreprocessing(self,dt):         def doStepPreprocessing(self,dt):
63              """              """
64                 step up pressure iteration              step up pressure iteration
65    
66                 if run within a time dependend problem extrapolation of pressure from previous time steps is used to              if run within a time dependend problem extrapolation of pressure from previous time steps is used to
67                 get an initial guess (that needs some work!!!!!!!)              get an initial guess (that needs some work!!!!!!!)
68              """              """
69              self.__iter=0              self.__iter=0
70              self.__diff=1.e40              self.__diff=1.e40
# Line 70  class SteadyIncompressibleFlow(Model): Line 77  class SteadyIncompressibleFlow(Model):
77         def doStep(self,dt):         def doStep(self,dt):
78            """            """
79    
80               performs an iteration step of the penalty method.            performs an iteration step of the penalty method.
81               IterationDivergenceError is raised if pressure error cannot be reduced or max_iter is reached.            IterationDivergenceError is raised if pressure error cannot be reduced or max_iter is reached.
82    
83            """            """
84            penalty=self.viscosity/self.relaxation            penalty=self.viscosity/self.relaxation

Legend:
Removed from v.148  
changed lines
  Added in v.628

  ViewVC Help
Powered by ViewVC 1.1.26