# Contents of /trunk/doc/examples/usersguide/wave.py

Revision 3379 - (show annotations)
Wed Nov 24 04:48:49 2010 UTC (8 years, 9 months ago) by gross
File MIME type: text/x-python
File size: 4309 byte(s)
```some clarification on lumping
```
 1 2 ######################################################## 3 # 4 # Copyright (c) 2003-2010 by University of Queensland 5 # Earth Systems Science Computational Center (ESSCC) 6 7 # 8 # Primary Business: Queensland, Australia 9 # Licensed under the Open Software License version 3.0 10 11 # 12 ######################################################## 13 14 __copyright__="""Copyright (c) 2003-2010 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 20 __url__= 21 22 from esys.escript import * 23 from esys.escript.pdetools import Locator 24 from esys.escript.linearPDEs import LinearPDE 25 from esys.dudley import Brick 26 from esys.weipa import saveVTK 27 from numpy import identity,zeros,ones 28 import matplotlib 29 30 matplotlib.use('agg') #For interactive use, you can comment out this line 31 #It's just here to make testing easier 32 33 import matplotlib.pyplot as plt 34 35 36 ne=32 # number of cells in x_0 and x_1 directions 37 width=10000. # length in x_0 and x_1 directions 38 lam=3.462e9 39 mu=3.462e9 40 rho=1154. 41 tend=10. # to ran a full simulation change tend to 60. 42 alpha=0.7 43 t0=3. 44 45 46 U0=1. # maximum displacement 47 mkDir("data") # create directory data if it does not exist already. 48 49 def wavePropagation(domain,h,tend,lam,mu,rho, xc, src_radius, U0): 50 # lists to collect displacement at point source 51 ts, u_pc0,u_pc1,u_pc2=[], [], [], [] 52 x=domain.getX() 53 # ... open new PDE ... 54 mypde=LinearPDE(domain) 55 mypde.getSolverOptions().setSolverMethod(mypde.getSolverOptions().HRZ_LUMPING) 56 kronecker=identity(mypde.getDim()) 57 58 dunit=numpy.array([1.,0.,0.]) # defines direction of point source 59 60 mypde.setValue(D=kronecker*rho, q=whereNegative(length(x-xc)-src_radius)*dunit) 61 # ... set initial values .... 62 n=0 63 # for first two time steps 64 u=Vector(0.,Solution(domain)) 65 u_last=Vector(0.,Solution(domain)) 66 t=0 67 68 # define the location of the point source 69 L=Locator(domain,xc) 70 # find potential at point source 71 u_pc=L.getValue(u) 72 print "u at point charge=",u_pc 73 ts.append(t); u_pc0.append(u_pc[0]), u_pc1.append(u_pc[1]), u_pc2.append(u_pc[2]) 74 75 while t

## Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/lapack2681/doc/examples/usersguide/wave.py:2682-2741 /branches/restext/doc/examples/usersguide/wave.py:2610-2624 /trunk/doc/examples/usersguide/wave.py:1388-2483