Ignore:
Timestamp:
Dec 2, 2004, 11:40:39 PM (20 years ago)
Author:
ole
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/examples/beach.py

    r667 r668  
    1717
    1818from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\
    19      Transmissive_boundary, Time_boundary
     19     Transmissive_boundary, Time_boundary, Wind_stress
    2020
    2121from pmesh2domain import pmesh_to_domain_instance
     
    3838
    3939domain = Domain(domain.coordinates, domain.triangles, domain.boundary)
    40 print "Number of triangles = ", len(domain)
    4140
    4241domain.store = True
     
    5958
    6059def 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
    6262   
    6363
     
    7979
    8080river = [[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], [32,90], [39,100]]
     81         [14,10], [20,30], [24,45], [27,80], [27,85], [35,90], [39,100]]
    8282             
    8383print 'Set elevation'   
    8484domain.set_quantity('elevation',
    8585    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),
    8989                      (river, riverbed)]))
    9090                     
    9191print 'Set level'                     
    9292domain.set_quantity('level',
    93                     Polygon_function( [(shoreline, -1.2),
     93                    Polygon_function( [(shoreline, -1.5),
    9494                    (land, -10)] ))
    9595                   
    9696print 'Set friction'                                       
    97 domain.set_quantity('friction', 0.07)
     97domain.set_quantity('friction', 0.03)
    9898
    9999print domain.get_extent()
     100
     101
     102
     103#Add lateral wind gusts bearing 135 degrees
     104def 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   
     117domain.forcing_terms.append(Wind_stress(gust, 135))
     118
    100119
    101120######################
     
    104123print 'Boundaries'
    105124Br = Reflective_boundary(domain)
    106 Bt = Transmissive_boundary(domain)
     125Bo = Transmissive_boundary(domain)
    107126
    108127#Constant inflow
    109128Bd = 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])
     129Bt = Time_boundary(domain, lambda t: [ 3.0*(1+sin(2*pi*t/100)), 0.0, 0.0])
    111130
    112131print 'Available boundary tags are', domain.get_boundary_tags()
     
    116135tags['ocean'] = Bt
    117136tags['wall'] = Br
     137tags['outflow'] = Bo
    118138tags['exterior'] = Br
    119139tags['external'] = Br
     
    125145######################
    126146#Evolution
    127 for t in domain.evolve(yieldstep = 0.5, finaltime = 100):
     147for t in domain.evolve(yieldstep = 0.2, finaltime = 500):
    128148    domain.write_time()
    129149   
Note: See TracChangeset for help on using the changeset viewer.