# Contents of /trunk/doc/examples/cookbook/wave_stab.py

Revision 3148 - (show annotations)
Fri Sep 3 02:09:47 2010 UTC (10 years, 11 months ago) by jfenwick
File MIME type: text/x-python
File size: 1386 byte(s)
```Another attempt to patch the X issue

```
 1 2 ######################################################## 3 # 4 # Copyright (c) 2009-2010 by University of Queensland 5 # Earth Systems Science Computational Center (ESSCC) 6 7 # 8 # Primary Business: Queensland, Australia 9 # Licensed under the Open Software License version 3.0 10 11 # 12 ######################################################## 13 14 __copyright__="""Copyright (c) 2009-2010 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 20 __url__= 21 22 # Antony Hallam 23 # Acoustic Wave Equation Simulation 24 25 # Importing all the necessary modules required. 26 import numpy as np 27 28 import matplotlib 29 matplotlib.use('agg') #It's just here for automated testing 30 31 import pylab as pl 32 33 #Geometric and material property related variables. 34 mx = 1000. # model lenght 35 36 ndx = np.arange(0.,20.,.1) 37 mtim= np.zeros(len(ndx),'float') 38 nvel= np.arange(500.,5000.,500.) 39 40 for vel in nvel: 41 mtim=ndx/vel 42 pl.plot(ndx,mtim,label='%d m/s'%vel) 43 44 pl.title('Maximum time steps calculations by velocity') 45 pl.xlabel('Minimum grid spacing (m)') 46 pl.ylabel('Maximum stable time step (s)') 47 pl.legend() 48 pl.show() 49 50 51 52