/[escript]/trunk/doc/cookbook/cblib/phones.py
ViewVC logotype

Contents of /trunk/doc/cookbook/cblib/phones.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2549 - (show annotations)
Mon Jul 20 06:43:47 2009 UTC (10 years, 2 months ago) by jfenwick
File MIME type: text/x-python
File size: 1984 byte(s)
Remainder of copyright date fixes
1
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 # 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.escript.pdetools import Locator
27 from esys.escript.linearPDEs import LinearPDE
28 from esys.finley import Rectangle
29 from numpy import identity,zeros,ones
30 import os
31
32 ########################################################
33 # subroutine: cbphones
34 # Allows us to record the values of a PDE at various
35 # specified locations in the model.
36 # Arguments:
37 # domain : domain of model
38 # U : Current time state displacement solution.
39 # phones : Geophone Locations
40 # dim : model dimesions
41 # savepath: where to output the data files local is default
42 ########################################################
43 def cbphones(domain,U,phones,dim,savepath=""):
44 #find the number of geophones
45 nphones = len(phones)
46 u_pot = zeros([nphones,dim],float)
47
48 for i in range(0,nphones):
49 # define the location of the phone source
50 L=Locator(domain,numpy.array(phones[i]))
51 # find potential at point source.
52 temp = L.getValue(U)
53 for j in range(0,dim):
54 u_pot[i,j]=temp[j]
55
56 # open file to save displacement at point source
57 return u_pot

  ViewVC Help
Powered by ViewVC 1.1.26