Changeset 4023


Ignore:
Timestamp:
Nov 21, 2006, 3:54:12 PM (18 years ago)
Author:
sexton
Message:

fix up smf function

Location:
anuga_core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/documentation/user_manual/demos/cairns/runcairns.py

    r4021 r4023  
    1 """Script for running a tsunami inundation scenario for Broome, WA, Australia.
     1"""Script for running a tsunami inundation scenario for Cairns, QLD Australia.
    22
    33Source data such as elevation and boundary data is assumed to be available in
    44directories specified by project.py
    5 The output sww file is stored in project.outputtimedir
     5The output sww file is stored in directory named after the scenario, i.e
     6slump or fixed_wave.
    67
    78The scenario is defined by a triangular mesh created from project.polygon,
    8 the elevation data and a tsunami wave generated by MOST.
    9 
    10 Ole Nielsen and Duncan Gray, GA - 2005 and Nick Bartzis, GA - 2006
     9the elevation data and a tsunami wave generated by a submarine mass failure.
     10
     11Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton and Nick Bartzis, GA - 2006
    1112"""
    1213
     
    3536# Define scenario as either slump or fixed_wave.
    3637#-------------------------------------------------------------------------------
    37 #scenario = 'slump' # OR
     38#scenario = 'slump'
    3839scenario = 'fixed_wave'
    3940if access(scenario,F_OK) == 0:
     
    8990# Setup computational domain
    9091#-------------------------------------------------------------------------------                                 
     92
    9193domain = Domain(meshname, use_cache = True, verbose = True)
    9294
     
    117119# Setup information for slump scenario (to be applied 1 min into simulation
    118120#-------------------------------------------------------------------------------
     121
    119122if scenario == 'slump':
    120123    from anuga.shallow_water.smf import slump_tsunami  # Function for submarine slump
     
    135138# Setup boundary conditions
    136139#-------------------------------------------------------------------------------
     140
    137141print 'Available boundary tags', domain.get_boundary_tags()
    138142
     
    156160# Evolve system through time
    157161#-------------------------------------------------------------------------------
     162
    158163import time
    159164t0 = time.time()
     
    168173        domain.write_boundary_statistics(tags = 'ocean_east')     
    169174       
    170         # add slump
    171         thisstagestep = domain.get_quantity('stage')
    172         if allclose(t, 60):
    173             slump = Quantity(domain)
    174             slump.set_values(tsunami_source)
    175             domain.set_quantity('stage', slump + thisstagestep)
    176 
    177         # save every two mins leading up to wave approaching land
    178         for t in domain.evolve(yieldstep = 120, finaltime = 1000,
    179                                skip_initial_step = True):
    180             domain.write_time()
    181             domain.write_boundary_statistics(tags = 'ocean_east')
    182 
    183         # save every 30 secs as wave starts inundating ashore
    184         for t in domain.evolve(yieldstep = 30, finaltime = 10000,
    185                                skip_initial_step = True):
    186             domain.write_time()
    187             domain.write_boundary_statistics(tags = 'ocean_east')
    188 
    189 if scenario == 'fixed_wave':
     175    # add slump
     176    thisstagestep = domain.get_quantity('stage')
     177    if allclose(t, 60):
     178        slump = Quantity(domain)
     179        slump.set_values(tsunami_source)
     180        domain.set_quantity('stage', slump + thisstagestep)
    190181
    191182    # save every two mins leading up to wave approaching land
    192     for t in domain.evolve(yieldstep = 120, finaltime = 1000):
    193         domain.write_time()
    194         domain.write_boundary_statistics(tags = 'ocean_east')     
     183    for t in domain.evolve(yieldstep = 120, finaltime = 1000,
     184                           skip_initial_step = True):
     185        domain.write_time()
     186        domain.write_boundary_statistics(tags = 'ocean_east')
    195187
    196188    # save every 30 secs as wave starts inundating ashore
     
    199191        domain.write_time()
    200192        domain.write_boundary_statistics(tags = 'ocean_east')
     193
     194if scenario == 'fixed_wave':
     195
     196    # save every two mins leading up to wave approaching land
     197    for t in domain.evolve(yieldstep = 120, finaltime = 1000):
     198        domain.write_time()
     199        domain.write_boundary_statistics(tags = 'ocean_east')     
     200
     201    # save every 30 secs as wave starts inundating ashore
     202    for t in domain.evolve(yieldstep = 30, finaltime = 10000,
     203                           skip_initial_step = True):
     204        domain.write_time()
     205        domain.write_boundary_statistics(tags = 'ocean_east')
    201206           
    202207print 'That took %.2f seconds' %(time.time()-t0)
  • anuga_core/source/anuga/shallow_water/smf.py

    r4021 r4023  
    9191             * (1 - exp(-2.2*(gamma-1)))
    9292    a3D = a2D / (1 + (15.5*sqrt(depth/(length*sint))))
    93 
    94     if verbose is True:
    9593       
    9694    #a few temporary print statements
     
    113111        print '\t2D amplitude: ', a2D
    114112        print '\t3D amplitude: ', a3D
    115         print '\t HELLO', a0, ut, s0, t0, w, a2D, a3D
    116113
    117114    #keep an eye on some of the assumptions built into the maths
     
    120117        if verbose is True:
    121118            print 'WARNING: slope out of range (5 - 30 degrees) ', slope
    122             print 'hello'
    123119    if ((depth/length < 0.06) or (depth/length > 1.5)):
    124120        if verbose is True:
     
    342338
    343339        am = self.a3D
    344         am2 = self.a2D
     340        am2 = 1.0
     341        #am2 = self.a2D
    345342        wa = self.wavelength
    346343        wi = self.width
Note: See TracChangeset for help on using the changeset viewer.