Changeset 3511 for inundation/examples
- Timestamp:
- Aug 21, 2006, 1:17:30 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/examples/runup_convergence.py
r3508 r3511 22 22 from pyvolution.shallow_water import Transmissive_Momentum_Set_Stage_boundary 23 23 from pyvolution.util import file_function 24 from pylab import plot, xlabel, ylabel, title, ion, close, savefig, figure, axis 25 ion() 24 from pylab import plot, xlabel, ylabel, title, ion, close, savefig, figure, axis, legend, grid, hold 25 26 26 27 27 … … 96 96 97 97 def waveform(t): 98 return sea_level + amplitude/cosh(t- 5)**298 return sea_level + amplitude/cosh(t-10)**2 99 99 100 100 Bw = Time_boundary(domain=domain, # Time dependent boundary … … 114 114 115 115 stagestep = [] 116 for t in domain.evolve(yieldstep = 1, finaltime = 1 00):116 for t in domain.evolve(yieldstep = 1, finaltime = 150): 117 117 domain.write_time() 118 118 … … 126 126 def gauge_line(west,east,north,south): 127 127 from Numeric import arange 128 x_vector = arange(west, (east-west)/2, 10) # Gauges every 1 meter from west to midpt128 x_vector = arange(west, east, dx/4) # Gauges every dx/2 meter from west to east 129 129 y = (north+south)/2. 130 130 … … 142 142 interpolation_points = gauges, 143 143 verbose = True, 144 use_cache = True)144 use_cache = False) 145 145 146 146 … … 171 171 172 172 # Print 173 174 173 print 'wave height [m]: ', amplitude 175 174 runup_height = topography(runup_point, (north+south)/2.) … … 182 181 183 182 183 # Take snapshots and plot 184 ion() 185 figure(1) 186 plot(x_vector, topography(x_vector,(north+south)/2.), 'r-') 187 xlabel('x') 188 ylabel('Elevation') 189 #legend(('Max stage', 'Min stage', 'Elevation'), shadow=True, loc='upper right') 190 title('Stage snapshots (t=0, 10, ...) for gauge line') 191 grid() 192 hold(True) 193 194 for i, t in enumerate(f.get_time()): 195 if i % 10 == 0: 196 # Take only some timesteps to avoid clutter 197 stages = [] 198 for k, g in enumerate(gauges): 199 w = f(t, point_id = k)[0] 200 stages.append(w) 201 202 plot(x_vector, stages, 'b-') 203 204 savefig('snapshots') 205 206 207 184 208 185 209 # Store 186 210 filename = 'maxrunup'+str(amplitude)+'.csv' 187 211 fid = open(filename,'w') 188 s = ' Depth at eastern boundary,Waveheight,Runup distance,Runup height\n'212 s = 'Waveheight,Runup distance,Runup height\n' 189 213 fid.write(s) 190 214 … … 194 218 fid.close() 195 219 196 # Plot 197 figure(1) 220 221 222 223 224 # Plot max runup etc 225 ion() 226 hold(False) 227 figure(2) 198 228 plot(x_vector, max_stage, 'g+', 199 229 x_vector, min_stage, 'b+', … … 201 231 xlabel('x') 202 232 ylabel('stage') 233 legend(('Max stage', 'Min stage', 'Elevation'), shadow=True, loc='upper right') 203 234 title('Maximum stage for gauge line') 235 grid() 204 236 #axis([33000, 47000, -1000, 3000]) 205 237 savefig('max_stage')
Note: See TracChangeset
for help on using the changeset viewer.