/[escript]/trunk/doc/examples/cookbook/wavesolver2d001.py
ViewVC logotype

Annotation of /trunk/doc/examples/cookbook/wavesolver2d001.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3892 - (hide annotations)
Tue Apr 10 08:57:23 2012 UTC (6 years, 10 months ago) by jfenwick
File MIME type: text/x-python
File size: 1953 byte(s)
Merged changes across from the attempt2 branch.
This version builds and passes python2 tests.
It also passes most python3 tests.



1 ahallam 2427
2     ########################################################
3     #
4 jfenwick 2881 # Copyright (c) 2009-2010 by University of Queensland
5 ahallam 2427 # 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 jfenwick 2881 __copyright__="""Copyright (c) 2009-2010 by University of Queensland
15 ahallam 2427 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     # You can shorten the execution time by reducing variable tend from 60 to 0.5
23    
24     # Importing all the necessary modules required.
25     from esys.escript import *
26     from esys.finley import Rectangle
27     import sys
28     import os
29 gross 2907 from cblib1 import wavesolver2d
30 ahallam 2427
31 ahallam 2443 # Establish a save path.
32 ahallam 2460 savepath = "data/wavesolver2d001nwtest"
33 gross 2907 mkDir(savepath)
34 ahallam 2427
35 ahallam 2443
36 ahallam 2427 #Geometric and material property related variables.
37 ahallam 2469 mx = 1000 # model lenght
38     my = 200 # model width
39     ndx = 200 # steps in x direction
40     ndy = 40 # steps in y direction
41 ahallam 2427 lam=3.462e9 #lames constant
42     mu=3.462e9 #bulk modulus
43     rho=1154. #density
44     # Time related variables.
45 ahallam 2469 tend=0.5 #end time
46 ahallam 2427 #calculating )the timestep
47     h=(1./5.)*sqrt(rho/(lam+2*mu))*(mx/ndx)
48     #Check to make sure number of time steps is not too large.
49 jfenwick 3892 print("Time step size= ",h, "Expected number of outputs= ",tend/h)
50 jfenwick 2667
51     #uncomment the following lines to give the user a chance to stop
52     #proceeder = raw_input("Is this ok?(y/n)")
53 ahallam 2427 #Exit if user thinks too many outputs.
54 jfenwick 2667 #if proceeder == "n":
55     # sys.exit()
56 ahallam 2427
57     U0=0.01 # amplitude of point source
58     # spherical source at middle of bottom face
59    
60 ahallam 2469 xc=[300,200]
61 ahallam 2427
62     mydomain=Rectangle(l0=mx,l1=my,n0=ndx, n1=ndy)
63     wavesolver2d(mydomain,h,tend,lam,mu,rho,U0,xc,savepath)
64    

  ViewVC Help
Powered by ViewVC 1.1.26