Changeset 3530


Ignore:
Timestamp:
Aug 25, 2006, 1:08:54 PM (18 years ago)
Author:
ole
Message:

Merged in version developed with Rosh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/examples/runup_convergence.py

    r3511 r3530  
    2929# Model constants
    3030
    31 slope = -0.02     # 1:50 Slope
    32 highest_point = 3 # Highest elevation (m)
    33 sea_level = -1    # Mean sea level
    34 amplitude = 2     # Solitary wave height H
     31slope = -0.05       # 1:20 Slope
     32highest_point = 6   # Highest elevation (m)
     33sea_level = 0       # Mean sea level
     34min_elevation = -20 # Lowest elevation (elevation of offshore flat part)
     35offshore_depth=sea_level-min_elevation # offshore water depth
     36amplitude = 2       # Solitary wave height H
     37normalized_amplitude = amplitude/offshore_depth
    3538simulation_name = 'runup_convergence'   
    3639
     
    6164
    6265# Unstructured mesh
    63 #polygon = [[east,north],[west,north],[west,south],[east,south]]
    64 #meshname = simulation_name + '.msh'
    65 #create_mesh_from_regions(polygon,
    66 #                         boundary_tags={'top': [0], 'left': [1], 'bottom': [2], 'right': [3]},
    67 #                         maximum_triangle_area=dx*dy/2,
    68 #                         filename=meshname)
    69 #                         #interior_regions=interior_regions)
    70 #domain = Domain(meshname, use_cache=True, verbose = True)
     66polygon = [[east,north],[west,north],[west,south],[east,south]]
     67interior_polygon = [[200,north-10],[west+10,north-10],[west+10,south+10],[200,south+10]]
     68meshname = simulation_name + '.msh'
     69create_mesh_from_regions(polygon,
     70                         boundary_tags={'top': [0], 'left': [1], 'bottom': [2], 'right': [3]},
     71                         maximum_triangle_area=dx*dy/4, # Triangle area commensurate with structured mesh
     72                         filename=meshname,
     73                         interior_regions=[[interior_polygon,dx*dy/32]])
     74domain = Domain(meshname, use_cache=True, verbose = True)
    7175
    7276
     
    7983#------------------------------------------------------------------------------
    8084
     85#def topography(x,y):
     86#    return slope*x+highest_point  # Return linear bed slope bathymetry as vector
     87
    8188def topography(x,y):
    82     return slope*x+highest_point  # Return linear bed slope bathymetry as vector
     89    """Two part topography - slope and flat part
     90    """
     91
     92    from Numeric import zeros, Float
     93
     94    z = zeros(len(x), Float) # Allocate space for return vector
     95    for i in range(len(x)):
     96
     97        z[i] = slope*x[i]+highest_point # Linear bed slope bathymetry
     98
     99        if z[i] < min_elevation:        # Limit depth
     100            z[i] = min_elevation
     101
     102    return z       
     103       
     104
     105       
    83106
    84107domain.set_quantity('elevation', topography) # Use function for elevation
     
    96119
    97120def waveform(t):
    98     return sea_level + amplitude/cosh(t-10)**2
     121    return sea_level + normalized_amplitude/cosh(t-25)**2
    99122
    100123Bw = Time_boundary(domain=domain,     # Time dependent boundary 
     
    114137
    115138stagestep = []
    116 for t in domain.evolve(yieldstep = 1, finaltime = 150):
     139for t in domain.evolve(yieldstep = 1, finaltime = 100):
    117140    domain.write_time()
    118141
     
    126149def gauge_line(west,east,north,south):
    127150    from Numeric import arange
    128     x_vector = arange(west, east, dx/4) # Gauges every dx/2 meter from west to east
     151    x_vector = arange(west, (east-west)/2, 10) # Gauges every 10 meter from west to midpt
    129152    y = (north+south)/2.
    130153
     
    142165                  interpolation_points = gauges,
    143166                  verbose = True,
    144                   use_cache = False)
     167                  use_cache = True)
    145168
    146169
     
    172195# Print
    173196print 'wave height [m]:                    ', amplitude
    174 runup_height = topography(runup_point, (north+south)/2.)
     197runup_height = topography([runup_point], [(north+south)/2.])[0]
    175198print 'run up height [m]:                  ', runup_height
    176199
     
    179202
    180203print 'Coastline (meters form west):       ', coastline
     204
    181205
    182206
     
    203227         
    204228savefig('snapshots')
    205        
    206229
    207230
     
    218241fid.close()
    219242
    220 
    221 
    222 
    223 
    224243# Plot max runup etc
    225244ion()
    226 hold(False)
    227 figure(2)
     245figure(1)
    228246plot(x_vector, max_stage, 'g+',
    229247     x_vector, min_stage, 'b+',     
Note: See TracChangeset for help on using the changeset viewer.