/[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 5707 - (hide annotations)
Mon Jun 29 03:59:06 2015 UTC (3 years, 7 months ago) by sshaw
File MIME type: text/x-python
File size: 2138 byte(s)
adding copyright headers to files without copyright info, moved header to top of file in some cases where it wasn't
1 jfenwick 3981 ##############################################################################
2 ahallam 2427 #
3 jfenwick 5593 # Copyright (c) 2009-2015 by The University of Queensland
4 jfenwick 3981 # http://www.uq.edu.au
5 ahallam 2427 #
6     # Primary Business: Queensland, Australia
7     # Licensed under the Open Software License version 3.0
8     # http://www.opensource.org/licenses/osl-3.0.php
9     #
10 jfenwick 3981 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11 jfenwick 4657 # Development 2012-2013 by School of Earth Sciences
12     # Development from 2014 by Centre for Geoscience Computing (GeoComp)
13 jfenwick 3981 #
14     ##############################################################################
15 sshaw 5707 from __future__ import division, print_function
16 ahallam 2427
17 jfenwick 5593 __copyright__="""Copyright (c) 2009-2015 by The University of Queensland
18 jfenwick 3981 http://www.uq.edu.au
19 ahallam 2427 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__="https://launchpad.net/escript-finley"
23    
24     # You can shorten the execution time by reducing variable tend from 60 to 0.5
25    
26     # Importing all the necessary modules required.
27     from esys.escript import *
28     from esys.finley import Rectangle
29     import sys
30     import os
31 gross 2907 from cblib1 import wavesolver2d
32 ahallam 2427
33 ahallam 2443 # Establish a save path.
34 ahallam 2460 savepath = "data/wavesolver2d001nwtest"
35 gross 2907 mkDir(savepath)
36 ahallam 2427
37 ahallam 2443
38 ahallam 2427 #Geometric and material property related variables.
39 ahallam 2469 mx = 1000 # model lenght
40     my = 200 # model width
41     ndx = 200 # steps in x direction
42     ndy = 40 # steps in y direction
43 ahallam 2427 lam=3.462e9 #lames constant
44     mu=3.462e9 #bulk modulus
45     rho=1154. #density
46     # Time related variables.
47 ahallam 2469 tend=0.5 #end time
48 ahallam 2427 #calculating )the timestep
49     h=(1./5.)*sqrt(rho/(lam+2*mu))*(mx/ndx)
50     #Check to make sure number of time steps is not too large.
51 jfenwick 3892 print("Time step size= ",h, "Expected number of outputs= ",tend/h)
52 jfenwick 2667
53     #uncomment the following lines to give the user a chance to stop
54     #proceeder = raw_input("Is this ok?(y/n)")
55 ahallam 2427 #Exit if user thinks too many outputs.
56 jfenwick 2667 #if proceeder == "n":
57     # sys.exit()
58 ahallam 2427
59     U0=0.01 # amplitude of point source
60     # spherical source at middle of bottom face
61    
62 ahallam 2469 xc=[300,200]
63 ahallam 2427
64     mydomain=Rectangle(l0=mx,l1=my,n0=ndx, n1=ndy)
65     wavesolver2d(mydomain,h,tend,lam,mu,rho,U0,xc,savepath)
66    

  ViewVC Help
Powered by ViewVC 1.1.26