Ignore:
Timestamp:
Jul 11, 2012, 9:42:12 PM (12 years ago)
Author:
davies
Message:

Moving test_okada_tsunami.py to okada_tsunami_test.py to avoid
automated test run (requires fortran compilation to pass)

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  
    265265    x_offset, y_offset = rotate_coordinates([eq_length/2.0, eq_surface_width/2.0], -(eq_strike-90.))
    266266
    267     print x_offset, y_offset
     267    #print x_offset, y_offset
    268268    # Centriod values
    269269    new_x = lower_left[0] + x_offset*1000.
  • trunk/anuga_core/source/anuga/shallow_water/okada_tsunami_fortran.f

    r8466 r8467  
    1414      logical:: DEBUG
    1515c     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.
    1917   
    2018c      print*, 'IN FORTRAN'
     
    2220      IF(DEBUG.eqv..TRUE.) THEN 
    2321
     22          open(32, file='mylog.log')
     23          write(32,*) ' MYLOGGINGZ'
    2424
    2525          write(32,*) 'WRITING TO FILE'
     
    119119 200  continue
    120120
    121 c      IF(DEBUG.eqv..TRUE.) THEN
     121      IF(DEBUG.eqv..TRUE.) THEN
    122122          close(32)
    123 c      END IF
     123      END IF
    124124      RETURN
    125125      END
  • trunk/anuga_core/source/anuga/shallow_water/okada_tsunami_test.py

    r8466 r8467  
    77import unittest, os
    88import warnings
     9from os import sep
    910
    1011import anuga
    1112import okada_tsunami
    1213import numpy
     14from anuga.utilities.system_tools import get_pathname_from_package
    1315
    1416class Test_okada_tsunami(unittest.TestCase):
     
    2426        # These refer to earthquakes with strike = 0 and origin 0,0
    2527        for j in range(2,3):
    26             print 'Testing Case ', j
     28            #print 'Testing Case ', j
    2729
    2830            if(j==2):
     
    7678            #d_cent = d - (W/2.)*numpy.sin(dip/180.*numpy.pi)
    7779
    78             print 'x_cent, y_cent, d_cent = ', x_cent, y_cent, d_cent
     80            #print 'x_cent, y_cent, d_cent = ', x_cent, y_cent, d_cent
    7981           
    8082            x_wanted=x*1000. # Desired values of x, y in m
     
    8688                dis2=slip*numpy.sin(rake/180.*numpy.pi)
    8789                dis3=0.
    88                 print 'dis1, dis2, dis3 = ', dis1, dis2, dis3
     90                #print 'dis1, dis2, dis3 = ', dis1, dis2, dis3
    8991               
    9092                my_source=numpy.array([x_cent, y_cent, d_cent,strike, dip, L, W, dis1, dis2, dis3])
    9193                my_source=my_source.reshape((1,10))
    9294               
    93                 tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=True)
     95                tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=False)
    9496                uz = tsu_funct(numpy.array([x_wanted]), numpy.array([y_wanted]))
    9597             
     
    108110            # Test cases 2 - 3 in Okada's table
    109111            for j in range(2,4):
    110                 print 'Testing Case ', j
     112                #print 'Testing Case ', j
    111113                if(j==2):
    112114                    ##-------
     
    161163                    my_source=my_source.reshape((1,10))
    162164                   
    163                     tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=True)
     165                    tsu_funct = okada_tsunami.earthquake_source(my_source, verbose=False)
    164166                    uz = tsu_funct(numpy.array([x_wanted]), numpy.array([y_wanted]))
    165167                 
     
    187189                # Loop over okada's test cases 2 and 3
    188190                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]
    190192
    191193                    if(j==2):
     
    253255                        abstol = abs(uz-okada_values[i])
    254256                        assert ((reltol<1.0e-03)|(abstol<1.0e-06)), 'Okada_tsunami error for eq source: ' + str(my_source)
    255                         print 'PASS'
     257                        #print 'PASS'
    256258
    257259#
     
    329331           
    330332        # 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)
    332334        uz = tsu_funct(numpy.array([x_wanted]), numpy.array([y_wanted]))
    333335     
     
    336338        abstol = abs(uz-okada_values[0])
    337339        assert ((reltol<1.0e-03)|(abstol<1.0e-06))
    338         print 'PASS'
     340        #print 'PASS'
    339341
    340342    def test_against_octave_code(self):
     
    360362        source=numpy.array([0., 0., depth, strike,dip , length, width, dis1, dis2,0.0])
    361363
    362         tsunami_fun=okada_tsunami.earthquake_source(source=source, verbose=True)
     364        tsunami_fun=okada_tsunami.earthquake_source(source=source, verbose=False)
    363365
    364366        # Make a grid
     
    376378        ## Now read the same event from an octave code, which is completely
    377379        ## 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')
    379382        octave_asvec=numpy.transpose(octave).reshape((1,101*101))
    380383
Note: See TracChangeset for help on using the changeset viewer.