Changeset 4939
- Timestamp:
- Jan 15, 2008, 7:20:01 PM (15 years ago)
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/joaqium_luis/run.py
r4925 r4939 28 28 from anuga.abstract_2d_finite_volumes.util import file_function 29 29 30 from anuga.caching import cache 31 from anuga.utilities.polygon import read_polygon, plot_polygons, \ 32 polygon_area, is_inside_polygon 30 33 31 34 #------------------------------------------------------------------------------ … … 37 40 os.mkdir(scenario) 38 41 basename = scenario + 'source' 42 43 #------------------ 44 # Initial condition 45 #------------------ 46 tide = 0.0 47 39 48 40 49 #------------------------------------------------------------------------------ … … 49 58 meshname = 'bocarra.msh' 50 59 51 # Create DEM from asc data52 #convert_dem_from_ascii2netcdf(dem_name, use_cache=True, verbose=True)53 60 54 # Create pts file for onshore DEM 55 #dem2pts(dem_name, use_cache=True, verbose=True) 56 57 from anuga.utilities.polygon import read_polygon, plot_polygons, \ 58 polygon_area, is_inside_polygon 59 60 ############################### 61 # Domain definitions 62 ############################### 61 #--------- 62 # Polygons 63 #--------- 63 64 64 65 # bounding polygon for study area … … 67 68 print 'Area of bounding polygon in km?', polygon_area(bounding_polygon)/1000000.0 68 69 69 ###############################70 # Interior region definitions71 ###############################72 73 70 # interior polygons 74 71 #poly_midle = read_polygon('midle_rect.csv') 75 72 poly_shallow = read_polygon('shallow.csv') 76 73 77 #------------------------------------------------------------------------------78 # Create the triangular mesh based on overall clipping polygon with a tagged79 # boundary and interior regions defined in project.py along with80 # resolutions (maximal area of per triangle) for each polygon81 #------------------------------------------------------------------------------82 74 75 #------------ 76 # Resolutions 77 #------------ 83 78 remainder_res = 2000 84 79 midle_res = 3500 85 80 shallow_res = 100 86 interior_regions = [[bounding_polygon, remainder_res], [poly_shallow, shallow_res]]87 #interior_regions = [[bounding_polygon, remainder_res], [poly_midle, midle_res], [poly_shallow, shallow_res]]88 81 89 create_mesh_from_regions(bounding_polygon, 90 boundary_tags={'west': [0], 91 'north': [1], 92 'east': [2], 93 'south': [3]}, 94 maximum_triangle_area=remainder_res, 95 filename=meshname, 96 interior_regions=interior_regions, 97 use_cache=True, verbose=True) 82 interior_regions = [[poly_shallow, shallow_res]] 98 83 99 #------------------------------------------------------------------------------ 100 # Setup computational domain 101 #------------------------------------------------------------------------------ 84 def setup_domain(tide, 85 bounding_polygon, 86 remainder_res, 87 interior_regions, 88 mesh_filename, 89 points_filename): 90 """Set up domain except boundary conditions 91 This function is defined in order to cache it. 92 """ 102 93 103 domain = Domain(meshname, use_cache=True, verbose=True)104 94 105 print 'Number of triangles = ', len(domain)106 print 'The extent is ', domain.get_extent()107 print domain.statistics()108 95 109 domain.set_name(basename)110 domain.set_datadir(scenario)111 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])112 #domain.set_quantities_to_be_stored('stage')113 domain.set_minimum_storable_height(0.05)114 96 115 #------------------------------------------------------------------------------116 # Setup initial conditions117 #------------------------------------------------------------------------------118 97 119 tide = 0.0 120 domain.set_quantity('stage', tide) 121 domain.set_quantity('friction', 0.025) 122 domain.set_quantity('elevation', filename=dem_name + '.pts', 123 use_cache=True, verbose=True, alpha=0.1) 98 create_mesh_from_regions(bounding_polygon, 99 boundary_tags={'west': [0], 100 'north': [1], 101 'east': [2], 102 'south': [3]}, 103 maximum_triangle_area=remainder_res, 104 filename=mesh_filename, 105 interior_regions=interior_regions, 106 use_cache=False, 107 verbose=True) 108 109 #-------------------------------------------------------------------------- 110 # Setup computational domain 111 #-------------------------------------------------------------------------- 112 113 domain = Domain(mesh_filename, 114 use_cache=False, 115 verbose=True) 116 117 print 'Number of triangles = ', len(domain) 118 print 'The extent is ', domain.get_extent() 119 print domain.statistics() 120 121 domain.set_name(basename) 122 domain.set_datadir(scenario) 123 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 124 domain.set_minimum_storable_height(0.05) 125 126 #-------------------------------------------------------------------------- 127 # Setup initial conditions 128 #-------------------------------------------------------------------------- 129 130 domain.set_quantity('stage', tide) 131 domain.set_quantity('friction', 0.025) 132 domain.set_quantity('elevation', 133 filename=points_filename, 134 use_cache=False, 135 verbose=True) 136 137 return domain 138 139 140 #-------------------------------- 141 # Call (and cache) setup function 142 #-------------------------------- 143 144 # Run set_up domain without caching 145 #domain = setup_domain(tide, bounding_polygon, poly_shallow, 146 # remainder_res, midle_res, shallow_res, 147 # meshname, 148 # dem_name + '.pts') 149 150 # Run set_up domain with caching 151 domain = cache(setup_domain, 152 (tide, 153 bounding_polygon, 154 remainder_res, 155 interior_regions, 156 meshname, 157 dem_name + '.pts'), 158 #dependencies = 159 verbose=True) 160 161 124 162 125 163 #------------------------------------------------------------------------------ … … 127 165 #------------------------------------------------------------------------------ 128 166 129 # Create boundary function from timeseries provided in file130 #function1 = file_function('mareg.tms', domain, verbose=True)131 132 # Create and assign boundary objects133 #Bts1 = Transmissive_Momentum_Set_Stage_boundary(domain, function1)134 135 167 print 'Available boundary tags', domain.get_boundary_tags() 136 #Bt = Transmissive_boundary(domain) # Continue all values on boundary137 168 Br = Reflective_boundary(domain) 138 169 Bd = Dirichlet_boundary([tide,0,0]) … … 140 171 use_cache=True, verbose=True) 141 172 142 # Boundary condition for sww feed at the east boundary173 # Boundary condition for sww feed at the east boundary 143 174 domain.set_boundary({'west': Bf,'south':Bf,'east': Br,'north': Br}) 175 144 176 145 177 #------------------------------------------------------------------------------ … … 153 185 from anuga.abstract_2d_finite_volumes.quantity import Quantity 154 186 155 156 # save every 1 sec leading up to wave approaching land 187 # Save every 1 sec leading up to wave approaching land 157 188 for t in domain.evolve(yieldstep = 10, finaltime = 90): 158 189 domain.write_time() -
create_distribution.py
r4931 r4939 29 29 from anuga.abstract_2d_finite_volumes.util import store_version_info 30 30 from anuga.anuga_config import major_revision 31 32 from anuga.utilities.data_audit import identify_data_files 31 33 32 34 … … 118 120 119 121 120 from data_audit import identify_data_files121 122 identify_data_files(distro_dir) 122 123
Note: See TracChangeset
for help on using the changeset viewer.