/[escript]/trunk/doc/examples/usersguide/slip.py
ViewVC logotype

Annotation of /trunk/doc/examples/usersguide/slip.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2654 - (hide annotations)
Tue Sep 8 07:11:12 2009 UTC (11 years ago) by gross
File MIME type: text/x-python
File size: 2283 byte(s)
2D fault systems are now working. 3D still needs work.
1 gross 2654
2     ########################################################
3     #
4     # Copyright (c) 2003-2009 by University of Queensland
5     # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
7     #
8     # Primary Business: Queensland, Australia
9     # Licensed under the Open Software License version 3.0
10     # http://www.opensource.org/licenses/osl-3.0.php
11     #
12     ########################################################
13    
14     __copyright__="""Copyright (c) 2003-2009 by University of Queensland
15     Earth Systems Science Computational Center (ESSCC)
16     http://www.uq.edu.au/esscc
17     Primary Business: Queensland, Australia"""
18     __license__="""Licensed under the Open Software License version 3.0
19     http://www.opensource.org/licenses/osl-3.0.php"""
20     __url__="https://launchpad.net/escript-finley"
21    
22    
23     from esys.escript import *
24     from esys.escript.linearPDEs import LinearPDE
25     from esys.escript.models import FaultSystem
26     from esys.finley import Rectangle
27     #... set some parameters ...
28     lam=1.
29     mu=1
30     slip_max=1.
31     fault_start=[0.5,0.25]
32     fault_end=[0.5,0.75]
33    
34     mydomain = Rectangle(l0=1.,l1=1.,n0=16, n1=16) # n1 need to be multiple of 4!!!
35     # .. create the fault system
36     fs=FaultSystem(dim=2)
37     fs.addFault(top=[fault_start, fault_end], tag=1)
38     # ... create a slip distribution on the fault:
39     p, m=fs.getParametrization(mydomain.getX(),tag=1)
40     p0,p1= fs.getW0Range(tag=1)
41     s=m*(p-p0)*(p1-p)/((p1-p0)/2)**2*slip_max*[0.,1.]
42     # ... calculate stress according to slip:
43     D=symmetric(grad(s))
44     chi, d=fs.getSideAndDistance(D.getFunctionSpace().getX(),tag=1)
45     sigma_s=(mu*D+lam*trace(D)*kronecker(mydomain))*chi
46     #... open symmetric PDE ...
47     mypde=LinearPDE(mydomain)
48     mypde.setSymmetryOn()
49     #... set coefficients ...
50     C=Tensor4(0.,Function(mydomain))
51     for i in range(mydomain.getDim()):
52     for j in range(mydomain.getDim()):
53     C[i,i,j,j]+=lam
54     C[j,i,j,i]+=mu
55     C[j,i,i,j]+=mu
56     # ... fix displacement in normal direction
57     x=mydomain.getX()
58     msk=whereZero(x[0])*[1.,0.] + whereZero(x[0]-1.)*[1.,0.] \
59     +whereZero(x[1])*[0.,1.] + whereZero(x[1]-1.)*[0.,1.]
60     mypde.setValue(A=C,X=-0.5*sigma_s,q=msk)
61     #... solve pde ...
62     mypde.getSolverOptions().setVerbosityOn()
63     v=mypde.getSolution()
64     # .. write the displacement to file:
65     D=symmetric(grad(v))
66     sigma=(mu*D+lam*trace(D)*kronecker(mydomain))+0.5*sigma_s
67     saveVTK("slip.vtu",disp=v+0.5*chi*s, stress= sigma)

  ViewVC Help
Powered by ViewVC 1.1.26