Changeset 2561


Ignore:
Timestamp:
Mar 21, 2006, 8:33:34 AM (18 years ago)
Author:
ole
Message:

Allowed particle speeds to be calculated even if depth i sless than minimum_allowed_height. A new protection, called maximum_allowed_speed, which is much less restrictive, has been suggested.

Location:
inundation/pyvolution
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/island.py

    r1280 r2561  
    1313     Constant_height
    1414from Numeric import array
    15 from util import Polygon_function, read_polygon
     15from utilities.polygon import Polygon_function, read_polygon
    1616from math import exp
    1717
     
    2323#Create shallow water domain
    2424domain = Domain(points, vertices, boundary)
    25 domain.store = False
     25domain.store = True
    2626domain.smooth = False
    27 domain.visualise = True
     27domain.visualise = False
    2828domain.set_name('island')
    2929print 'Output being written to ' + domain.get_datadir() + sep + \
     
    5252    return z
    5353
    54 domain.set_quantity('friction', 0.0)
     54domain.set_quantity('friction', 0.1)
    5555domain.set_quantity('elevation', island)
    5656domain.set_quantity('stage', 1)
     
    6969#Evolution
    7070import time
    71 for t in domain.evolve(yieldstep = 1, finaltime = 40):
     71for t in domain.evolve(yieldstep = 1, finaltime = 100):
    7272    domain.write_time()
    7373
  • inundation/pyvolution/shallow_water_ext.c

    r2221 r2561  
    364364  int k;
    365365  double hc;
     366  double vx, vy; 
     367  double maximum_allowed_speed = 100.0;  //FIXME (Ole): Pass in
    366368
    367369  //Protect against initesimal and negative heights
     
    371373
    372374    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      }
    376398    }
    377399
Note: See TracChangeset for help on using the changeset viewer.