Ignore:
Timestamp:
Feb 3, 2009, 6:22:23 PM (16 years ago)
Author:
ole
Message:

Patong work, buildings, transmissive bdry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/patong/run_patong.py

    r6233 r6264  
    2828from anuga.interface import create_domain_from_regions
    2929from anuga.interface import Dirichlet_boundary
     30from anuga.interface import Transmissive_stage_zero_momentum_boundary
    3031from anuga.interface import Reflective_boundary
    3132from anuga.interface import Field_boundary
     
    122123                    verbose=True)
    123124
    124 
    125 # Add buildings from file
    126 print 'Reading building polygons'   
    127 building_polygons, building_heights = csv2building_polygons(project.building_polygon_file)
    128                                                             #clipping_polygons=project.building_area_polygons)
    129 
    130 print 'Creating %d building polygons' % len(building_polygons)
    131 def create_polygon_function(building_polygons, geo_reference=None):
    132     L = []
    133     for i, key in enumerate(building_polygons):
    134         if i%100==0: print i
    135         poly = building_polygons[key]
    136         elev = building_heights[key]
    137         L.append((poly, elev))
    138 
    139         buildings = Polygon_function(L, default=0.0,
    140                                      geo_reference=geo_reference)
    141     return buildings
    142 
    143 buildings = cache(create_polygon_function,
    144                   building_polygons,
    145                   {'geo_reference': domain.geo_reference},
    146                   verbose=True)
    147 
    148 print 'Adding buildings'
    149 domain.add_quantity('elevation',
    150                     buildings,
    151                     use_cache=True,
    152                     verbose=True)
     125if project.use_buildings:
     126    # Add buildings from file
     127    print 'Reading building polygons'   
     128    building_polygons, building_heights = csv2building_polygons(project.building_polygon_file)
     129    #clipping_polygons=project.building_area_polygons)
     130
     131    print 'Creating %d building polygons' % len(building_polygons)
     132    def create_polygon_function(building_polygons, geo_reference=None):
     133        L = []
     134        for i, key in enumerate(building_polygons):
     135            if i%100==0: print i
     136            poly = building_polygons[key]
     137            elev = building_heights[key]
     138            L.append((poly, elev))
     139           
     140            buildings = Polygon_function(L, default=0.0,
     141                                         geo_reference=geo_reference)
     142        return buildings
     143
     144    buildings = cache(create_polygon_function,
     145                      building_polygons,
     146                      {'geo_reference': domain.geo_reference},
     147                      verbose=True)
     148
     149    print 'Adding buildings'
     150    domain.add_quantity('elevation',
     151                        buildings,
     152                        use_cache=True,
     153                        verbose=True)
    153154
    154155
     
    175176
    176177Br = Reflective_boundary(domain)
    177 Bd = Dirichlet_boundary([project.tide,0,0])
     178#Bd = Dirichlet_boundary([project.tide,0,0])
     179Bs = Transmissive_stage_zero_momentum_boundary(domain)
    178180Bf = Field_boundary(urs_boundary_name+'.sts',
    179181                    domain,
    180182                    mean_stage= project.tide,
    181183                    time_thinning=project.time_thinning,
    182                     default_boundary=Bd,
     184                    default_boundary=Bs,
    183185                    use_cache=True,
    184186                    verbose=True,
     
    186188
    187189domain.set_boundary({'back': Br,
    188                      'side': Bd,
     190                     'side': Bs,
    189191                     'ocean': Bf})
    190192
     
    195197t0 = time.time()
    196198
     199# Skip over the first 5000 seconds
     200for t in domain.evolve(yieldstep=500,
     201                       finaltime=5000):
     202    print domain.timestepping_statistics()
     203    print domain.boundary_statistics(tags='ocean')
     204
     205# Start detailed model
    197206for t in domain.evolve(yieldstep=project.yieldstep,
    198                        finaltime=project.finaltime):
     207                       finaltime=project.finaltime,
     208                       skip_initial_step=True):
    199209    print domain.timestepping_statistics()
    200210    print domain.boundary_statistics(tags='ocean')
Note: See TracChangeset for help on using the changeset viewer.