Changeset 2561 for inundation/pyvolution
- Timestamp:
- Mar 21, 2006, 8:33:34 AM (19 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/island.py
r1280 r2561 13 13 Constant_height 14 14 from Numeric import array 15 from util import Polygon_function, read_polygon15 from utilities.polygon import Polygon_function, read_polygon 16 16 from math import exp 17 17 … … 23 23 #Create shallow water domain 24 24 domain = Domain(points, vertices, boundary) 25 domain.store = False25 domain.store = True 26 26 domain.smooth = False 27 domain.visualise = True27 domain.visualise = False 28 28 domain.set_name('island') 29 29 print 'Output being written to ' + domain.get_datadir() + sep + \ … … 52 52 return z 53 53 54 domain.set_quantity('friction', 0. 0)54 domain.set_quantity('friction', 0.1) 55 55 domain.set_quantity('elevation', island) 56 56 domain.set_quantity('stage', 1) … … 69 69 #Evolution 70 70 import time 71 for t in domain.evolve(yieldstep = 1, finaltime = 40):71 for t in domain.evolve(yieldstep = 1, finaltime = 100): 72 72 domain.write_time() 73 73 -
inundation/pyvolution/shallow_water_ext.c
r2221 r2561 364 364 int k; 365 365 double hc; 366 double vx, vy; 367 double maximum_allowed_speed = 100.0; //FIXME (Ole): Pass in 366 368 367 369 //Protect against initesimal and negative heights … … 371 373 372 374 if (hc < minimum_allowed_height) { 373 if (hc < epsilon) wc[k] = zc[k]; //Contain 'lost mass' error 374 xmomc[k] = 0.0; 375 ymomc[k] = 0.0; 375 if (hc < epsilon) { 376 wc[k] = zc[k]; //Contain 'lost mass' error 377 xmomc[k] = 0.0; 378 ymomc[k] = 0.0; 379 } else { 380 //Try to see if calculated speeds would blow up 381 //FIXME (Ole): This has not been written in Python 382 vx = xmomc[k]/hc; 383 vy = ymomc[k]/hc; 384 if (fabs(vx) > maximum_allowed_speed) { 385 printf("WARNING: Speed has %.3f has been reduced to %.3f\n", 386 vx, maximum_allowed_speed); 387 xmomc[k] = maximum_allowed_speed * hc * vx/fabs(vx); 388 } 389 390 if (fabs(vy) > maximum_allowed_speed) { 391 printf("WARNING: Speed has %.3f has been reduced to %.3f\n", 392 vy, maximum_allowed_speed); 393 ymomc[k] = maximum_allowed_speed * hc * vy/fabs(vy); 394 } 395 396 397 } 376 398 } 377 399
Note: See TracChangeset
for help on using the changeset viewer.