Changeset 2635


Ignore:
Timestamp:
Mar 30, 2006, 12:53:55 PM (19 years ago)
Author:
ole
Message:

Benfield meeting

Location:
inundation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inundation/examples/island.py

    r2632 r2635  
    1616# Application specific imports
    1717from pyvolution.mesh_factory import rectangular
    18 from pyvolution.shallow_water import Domain, Reflective_boundary
     18from pyvolution.shallow_water import Domain, Reflective_boundary, Dirichlet_boundary
    1919from pmesh.mesh_interface import create_mesh_from_regions
    2020from utilities.polygon import Polygon_function, read_polygon
    2121
     22from pyvolution.quantity import Quantity
     23from Numeric import allclose
    2224
    2325#------------------------------------------------------------------------------
     
    3638                                           'left': [3]},
    3739                          maximum_triangle_area = 25,
    38                           filename = 'island.msh',
    39                           interior_regions=[ ([[50,25], [70,25],
    40                                                [70,75], [50,75]], 3)]
     40                          filename = 'island.msh'
     41                          , interior_regions=[ ([[50,25], [70,25], [70,75], [50,75]], 1)]
    4142                          )
    4243                         
     
    7172    for i in range(len(x)):
    7273        z[i] = 8*exp( -((x[i]-50)**2 + (y[i]-50)**2)/100 )
     74
     75        #z[i] += 0.5*exp( -((x[i]-10)**2 + (y[i]-10)**2)/50 )
     76   
    7377    return z
    7478
    75 domain.set_quantity('friction', 2.0)
     79def slump(x, y):
     80    z = 0*x
     81    for i in range(len(x)):
     82        z[i] -= 0.7*exp( -((x[i]-10)**2 + (y[i]-10)**2)/200 )
     83   
     84    return z
     85
     86domain.set_quantity('friction', 0.0)
    7687domain.set_quantity('elevation', island)
    7788domain.set_quantity('stage', 1)
     
    8394
    8495Br = Reflective_boundary(domain)
     96Bd = Dirichlet_boundary([1, 0, 0])
    8597
    86 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
     98#domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
     99domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Bd})
    87100domain.check_integrity()
    88101
     
    93106
    94107import time
    95 for t in domain.evolve(yieldstep = 1, finaltime = 100):
     108for t in domain.evolve(yieldstep = 1, finaltime = 500):
    96109    domain.write_time()
    97 #for t in domain.evolve(yieldstep = 0.05, finaltime = 5):
    98 #    domain.write_time()
    99 #    #print '    Volume: ', domain.get_quantity('stage').get_integral()
     110    if allclose(t, 100):
     111        Q = domain.get_quantity('stage')
     112        Q_s = Quantity(domain)
     113        Q_s.set_values(slump)
     114        domain.set_quantity('stage', Q + Q_s)
     115    #print '    Volume: ', domain.get_quantity('stage').get_integral()
    100116
    101117print 'Done'
  • inundation/examples/island_timeseries.py

    r2632 r2635  
    1111swwfile = 'island.sww'
    1212#gauges = [[56, 48], [58, 48], [60, 48], [62, 48], [64, 48]]
    13 gauges = [[60, 48], [62, 48], [64, 48]]   
     13#gauges = [[10, 10], [60, 48], [62, 48], [64, 48]]   
     14gauges = [[10, 10], [40, 10], [70, 10]]   
    1415
    1516
    16 store = False
     17store = True
    1718
    1819#Read model output
     
    104105    hold(False)
    105106
    106     if elevations[0] < 0:
     107    if elevations[0] <= 0:
    107108        plot(model_time, stages, '-b')
    108109    else:   
  • inundation/pyvolution/shallow_water_ext.c

    r2632 r2635  
    374374   
    375375      //Old code: Set momentum to zero and ensure h is non negative
    376       /*
    377       xmomc[k] = 0.0;
    378       ymomc[k] = 0.0;     
    379       //wc[k] = zc[k];
    380       if (hc <= 0.0) wc[k] = zc[k];
    381       */
     376      //xmomc[k] = 0.0;
     377      //ymomc[k] = 0.0;     
     378      //if (hc <= 0.0) wc[k] = zc[k];
     379     
    382380
    383381      //New code: Adjust momentum to guarantee speeds are physical
    384382      //          ensure h is non negative     
    385    
     383     
     384     
    386385      if (hc <= 0.0) {
    387386        wc[k] = zc[k];
     
    390389      } else {
    391390        //Reduce excessive speeds derived from division by small hc
    392         //FIXME (Ole): This has not been written in Python
    393391        u = xmomc[k]/hc;
    394392        if (fabs(u) > maximum_allowed_speed) {
Note: See TracChangeset for help on using the changeset viewer.