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

trunk/doc/user/examples/wave.py revision 582 by lkettle, Wed Mar 8 05:54:06 2006 UTC temp_trunk_copy/doc/examples/wave.py revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC
# Line 1  Line 1
1
2    # You can shorten the execution time by reducing variable tend from 60 to 0.5
3
4  from esys.escript import *  from esys.escript import *
5  from esys.escript.pdetools import Locator  from esys.escript.pdetools import Locator
6  from esys.escript.linearPDEs import LinearPDE  from esys.escript.linearPDEs import LinearPDE
7  from esys.finley import Brick  from esys.finley import Brick
8  from numarray import identity,zeros,ones  from numarray import identity,zeros,ones
9
10    if not os.path.isdir("data"):
11       print "\nCreating subdirectory 'data'\n"
12       os.mkdir("data")
13
14  ne=32          # number of cells in x_0 and x_1 directions  ne=32          # number of cells in x_0 and x_1 directions
15  width=10000.  # length in x_0 and x_1 directions  width=10000.  # length in x_0 and x_1 directions
16  lam=3.462e9  lam=3.462e9
# Line 42  def wavePropagation(domain,h,tend,lam,mu Line 49  def wavePropagation(domain,h,tend,lam,mu
49     t=0     t=0
50
51     # define the location of the point source     # define the location of the point source
52     L=Locator(domain,xc)     L=Locator(domain,numarray.array(xc))
53     # find potential at point source     # find potential at point source
54     u_pc=L.getValue(u)     u_pc=L.getValue(u)
55     print "u at point charge=",u_pc     print "u at point charge=",u_pc
# Line 70  def wavePropagation(domain,h,tend,lam,mu Line 77  def wavePropagation(domain,h,tend,lam,mu
77       t+=h       t+=h
78       n+=1       n+=1
79       print n,"-th time step t ",t       print n,"-th time step t ",t
L=Locator(domain,xc)
80       u_pc=L.getValue(u)       u_pc=L.getValue(u)
81       print "u at point charge=",u_pc       print "u at point charge=",u_pc
82
# Line 83  def wavePropagation(domain,h,tend,lam,mu Line 89  def wavePropagation(domain,h,tend,lam,mu
89
90       # ... save current acceleration in units of gravity and displacements       # ... save current acceleration in units of gravity and displacements
91       if n==1 or n%10==0: saveVTK("./data/usoln.%i.vtu"%(n/10),acceleration=length(a)/9.81,       if n==1 or n%10==0: saveVTK("./data/usoln.%i.vtu"%(n/10),acceleration=length(a)/9.81,
92       displacement = length(u), Ux = u[0] )       displacement = length(u), tensor = stress, Ux = u[0] )
93
94     u_pc_data.close()     u_pc_data.close()
95

Legend:
 Removed from v.582 changed lines Added in v.1384