Changeset 8467 for trunk/anuga_core/source/anuga
- Timestamp:
- Jul 11, 2012, 9:42:12 PM (12 years ago)
- Location:
- trunk/anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/shallow_water/okada_tsunami.py
r8466 r8467 265 265 x_offset, y_offset = rotate_coordinates([eq_length/2.0, eq_surface_width/2.0], -(eq_strike-90.)) 266 266 267 print x_offset, y_offset267 #print x_offset, y_offset 268 268 # Centriod values 269 269 new_x = lower_left[0] + x_offset*1000. -
trunk/anuga_core/source/anuga/shallow_water/okada_tsunami_fortran.f
r8466 r8467 14 14 logical:: DEBUG 15 15 c Convenience flag for debugging -- will write various outputs to file 16 DEBUG=.TRUE. 17 open(32, file='mylog.log') 18 write(32,*) ' MYLOGGINGZ' 16 DEBUG=.FALSE. 19 17 20 18 c print*, 'IN FORTRAN' … … 22 20 IF(DEBUG.eqv..TRUE.) THEN 23 21 22 open(32, file='mylog.log') 23 write(32,*) ' MYLOGGINGZ' 24 24 25 25 write(32,*) 'WRITING TO FILE' … … 119 119 200 continue 120 120 121 cIF(DEBUG.eqv..TRUE.) THEN121 IF(DEBUG.eqv..TRUE.) THEN 122 122 close(32) 123 cEND IF123 END IF 124 124 RETURN 125 125 END -
trunk/anuga_core/source/anuga/shallow_water/okada_tsunami_test.py
r8466 r8467 7 7 import unittest, os 8 8 import warnings 9 from os import sep 9 10 10 11 import anuga 11 12 import okada_tsunami 12 13 import numpy 14 from anuga.utilities.system_tools import get_pathname_from_package 13 15 14 16 class Test_okada_tsunami(unittest.TestCase): … … 24 26 # These refer to earthquakes with strike = 0 and origin 0,0 25 27 for j in range(2,3): 26 print 'Testing Case ', j28 #print 'Testing Case ', j 27 29 28 30 if(j==2): … … 76 78 #d_cent = d - (W/2.)*numpy.sin(dip/180.*numpy.pi) 77 79 78 print 'x_cent, y_cent, d_cent = ', x_cent, y_cent, d_cent80 #print 'x_cent, y_cent, d_cent = ', x_cent, y_cent, d_cent 79 81 80 82 x_wanted=x*1000. # Desired values of x, y in m … … 86 88 dis2=slip*numpy.sin(rake/180.*numpy.pi) 87 89 dis3=0. 88 print 'dis1, dis2, dis3 = ', dis1, dis2, dis390 #print 'dis1, dis2, dis3 = ', dis1, dis2, dis3 89 91 90 92 my_source=numpy.array([x_cent, y_cent, d_cent,strike, dip, L, W, dis1, dis2, dis3]) 91 93 my_source=my_source.reshape((1,10)) 92 94 93 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose= True)95 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=False) 94 96 uz = tsu_funct(numpy.array([x_wanted]), numpy.array([y_wanted])) 95 97 … … 108 110 # Test cases 2 - 3 in Okada's table 109 111 for j in range(2,4): 110 print 'Testing Case ', j112 #print 'Testing Case ', j 111 113 if(j==2): 112 114 ##------- … … 161 163 my_source=my_source.reshape((1,10)) 162 164 163 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose= True)165 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=False) 164 166 uz = tsu_funct(numpy.array([x_wanted]), numpy.array([y_wanted])) 165 167 … … 187 189 # Loop over okada's test cases 2 and 3 188 190 for j in range(2,4): 189 print 'Testing Case ', j, ' Rotation = ', rotation, ' origin = ', [okada_x_origin, okada_y_origin]191 #print 'Testing Case ', j, ' Rotation = ', rotation, ' origin = ', [okada_x_origin, okada_y_origin] 190 192 191 193 if(j==2): … … 253 255 abstol = abs(uz-okada_values[i]) 254 256 assert ((reltol<1.0e-03)|(abstol<1.0e-06)), 'Okada_tsunami error for eq source: ' + str(my_source) 255 print 'PASS'257 #print 'PASS' 256 258 257 259 # … … 329 331 330 332 # Tsunami function with 331 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose= True)333 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=False) 332 334 uz = tsu_funct(numpy.array([x_wanted]), numpy.array([y_wanted])) 333 335 … … 336 338 abstol = abs(uz-okada_values[0]) 337 339 assert ((reltol<1.0e-03)|(abstol<1.0e-06)) 338 print 'PASS'340 #print 'PASS' 339 341 340 342 def test_against_octave_code(self): … … 360 362 source=numpy.array([0., 0., depth, strike,dip , length, width, dis1, dis2,0.0]) 361 363 362 tsunami_fun=okada_tsunami.earthquake_source(source=source, verbose= True)364 tsunami_fun=okada_tsunami.earthquake_source(source=source, verbose=False) 363 365 364 366 # Make a grid … … 376 378 ## Now read the same event from an octave code, which is completely 377 379 ## independent of this one (i.e. they don't call okada's fortran) 378 octave=numpy.genfromtxt('okada_tsunami_octave_95.txt') 380 path=get_pathname_from_package('anuga.shallow_water') 381 octave=numpy.genfromtxt(path+sep+'okada_tsunami_octave_95.txt') 379 382 octave_asvec=numpy.transpose(octave).reshape((1,101*101)) 380 383
Note: See TracChangeset
for help on using the changeset viewer.