Changeset 3624
- Timestamp:
- Sep 19, 2006, 4:23:39 PM (17 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/general_mesh.py
r3560 r3624 81 81 82 82 #Input checks 83 msg = 'Triangles must an Nx3 Numeric array or a sequence of 3-tuples' 83 msg = 'Triangles must an Nx3 Numeric array or a sequence of 3-tuples. ' 84 msg += 'The supplied array has the shape: %s'\ 85 %str(self.triangles.shape) 84 86 assert len(self.triangles.shape) == 2, msg 85 87 86 88 msg = 'Coordinates must an Mx2 Numeric array or a sequence of 2-tuples' 89 msg += 'The supplied array has the shape: %s'\ 90 %str(self.coordinates.shape) 87 91 assert len(self.coordinates.shape) == 2, msg 88 92 -
anuga_core/source/anuga/pmesh/mesh_interface.py
r3616 r3624 158 158 return m 159 159 else: 160 if verbose: print 'Generating mesh to file "%s"' %filename 160 161 m.generate_mesh(minimum_triangle_angle=minimum_triangle_angle, 161 162 verbose=verbose) -
anuga_core/source/anuga_parallel/parallel_api.py
r3612 r3624 45 45 46 46 47 # Distribute boundary conditions 47 # Distribute boundary conditions 48 # FIXME: This cannot handle e.g. Time_boundaries due to 49 # difficulties pickling functions 48 50 if myid == 0: 49 51 boundary_map = domain.boundary_map -
anuga_work/production/wollongong_2006/project.py
r3105 r3624 7 7 8 8 # Making assumptions about the location of scenario data 9 scenario_dirname = ' wollongong_tsunami_scenario_2006'9 scenario_dirname = 'new_south_wales'+s+'wollongong_tsunami_scenario_2006'+s+'anuga' 10 10 11 11 # Filenames -
anuga_work/production/wollongong_2006/run_flagstaff_parallel_api.py
r3585 r3624 31 31 from anuga.pmesh.mesh import importUngenerateFile, Segment 32 32 33 from anuga.caching import cache 33 # Parallelism 34 import pypar # The Python-MPI interface 35 from anuga_parallel.pmesh_divide import pmesh_divide_metis 36 from anuga_parallel.build_submesh import build_submesh 37 from anuga_parallel.build_local import build_local_mesh 38 from anuga_parallel.build_commun import send_submesh, rec_submesh, extract_hostmesh 39 from anuga_parallel.parallel_shallow_water import Parallel_Domain 34 40 35 # Parallelism 36 from parallel_api import * 41 from anuga_parallel.parallel_api import * 37 42 38 43 # Application specific imports 39 44 import project 40 45 41 # Sequential part 46 42 47 if myid == 0: 43 48 … … 48 53 #-------------------------------------------------------------------------- 49 54 55 50 56 print 'Generate mesh' 51 57 # Generate basic mesh 52 58 max_area = project.base_resolution 53 54 55 mesh = cache(create_mesh_from_regions, 56 project.bounding_polygon, 57 {'boundary_tags': project.boundary_tags, 58 'maximum_triangle_area':max_area, 59 'interior_regions': project.interior_regions}, 60 verbose=True) 59 mesh = create_mesh_from_regions(project.bounding_polygon, 60 boundary_tags=project.boundary_tags, 61 maximum_triangle_area=max_area, 62 interior_regions=project.interior_regions) 61 63 62 64 # Add buildings that will bind to a Reflective boundary … … 80 82 domain.set_datadir(project.outputdir) 81 83 82 83 #------------------------------------------------------------------------------84 # Setup initial conditions85 #------------------------------------------------------------------------------86 84 domain.set_quantity('stage', project.initial_sealevel) 87 domain.set_quantity('friction', 0.03) 85 domain.set_quantity('friction', 0.03) 88 86 domain.set_quantity('elevation', 89 87 filename=project.demname + '.pts', … … 91 89 verbose=True) 92 90 91 #------------------------------------------------------------------------------ 92 # Setup boundary conditions 93 #------------------------------------------------------------------------------ 94 95 96 D = Dirichlet_boundary([project.initial_sealevel, 0, 0]) 97 R = Reflective_boundary(domain) 98 domain.set_boundary({'exterior': D, 99 'side': D, 100 'wall': R, 101 'ocean': None}) # This one to be bound later 102 else: 103 domain = None 104 105 106 107 domain = distribute(domain) 93 108 94 109 95 110 96 #--------------- 97 # Parallel stuff 98 #--------------- 99 100 if myid == 0: 101 # Distribute the domain 102 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict,\ 103 = distribute_mesh(domain) 104 105 106 domain_name = domain.get_name() 107 domain_dir = domain.get_datadir() 108 109 for p in range(pypar.size()): 110 pypar.send((domain_name, domain_dir), p) 111 112 print 'Communication done' 113 114 else: 115 # Read in the mesh partition that belongs to this 116 # processor (note that the information is in the 117 # correct form for the GA data structure) 118 119 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict, \ 120 = rec_submesh(0) 121 122 print 'P %d receiving names' %myid 123 X = pypar.receive(0) 124 print X 125 (domain_name, domain_dir) = X 126 127 128 129 #------------------------------------------------------------------------------ 130 # Start the computations on each subpartion 131 #------------------------------------------------------------------------------ 132 133 134 135 # Build the domain for this processor 136 domain = Parallel_Domain(points, vertices, boundary, 137 full_send_dict = full_send_dict, 138 ghost_recv_dict = ghost_recv_dict) 139 140 # Name and dir, etc currently has to be set here as they are not transferred from the 141 # original domain 142 domain.set_name(domain_name) 143 domain.set_datadir(domain_dir) 144 145 146 #------------------------------------------------------------------------------ 147 # Setup initial conditions 148 #------------------------------------------------------------------------------ 149 for q in quantities: 150 domain.set_quantity(q, quantities[q]) # Distribute elevation 151 152 153 #domain.set_quantity('elevation', quantities['elevation']) # Distribute elevation 154 #domain.set_quantity('stage', project.initial_sealevel) 155 #domain.set_quantity('friction', 0.03) 156 157 158 #------------------------------------------------------------------------------ 159 # Setup boundary conditions 160 #------------------------------------------------------------------------------ 161 162 D = Dirichlet_boundary([project.initial_sealevel, 0, 0]) 163 R = Reflective_boundary(domain) 111 # Set those boundaries that can't be pickled here using boundary_map. 164 112 W = Time_boundary(domain = domain, 165 113 f=lambda t: [project.initial_sealevel + (60<t<480)*6, 0, 0]) 166 114 167 domain.set_boundary({'exterior': D, 168 'side': D, 169 'wall': R, 170 'ocean': W, 171 'ghost': None}) 115 boundary_map = domain.boundary_map 116 boundary_map['ocean'] = W 117 domain.set_boundary(boundary_map) 172 118 173 119
Note: See TracChangeset
for help on using the changeset viewer.