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

Contents of /trunk/doc/examples/cookbook/example10p.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5707 - (show annotations)
Mon Jun 29 03:59:06 2015 UTC (3 years, 6 months ago) by sshaw
File MIME type: text/x-python
File size: 2204 byte(s)
adding copyright headers to files without copyright info, moved header to top of file in some cases where it wasn't
1 ##############################################################################
2 #
3 # Copyright (c) 2009-2015 by The University of Queensland
4 # http://www.uq.edu.au
5 #
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 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11 # Development 2012-2013 by School of Earth Sciences
12 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
13 #
14 ##############################################################################
15 from __future__ import division, print_function
16
17 __copyright__="""Copyright (c) 2009-2015 by The University of Queensland
18 http://www.uq.edu.au
19 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 """
25 Author: Antony Hallam antony.hallam@uqconnect.edu.au
26 """
27
28 ############################################################FILE HEADER
29 # example10p.py
30 # Profiles of gravitational potential with increasing domain size.
31
32 #######################################################EXTERNAL MODULES
33 # To solve the problem it is necessary to import the modules we require.
34 import pylab as pl
35 import os
36 from esys.escript import * # This imports everything from the escript library
37
38 ################################################ESTABLISHING PARAMETERS
39 #the folder to put our outputs in, leave blank "" for script path
40 save_path= os.path.join("data","example10")
41 #ensure the dir exists
42 mkDir(save_path)
43
44 #load the data files.
45 dat1=pl.loadtxt(os.path.join(save_path,'example10b_2000.asc'))
46 dat2=pl.loadtxt(os.path.join(save_path,'example10b_0500.asc'))
47 dat3=pl.loadtxt(os.path.join(save_path,'example10b_4000.asc'))
48 dat4=pl.loadtxt(os.path.join(save_path,'example10b_1000.asc'))
49
50 #plot the data.
51 pl.plot(dat2,label='500^2')
52 pl.plot(dat4,label='1000^2')
53 pl.plot(dat1,label='2000^2')
54 pl.plot(dat3,label='4000^2')
55 pl.legend()
56 pl.title('Small vs Large Gravity Model')
57 pl.xlabel('X')
58 pl.ylabel('Potential')
59 pl.savefig(os.path.join(save_path,"ex10p_boundeff.pdf"),dpi=150)
60
61

  ViewVC Help
Powered by ViewVC 1.1.26