/[escript]/trunk/finley/test/python/slip_stress.py
ViewVC logotype

Annotation of /trunk/finley/test/python/slip_stress.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 884 - (hide annotations)
Mon Oct 30 06:37:30 2006 UTC (13 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 2660 byte(s)
simple mesh generator for slip_stress
1 gross 883 # $Id$
2    
3     """
4     calculation of the stress distribution around a fault from the slip on the fault
5    
6 gross 884 e.g. use slip_stress_mesh.py to generate mesh
7    
8 gross 883 @var __author__: name of author
9     @var __copyright__: copyrights
10     @var __license__: licence agreement
11     @var __url__: url entry point on documentation
12     @var __version__: version
13     @var __date__: date of the version
14     """
15    
16 gross 884 __author__="Lutz Gross, Louise Kettle"
17 gross 883 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
18     http://www.access.edu.au
19     Primary Business: Queensland, Australia"""
20     __license__="""Licensed under the Open Software License version 3.0
21     http://www.opensource.org/licenses/osl-3.0.php"""
22     __url__="http://www.iservo.edu.au/esys"
23     __version__="$Revision$"
24     __date__="$Date$"
25    
26     from esys.escript import *
27     from esys.escript.pdetools import SaddlePointProblem
28     from esys.escript.linearPDEs import LinearPDE
29 gross 884 from esys.finley import ReadMesh
30 gross 883
31    
32 gross 884 rho=0.
33 gross 883 lam_lmbd=1.
34     lam_mu=1.
35     g=9.81
36    
37     class SlippingFault(SaddlePointProblem):
38     """
39     simple example of saddle point problem
40     """
41     def __init__(self,domain):
42     super(SlippingFault, self).__init__(self)
43     self.domain=domain
44     self.__pde_u=LinearPDE(domain,numEquations=self.domain.getDim(),numSolutions=self.domain.getDim())
45     self.__pde_u.setSymmetryOn()
46    
47     def initialize(self,density=1.,lmbd=1., mu=1., traction=Data(),fixed_u_mask=Data(), slip=0.):
48     d=self.domain.getDim()
49     self.slip=slip
50     A =self.__pde_u.createCoefficientOfGeneralPDE("A")
51     for i in range(self.domain.getDim()):
52     for j in range(self.domain.getDim()):
53     A[i,j,j,i] += mu
54     A[i,j,i,j] += mu
55     A[i,i,j,j] += lmbd
56     self.__pde_u.setValue(A=A,q=fixed_u_mask,Y=-kronecker(Function(self.domain))[d-1]*g*density,y=traction)
57    
58     def inner(self,p0,p1):
59 gross 884 return integrate(p0*p1,FunctionOnContactZero(self.domain))
60 gross 883
61     def solve_f(self,u,p,tol=1.e-8):
62     self.__pde_u.setTolerance(tol)
63 gross 884 self.__pde_u.setValue(y_contact=-p)
64 gross 883 return self.__pde_u.getSolution()
65    
66     def solve_g(self,u,tol=1.e-8):
67 gross 884 dp=-(self.slip-jump(u))
68 gross 883 return dp
69    
70    
71     s=numarray.array([0.,1.,1.])
72 gross 884 dom=ReadMesh("meshfault3D.fly")
73 gross 883 prop=SlippingFault(dom)
74     d=dom.getDim()
75     x=dom.getX()[d-1]
76     mask=whereZero(x-inf(x))*numarray.ones((d,))
77     u0=Vector(0.,Solution(dom))
78 gross 884 p0=Vector(1.,FunctionOnContactZero(dom))
79     prop.initialize(fixed_u_mask=mask,slip=Data(s,FunctionOnContactZero(dom)), density=rho,lmbd=lam_lmbd, mu=lam_mu)
80     u,p=prop.solve(u0,p0,iter_max=50,tolerance=0.01)
81 gross 883 saveVTK("dis.xml",u=u)
82     saveVTK("fault.xml",sigma=p,s=jump(u))

  ViewVC Help
Powered by ViewVC 1.1.26