- Timestamp:
- Mar 2, 2010, 2:31:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/bunbury_storm_surge_2009/run_model.py
r7613 r7647 159 159 'ocean': Bf}) 160 160 161 #-----------------------------------------------------------------------------162 # Setup dynamic topography163 #-----------------------------------------------------------------------------164 from project import floodgate_height, floodgate_thickness,floodgate_LHS_x,floodgate_LHS_y,floodgate_RHS_x,floodgate_RHS_y,floodgate_start,floodgate_duration165 166 floodgate_end = floodgate_start + floodgate_duration #the time in seconds at which the floodgates are fully closed167 168 def floodgate(x,y):169 z = 0*x170 N = len(x)171 for i in range(N):172 ymin = ((floodgate_RHS_y - floodgate_LHS_y)/(floodgate_RHS_x - floodgate_LHS_x))*(x[i]-floodgate_LHS_x)+ floodgate_LHS_y - 0.5*floodgate_thickness173 ymax = ((floodgate_RHS_y - floodgate_LHS_y)/(floodgate_RHS_x - floodgate_LHS_x))*(x[i]-floodgate_LHS_x)+ floodgate_LHS_y + 0.5*floodgate_thickness174 xmin = floodgate_LHS_x175 xmax = floodgate_RHS_x176 if ymin < y[i] < ymax and xmin < x[i] < xmax:177 z[i] += (floodgate_height/((floodgate_duration)/project.yieldstep))178 179 return z180 181 161 #------------------------------------------------------------------------------- 182 162 # Evolve system through time 183 163 #------------------------------------------------------------------------------- 184 185 raising_floodgates = False186 lowering_floodgates = False187 164 188 165 t0 = time.time() … … 193 170 print domain.boundary_statistics(tags='ocean') 194 171 195 #raise floodgate at a given time interval (to make floodgate lower again repeat this code below196 #for a later time interval and change rising to false and falling to true197 if floodgate_start < t < floodgate_end:198 rising = True199 falling = False200 201 if rising:202 domain.add_quantity('elevation',floodgate)203 204 if falling:205 domain.add_quantity('elevation', lambda x,y: -1*floodgate(x,y))206 172 207 173 print 'Simulation took %.2f seconds' % (time.time()-t0)
Note: See TracChangeset
for help on using the changeset viewer.