Changeset 3530
- Timestamp:
- Aug 25, 2006, 1:08:54 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/examples/runup_convergence.py
r3511 r3530 29 29 # Model constants 30 30 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 31 slope = -0.05 # 1:20 Slope 32 highest_point = 6 # Highest elevation (m) 33 sea_level = 0 # Mean sea level 34 min_elevation = -20 # Lowest elevation (elevation of offshore flat part) 35 offshore_depth=sea_level-min_elevation # offshore water depth 36 amplitude = 2 # Solitary wave height H 37 normalized_amplitude = amplitude/offshore_depth 35 38 simulation_name = 'runup_convergence' 36 39 … … 61 64 62 65 # 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) 66 polygon = [[east,north],[west,north],[west,south],[east,south]] 67 interior_polygon = [[200,north-10],[west+10,north-10],[west+10,south+10],[200,south+10]] 68 meshname = simulation_name + '.msh' 69 create_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]]) 74 domain = Domain(meshname, use_cache=True, verbose = True) 71 75 72 76 … … 79 83 #------------------------------------------------------------------------------ 80 84 85 #def topography(x,y): 86 # return slope*x+highest_point # Return linear bed slope bathymetry as vector 87 81 88 def 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 83 106 84 107 domain.set_quantity('elevation', topography) # Use function for elevation … … 96 119 97 120 def waveform(t): 98 return sea_level + amplitude/cosh(t-10)**2121 return sea_level + normalized_amplitude/cosh(t-25)**2 99 122 100 123 Bw = Time_boundary(domain=domain, # Time dependent boundary … … 114 137 115 138 stagestep = [] 116 for t in domain.evolve(yieldstep = 1, finaltime = 1 50):139 for t in domain.evolve(yieldstep = 1, finaltime = 100): 117 140 domain.write_time() 118 141 … … 126 149 def gauge_line(west,east,north,south): 127 150 from Numeric import arange 128 x_vector = arange(west, east, dx/4) # Gauges every dx/2 meter from west to east151 x_vector = arange(west, (east-west)/2, 10) # Gauges every 10 meter from west to midpt 129 152 y = (north+south)/2. 130 153 … … 142 165 interpolation_points = gauges, 143 166 verbose = True, 144 use_cache = False)167 use_cache = True) 145 168 146 169 … … 172 195 # Print 173 196 print 'wave height [m]: ', amplitude 174 runup_height = topography( runup_point, (north+south)/2.)197 runup_height = topography([runup_point], [(north+south)/2.])[0] 175 198 print 'run up height [m]: ', runup_height 176 199 … … 179 202 180 203 print 'Coastline (meters form west): ', coastline 204 181 205 182 206 … … 203 227 204 228 savefig('snapshots') 205 206 229 207 230 … … 218 241 fid.close() 219 242 220 221 222 223 224 243 # Plot max runup etc 225 244 ion() 226 hold(False) 227 figure(2) 245 figure(1) 228 246 plot(x_vector, max_stage, 'g+', 229 247 x_vector, min_stage, 'b+',
Note: See TracChangeset
for help on using the changeset viewer.