Changeset 668 for inundation/ga/storm_surge/examples/beach.py
- Timestamp:
- Dec 2, 2004, 11:40:39 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/examples/beach.py
r667 r668 17 17 18 18 from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\ 19 Transmissive_boundary, Time_boundary 19 Transmissive_boundary, Time_boundary, Wind_stress 20 20 21 21 from pmesh2domain import pmesh_to_domain_instance … … 38 38 39 39 domain = Domain(domain.coordinates, domain.triangles, domain.boundary) 40 print "Number of triangles = ", len(domain)41 40 42 41 domain.store = True … … 59 58 60 59 def riverbed(x, y): 61 return (y-100)/10 + 4*x/100 60 #return (y-100)/10 + 5*x/100 61 return (y-100)/50 + 4.4 62 62 63 63 … … 79 79 80 80 river = [[20,100], [18,90], [20,80], [20,60], [15,40], [11,20], [2,0], [10,0], 81 [14,10], [20,30], [24,45], [27,80], [27,85], [3 2,90], [39,100]]81 [14,10], [20,30], [24,45], [27,80], [27,85], [35,90], [39,100]] 82 82 83 83 print 'Set elevation' 84 84 domain.set_quantity('elevation', 85 85 Polygon_function( [(shoreline, bathymetry), (land, topography), 86 (building1, 4), (building2, 11),87 (building3, 7), (building4, 8),88 (building5, 8), (building6, 7),86 (building1, 3), (building2, 9), 87 (building3, 8), (building4, 7), 88 (building5, 8), (building6, 6), 89 89 (river, riverbed)])) 90 90 91 91 print 'Set level' 92 92 domain.set_quantity('level', 93 Polygon_function( [(shoreline, -1. 2),93 Polygon_function( [(shoreline, -1.5), 94 94 (land, -10)] )) 95 95 96 96 print 'Set friction' 97 domain.set_quantity('friction', 0.0 7)97 domain.set_quantity('friction', 0.03) 98 98 99 99 print domain.get_extent() 100 101 102 103 #Add lateral wind gusts bearing 135 degrees 104 def gust(t,x,y): 105 from math import sin, pi 106 from Numeric import zeros, ones, Float 107 108 N = len(x) 109 110 tt = sin(2*pi*t/50) 111 112 if tt > 0.7: 113 return 10000*tt*ones(N, Float) 114 else: 115 return zeros(N, Float) 116 117 domain.forcing_terms.append(Wind_stress(gust, 135)) 118 100 119 101 120 ###################### … … 104 123 print 'Boundaries' 105 124 Br = Reflective_boundary(domain) 106 B t= Transmissive_boundary(domain)125 Bo = Transmissive_boundary(domain) 107 126 108 127 #Constant inflow 109 128 Bd = Dirichlet_boundary([0.0, -1.0, 0.0]) 110 Bt = Time_boundary(domain, lambda t: [ 2.7*(1+sin(2*pi*t/50)), 0.0, 0.0])129 Bt = Time_boundary(domain, lambda t: [ 3.0*(1+sin(2*pi*t/100)), 0.0, 0.0]) 111 130 112 131 print 'Available boundary tags are', domain.get_boundary_tags() … … 116 135 tags['ocean'] = Bt 117 136 tags['wall'] = Br 137 tags['outflow'] = Bo 118 138 tags['exterior'] = Br 119 139 tags['external'] = Br … … 125 145 ###################### 126 146 #Evolution 127 for t in domain.evolve(yieldstep = 0. 5, finaltime = 100):147 for t in domain.evolve(yieldstep = 0.2, finaltime = 500): 128 148 domain.write_time() 129 149
Note: See TracChangeset
for help on using the changeset viewer.