Changeset 6264


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

Patong work, buildings, transmissive bdry

Location:
anuga_work/production/patong
Files:
2 edited

Legend:

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

    r6233 r6264  
    4848finaltime=15000         # final time for simulation 15000
    4949
    50 setup='basic'  # Final can be replaced with trial or basic.
     50setup='final'  # Final can be replaced with trial or basic.
    5151               # Either will result in a coarser mesh that will allow a
    5252               # faster, but less accurate, simulation.
     
    6868    yieldstep=10
    6969
     70use_buildings = True
     71
    7072#------------------------------------------------------------------------------
    7173# Output Filename
     
    7375# Important to distinguish each run - ensure str(user) is included!
    7476# Note, the user is free to include as many parameters as desired
    75 dir_comment='_'+setup+'_'+str(tide)+'_buildings_'+str(user)
     77if use_buildings:
     78    dir_comment='_'+setup+'_'+str(tide)+'_buildings_'+str(user)
     79else:
     80    dir_comment='_'+setup+'_'+str(tide)+'_nobuildings_'+str(user)   
    7681
    7782#------------------------------------------------------------------------------
     
    170175# Initial bounding polygon for data clipping
    171176poly_all = read_polygon(polygons_dir+'poly_all.csv')
    172 res_poly_all = 100000*res_factor
     177res_poly_all = 150000*res_factor
     178
     179
     180# Inundation area
     181poly_ia = read_polygon(polygons_dir+'inundation_area.csv')
     182res_ia = 75*res_factor
     183poly_saddle = read_polygon(polygons_dir+'saddle_10m.txt')
    173184
    174185# Area of Interest 1 elevation from -10m to 20m
     
    178189# Area of Significance 1 elevation from -20m to a 200m buffer of the 20m contour
    179190poly_aos1 = read_polygon(polygons_dir+'aos.csv')
    180 res_aos1 = 700*res_factor
     191res_aos1 = 900*res_factor
     192
    181193
    182194# Area of Shallow water and coastal land that needs a finer res than 1000000
    183 # This is a rectangle.
    184195poly_sw = read_polygon(polygons_dir+'sw.csv')
    185196res_sw = 6000*res_factor
     197
    186198
    187199
     
    198210
    199211# Combined all regions, must check that all are included!
    200 interior_regions = [[poly_aoi1,res_aoi1],
     212interior_regions = [[poly_ia, res_ia],
     213                    #[poly_saddle, res_ia],
     214                    [poly_aoi1,res_aoi1],
    201215                    [poly_aos1,res_aos1],
    202216                    [poly_sw,res_sw],
  • 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.