Changeset 6190
- Timestamp:
- Jan 18, 2009, 12:53:50 PM (16 years ago)
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/__init__.py
r6178 r6190 8 8 # Make selected classes available directly 9 9 from shallow_water_domain import Domain,\ 10 create_domain_from_regions,\11 10 Transmissive_boundary, Reflective_boundary,\ 12 11 Dirichlet_boundary, Time_boundary, File_boundary,\ -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r6178 r6190 115 115 from types import IntType, FloatType 116 116 from warnings import warn 117 118 119 120 #---------------------------121 # Create domain from regions122 #---------------------------123 124 def create_domain_from_regions(bounding_polygon,125 boundary_tags,126 maximum_triangle_area=None,127 mesh_filename=None,128 interior_regions=None,129 interior_holes=None,130 poly_geo_reference=None,131 mesh_geo_reference=None,132 minimum_triangle_angle=28.0,133 fail_if_polygons_outside=True,134 use_cache=False,135 verbose=True):136 """Create domain from bounding polygons and resolutions.137 138 bounding_polygon is a list of points in Eastings and Northings,139 relative to the poly_geo_reference.140 141 Boundary tags is a dictionary of symbolic tags. For every tag there142 is a list of indices referring to segments associated with that tag.143 If a segment is omitted it will be assigned the default tag ''.144 145 maximum_triangle_area is the maximal area per triangle146 for the bounding polygon, excluding the interior regions.147 148 Interior_regions is a list of tuples consisting of (polygon,149 resolution) for each region to be separately refined. Do not have150 polygon lines cross or be on-top of each other. Also do not have151 polygon close to each other.152 153 NOTE: If a interior_region is outside the bounding_polygon it should154 throw an error155 156 Interior_holes is a list of ploygons for each hole.157 158 This function does not allow segments to share points - use underlying159 pmesh functionality for that160 161 poly_geo_reference is the geo_reference of the bounding polygon and162 the interior polygons.163 If none, assume absolute. Please pass one though, since absolute164 references have a zone.165 166 mesh_geo_reference is the geo_reference of the mesh to be created.167 If none is given one will be automatically generated. It was use168 the lower left hand corner of bounding_polygon (absolute)169 as the x and y values for the geo_ref.170 171 Returns the shallow water domain instance172 173 Note, interior regions should be fully nested, as overlaps may cause174 unintended resolutions.175 176 fail_if_polygons_outside: If True (the default) Exception in thrown177 where interior polygons fall outside bounding polygon. If False, these178 will be ignored and execution continued.179 180 181 """182 183 184 # Build arguments and keyword arguments for use with caching or apply.185 args = (bounding_polygon,186 boundary_tags)187 188 kwargs = {'maximum_triangle_area': maximum_triangle_area,189 'mesh_filename': mesh_filename,190 'interior_regions': interior_regions,191 'interior_holes': interior_holes,192 'poly_geo_reference': poly_geo_reference,193 'mesh_geo_reference': mesh_geo_reference,194 'minimum_triangle_angle': minimum_triangle_angle,195 'fail_if_polygons_outside': fail_if_polygons_outside,196 'verbose': verbose} #FIXME (Ole): See ticket:14197 198 # Call underlying engine with or without caching199 if use_cache is True:200 try:201 from anuga.caching import cache202 except:203 msg = 'Caching was requested, but caching module'+\204 'could not be imported'205 raise msg206 207 208 domain = cache(_create_domain_from_regions,209 args, kwargs,210 verbose=verbose,211 compression=False)212 else:213 domain = apply(_create_domain_from_regions,214 args, kwargs)215 216 return domain217 218 219 def _create_domain_from_regions(bounding_polygon,220 boundary_tags,221 maximum_triangle_area=None,222 mesh_filename=None,223 interior_regions=None,224 interior_holes=None,225 poly_geo_reference=None,226 mesh_geo_reference=None,227 minimum_triangle_angle=28.0,228 fail_if_polygons_outside=True,229 verbose=True):230 """_create_domain_from_regions - internal function.231 232 See create_domain_from_regions for documentation.233 """234 235 create_mesh_from_regions(bounding_polygon,236 boundary_tags,237 maximum_triangle_area=maximum_triangle_area,238 interior_regions=interior_regions,239 filename=mesh_filename,240 interior_holes=interior_holes,241 poly_geo_reference=poly_geo_reference,242 mesh_geo_reference=mesh_geo_reference,243 minimum_triangle_angle=minimum_triangle_angle,244 fail_if_polygons_outside=fail_if_polygons_outside,245 use_cache=False,246 verbose=verbose)247 248 domain = Domain(mesh_filename, use_cache=False, verbose=verbose)249 250 251 return domain252 253 254 255 117 256 118 -
anuga_work/production/patong/build_patong.py
r6028 r6190 84 84 G1_clip = G1.clip(project.extent_elev_dir4, verbose=True) 85 85 G3_clip1 = G3.clip_outside(project.extent_elev_dir4, verbose=True) 86 G3_clip2 = G3_clip1.clip_outside(project.extent_elev_dir2, verbose=True)86 G3_clip2 = G3_clip1.clip_outside(project.extent_elev_dir2, verbose=True) 87 87 G4_clip = G4.clip_outside(project.extent_elev_dir3, verbose=True) 88 88 -
anuga_work/production/patong/run_patong.py
r6178 r6190 1 """Script for running a tsunami inundation scenario for P erth, WA, Australia.1 """Script for running a tsunami inundation scenario for Patong Beach, Thailand. 2 2 3 3 The scenario is defined by a triangular mesh created from project.polygon, 4 the elevation data is compiled into a pts file through build_perth.py 5 and a simulated tsunami is generated through an sts file from build_boundary.py. 4 the elevation data is compiled into a pts file through build_patong.py 5 and a simulated tsunami for the 2004 event is generated through 6 an sts file from build_boundary.py. 6 7 7 8 Input: sts file (build_boundary.py) 8 pts file (build_p erth.py)9 pts file (build_patong.py) 9 10 information from project file 10 11 Outputs: sww file stored in project.output_run_time_dir … … 12 13 on the outputs of this script 13 14 14 Ole Nielsen and Duncan Gray, GA - 2005, Jane Sexton, Nick Bartzis, GA - 200615 Ole Nielsen, Jane Sexton and Kristy Van Putten - 200816 15 """ 17 16 … … 27 26 28 27 # Related major packages 29 from anuga.shallow_water import Domain 30 from anuga.shallow_water import Dirichlet_boundary 31 from anuga.shallow_water import File_boundary 32 from anuga.shallow_water import Reflective_boundary 33 from anuga.shallow_water import Field_boundary 34 from anuga.shallow_water.data_manager import export_grid, create_sts_boundary, csv2building_polygons 35 from anuga.shallow_water import create_domain_from_regions 28 from anuga.interface import create_domain_from_regions 29 from anuga.interface import Domain 30 from anuga.interface import Dirichlet_boundary 31 from anuga.interface import File_boundary 32 from anuga.interface import Reflective_boundary 33 from anuga.interface import Field_boundary 34 from anuga.interface import export_grid, create_sts_boundary 35 from anuga.interface import csv2building_polygons 36 36 37 from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files,store_parameters 37 from anuga.caching import myhash38 from anuga.damage_modelling.inundation_damage import add_depth_and_momentum2csv, inundation_damage39 38 from anuga.fit_interpolate.benchmark_least_squares import mem_usage 40 39 from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon … … 178 177 179 178 for t in domain.evolve(yieldstep=project.yieldstep, 180 finaltime=project.finaltime) 179 finaltime=project.finaltime): 181 180 print domain.timestepping_statistics() 182 181 print domain.boundary_statistics(tags='ocean')
Note: See TracChangeset
for help on using the changeset viewer.