Changeset 9001
- Timestamp:
- Oct 5, 2013, 9:47:07 AM (11 years ago)
- Location:
- trunk/anuga_core
- Files:
-
- 1 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/__init__.py
r8980 r9001 32 32 33 33 from anuga.shallow_water.shallow_water_domain import Domain 34 35 34 from anuga.abstract_2d_finite_volumes.quantity import Quantity 36 37 from anuga.operators.region import Region 35 from anuga.abstract_2d_finite_volumes.region import Region 36 38 37 39 38 from anuga.abstract_2d_finite_volumes.util import file_function, \ -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py
r9000 r9001 895 895 896 896 if len(args) == 1: 897 self._set_ region(*args, **kwargs)897 self._set_tag_region(*args, **kwargs) 898 898 else: 899 899 # Assume it is arguments for the region.set_region function 900 900 func = region_set_tag_region(*args, **kwargs) 901 self._set_ region(func)901 self._set_tag_region(func) 902 902 903 903 def _set_tag_region(self, functions): -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/tag_region.py
r9000 r9001 11 11 12 12 13 class Region:13 class Tag_region: 14 14 """Base class for modifying quantities based on a region. 15 15 """ … … 32 32 return elements 33 33 34 class Set_ region(Region):34 class Set_tag_region(Tag_region): 35 35 36 36 def __init__(self, tag, quantity, X, location='vertices'): … … 42 42 """ 43 43 44 Region.__init__(self)44 Tag_region.__init__(self) 45 45 self.tag = tag 46 46 self.quantity = quantity … … 61 61 62 62 63 class Add_value_to_region( Region):63 class Add_value_to_region(Tag_region): 64 64 """ 65 65 Will add a value to the current quantity value. … … 114 114 location=self.location) 115 115 116 class Add_quantities( Region):116 class Add_quantities(Tag_region): 117 117 """ 118 118 Will add a quantity to the current quantity value. … … 157 157 158 158 159 class Stage_no_less_than_elevation( Region):159 class Stage_no_less_than_elevation(Tag_region): 160 160 """ 161 161 Will set the stage to not be less than the elevation. -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_generic_domain.py
r8999 r9001 815 815 816 816 domain.build_tagged_elements_dictionary({'mound':[0,1]}) 817 domain.set_ region([add_to_verts])817 domain.set_tag_region([add_to_verts]) 818 818 819 819 self.failUnless(domain.test == "Mound", -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/test_tag_region.py
r9000 r9001 7 7 from anuga.shallow_water.shallow_water_domain import Domain 8 8 from generic_domain import Generic_Domain 9 from region import *9 from tag_region import * 10 10 #from anuga.config import epsilon 11 11 … … 59 59 domain.set_quantity('friction', manning) 60 60 61 a = Set_ region('bottom', 'friction', 0.09)62 b = Set_ region('top', 'friction', 1.0)63 domain.set_ region([a, b])61 a = Set_tag_region('bottom', 'friction', 0.09) 62 b = Set_tag_region('top', 'friction', 1.0) 63 domain.set_tag_region([a, b]) 64 64 65 65 expected = [[ 0.09, 0.09, 0.09], … … 76 76 77 77 #c = Add_Value_To_region('all', 'friction', 10.0) 78 domain.set_ region(Add_value_to_region('all', 'friction', 10.0))78 domain.set_tag_region(Add_value_to_region('all', 'friction', 10.0)) 79 79 #print domain.quantities['friction'].get_values() 80 80 assert num.allclose(domain.quantities['friction'].get_values(), … … 87 87 88 88 # trying a function 89 domain.set_ region(Set_region('top', 'friction', add_x_y))89 domain.set_tag_region(Set_tag_region('top', 'friction', add_x_y)) 90 90 #print domain.quantities['friction'].get_values() 91 91 assert num.allclose(domain.quantities['friction'].get_values(), … … 99 99 domain.set_quantity('elevation', 10.0) 100 100 domain.set_quantity('stage', 10.0) 101 domain.set_ region(Add_value_to_region('top', 'stage', 1.0,initial_quantity='elevation'))101 domain.set_tag_region(Add_value_to_region('top', 'stage', 1.0,initial_quantity='elevation')) 102 102 #print domain.quantities['stage'].get_values() 103 103 assert num.allclose(domain.quantities['stage'].get_values(), … … 116 116 # domain.quantities['stage'].vertex_values+ \ 117 117 # domain.quantities['elevation'].vertex_values) 118 domain.set_ region(Add_quantities('top', 'elevation','stage'))118 domain.set_tag_region(Add_quantities('top', 'elevation','stage')) 119 119 #print domain.quantities['stage'].get_values() 120 120 assert num.allclose(domain.quantities['elevation'].get_values(), … … 142 142 domain.set_quantity('friction', manning) 143 143 144 a = Set_ region('bottom', 'friction', 0.09, location = 'unique vertices')145 domain.set_ region(a)144 a = Set_tag_region('bottom', 'friction', 0.09, location = 'unique vertices') 145 domain.set_tag_region(a) 146 146 assert num.allclose(domain.quantities['friction'].get_values(), 147 147 [[ 0.09, 0.09, 0.09], … … 171 171 domain.set_quantity('friction', manning) 172 172 173 domain.set_ region(Add_value_to_region('bottom', 'friction', 1.0,initial_quantity='friction', location = 'unique vertices'))173 domain.set_tag_region(Add_value_to_region('bottom', 'friction', 1.0,initial_quantity='friction', location = 'unique vertices')) 174 174 175 175 #print domain.quantities['friction'].get_values() … … 199 199 add = 60.0 200 200 calc_frict = av_bottom + add 201 domain.set_ region(Add_value_to_region('bottom', 'friction', add,201 domain.set_tag_region(Add_value_to_region('bottom', 'friction', add, 202 202 initial_quantity='friction', 203 203 location='vertices', … … 233 233 add = 60.0 234 234 calc_frict = av_bottom + add 235 domain.set_ region(Add_value_to_region('bottom', 'friction', add,235 domain.set_tag_region(Add_value_to_region('bottom', 'friction', add, 236 236 initial_quantity='friction', 237 237 location='unique vertices', -
trunk/anuga_core/source/anuga/operators/erosion_operators.py
r8945 r9001 16 16 from anuga import Quantity 17 17 from anuga.operators.base_operator import Operator 18 from anuga .operators.regionimport Region18 from anuga import Region 19 19 20 20 -
trunk/anuga_core/source/anuga/operators/rate_operators.py
r8978 r9001 19 19 from anuga import Quantity 20 20 from anuga.operators.base_operator import Operator 21 from anuga .operators.regionimport Region21 from anuga import Region 22 22 23 23 class Rate_operator(Operator,Region): -
trunk/anuga_core/source/anuga/operators/set_friction_operators.py
r8974 r9001 14 14 15 15 from anuga.operators.base_operator import Operator 16 from anuga .operators.regionimport Region16 from anuga import Region 17 17 from anuga.config import indent 18 18 -
trunk/anuga_core/source/anuga/operators/set_quantity.py
r8974 r9001 16 16 from anuga.geometry.polygon import inside_polygon 17 17 from anuga.utilities.function_utils import determine_function_type 18 from anuga .operators.regionimport Region18 from anuga import Region 19 19 from anuga.config import indent 20 20 -
trunk/anuga_core/source/anuga/operators/test_set_stage_operator.py
r8930 r9001 16 16 17 17 import numpy as num 18 from pprint import pprint 18 19 import warnings 19 20 import time … … 227 228 width = 2.0 228 229 dx = dy = 0.5 230 #dx = dy = 0.1 229 231 domain = rectangular_cross_domain(int(length/dx), int(width/dy), 230 232 len1=length, len2=width) … … 256 258 operator = Polygonal_set_stage_operator(domain, stage=stage, polygon=polygon) 257 259 260 261 #operator.plot_region() 262 258 263 # Apply Operator at time t=1.0 259 264 domain.set_time(1.0) 260 265 operator() 266 267 268 stage_ex_expanded = \ 269 [ 1., 1., 5., 5., 1., 5., 5., 5., 1., 5., 5., 5., 1., 270 5., 5., 1., 5., 1., 5., 5., 5., 5., 5., 5., 5., 5., 271 5., 5., 5., 5., 5., 1., 5., 1., 5., 5., 5., 5., 5., 272 5., 5., 5., 5., 5., 5., 5., 5., 1., 5., 1., 1., 5., 273 5., 5., 1., 5., 5., 5., 1., 5., 5., 5., 1., 1.] 261 274 262 275 stage_ex = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, … … 270 283 271 284 # print domain.quantities['elevation'].centroid_values 272 # p rint domain.quantities['stage'].centroid_values285 # pprint(domain.quantities['stage'].centroid_values) 273 286 # print domain.quantities['xmomentum'].centroid_values 274 287 # print domain.quantities['ymomentum'].centroid_values … … 281 294 domain.set_time(15.0) 282 295 operator() 296 297 stage_ex_expanded = \ 298 [ 1., 1., 7., 7., 1., 7., 7., 7., 1., 7., 7., 7., 1., 299 7., 7., 1., 7., 1., 7., 7., 7., 7., 7., 7., 7., 7., 300 7., 7., 7., 7., 7., 1., 7., 1., 7., 7., 7., 7., 7., 301 7., 7., 7., 7., 7., 7., 7., 7., 1., 7., 1., 1., 7., 302 7., 7., 1., 7., 7., 7., 1., 7., 7., 7., 1., 1.] 303 283 304 284 305 stage_ex = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, … … 291 312 292 313 293 # p rint domain.quantities['stage'].centroid_values314 # pprint(domain.quantities['stage'].centroid_values) 294 315 # print domain.quantities['xmomentum'].centroid_values 295 316 # print domain.quantities['ymomentum'].centroid_values -
trunk/anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r8996 r9001 8269 8269 8270 8270 8271 def test_ region_tags(self):8271 def test_tag_region_tags(self): 8272 8272 """ 8273 8273 get values based on triangle lists. … … 8289 8289 domain.set_quantity('friction', manning) 8290 8290 8291 domain.set_ region([set_bottom_friction, set_top_friction])8291 domain.set_tag_region([set_bottom_friction, set_top_friction]) 8292 8292 assert num.allclose(domain.quantities['friction'].get_values(),\ 8293 8293 [[ 0.09, 0.09, 0.09], … … 8298 8298 [ 1.0, 1.0, 1.0]]) 8299 8299 8300 domain.set_ region([set_all_friction])8300 domain.set_tag_region([set_all_friction]) 8301 8301 assert num.allclose(domain.quantities['friction'].get_values(), 8302 8302 [[ 10.09, 10.09, 10.09], … … 8328 8328 domain.set_quantity('friction', manning) 8329 8329 8330 domain.set_ region('top', 'friction', 1.0)8331 domain.set_ region('bottom', 'friction', 0.09)8330 domain.set_tag_region('top', 'friction', 1.0) 8331 domain.set_tag_region('bottom', 'friction', 0.09) 8332 8332 8333 8333 msg = ("domain.quantities['friction'].get_values()=\n%s\n" … … 8348 8348 [ 1.0, 1.0, 1.0]]), msg 8349 8349 8350 domain.set_ region([set_bottom_friction, set_top_friction])8350 domain.set_tag_region([set_bottom_friction, set_top_friction]) 8351 8351 assert num.allclose(domain.quantities['friction'].get_values(), 8352 8352 [[ 0.09, 0.09, 0.09], … … 8357 8357 [ 1.0, 1.0, 1.0]]) 8358 8358 8359 domain.set_ region([set_all_friction])8359 domain.set_tag_region([set_all_friction]) 8360 8360 assert num.allclose(domain.quantities['friction'].get_values(), 8361 8361 [[ 10.09, 10.09, 10.09], -
trunk/anuga_core/source/anuga/structures/inlet.py
r8994 r9001 2 2 from anuga.geometry.polygon import inside_polygon, is_inside_polygon, line_intersect 3 3 from anuga.config import velocity_protection, g 4 from anuga import Region 5 4 6 import math 7 5 8 6 9 import numpy as num … … 16 19 self.poly = num.asarray(poly, dtype=num.float64) 17 20 self.verbose = verbose 18 19 self.line = True 20 if len(self.poly) > 2: 21 self.line = False 22 23 self.compute_triangle_indices() 21 22 23 # poly can be either a line, polygon or a regions 24 if isinstance(poly,Region): 25 #print "is region" 26 self.region = poly 27 else: 28 self.region = Region(domain,poly=poly,expand_polygon=True) 29 #print 'is line or polygon' 30 31 32 #self.line = True 33 #if len(self.poly) > 2: 34 # self.line = False 35 36 self.triangle_indices = self.region.indices 37 38 #print self.triangle_indices 39 #print poly 40 #print self.triangle_indices 41 42 #self.compute_triangle_indices() 24 43 self.compute_area() 25 44 #self.compute_inlet_length() … … 27 46 28 47 29 def compute_triangle_indices(self):30 31 # Get boundary (in absolute coordinates)32 bounding_polygon = self.domain_bounding_polygon33 domain_centroids = self.domain.get_centroid_coordinates(absolute=True)34 vertex_coordinates = self.domain.get_vertex_coordinates(absolute=True)35 36 if self.line: # poly is a line37 # Check that line lies within the mesh.38 for point in self.poly:39 msg = 'Point %s ' % str(point)40 msg += ' did not fall within the domain boundary.'41 assert is_inside_polygon(point, bounding_polygon), msg48 ## def compute_triangle_indices(self): 49 50 ## # Get boundary (in absolute coordinates) 51 ## bounding_polygon = self.domain_bounding_polygon 52 ## domain_centroids = self.domain.get_centroid_coordinates(absolute=True) 53 ## vertex_coordinates = self.domain.get_vertex_coordinates(absolute=True) 54 55 ## if self.line: # poly is a line 56 ## # Check that line lies within the mesh. 57 ## for point in self.poly: 58 ## msg = 'Point %s ' % str(point) 59 ## msg += ' did not fall within the domain boundary.' 60 ## assert is_inside_polygon(point, bounding_polygon), msg 42 61 43 self.triangle_indices = line_intersect(vertex_coordinates, self.poly)44 45 else: # poly is a polygon46 47 tris_0 = line_intersect(vertex_coordinates, [self.poly[0],self.poly[1]])48 tris_1 = inside_polygon(domain_centroids, self.poly)49 #print 40*"="50 #print tris_051 #print tris_152 self.triangle_indices = num.union1d(tris_0, tris_1)53 #print self.triangle_indices54 55 if len(self.triangle_indices) == 0:56 msg = 'Inlet poly=%s ' % (self.poly)57 msg += 'No triangle centroids intersecting poly '58 raise Exception, msg62 ## self.triangle_indices = line_intersect(vertex_coordinates, self.poly) 63 64 ## else: # poly is a polygon 65 66 ## tris_0 = line_intersect(vertex_coordinates, [self.poly[0],self.poly[1]]) 67 ## tris_1 = inside_polygon(domain_centroids, self.poly) 68 ## #print 40*"=" 69 ## #print tris_0 70 ## #print tris_1 71 ## self.triangle_indices = num.union1d(tris_0, tris_1) 72 ## #print self.triangle_indices 73 74 ## if len(self.triangle_indices) == 0: 75 ## msg = 'Inlet poly=%s ' % (self.poly) 76 ## msg += 'No triangle centroids intersecting poly ' 77 ## raise Exception, msg 59 78 60 79 -
trunk/anuga_core/source/anuga/structures/inlet_enquiry.py
r8994 r9001 13 13 def __init__(self, 14 14 domain, 15 poly,15 region, 16 16 enquiry_pt, 17 17 invert_elevation = None, … … 19 19 verbose=False): 20 20 """ 21 poly can be a line or a polygon21 region can be a line or a polygon or a region object 22 22 """ 23 23 24 #print region 25 #print enquiry_pt 26 27 inlet.Inlet.__init__(self, domain, region, verbose) 24 28 25 inlet.Inlet.__init__(self, domain, poly, verbose)26 29 30 27 31 self.enquiry_pt = enquiry_pt 28 32 self.invert_elevation = invert_elevation -
trunk/anuga_core/source/anuga/structures/inlet_operator.py
r8874 r9001 154 154 message += '\n' 155 155 156 message += ' polyline\n'157 message += '%s' % inlet .line156 message += 'region\n' 157 message += '%s' % inlet 158 158 message += '\n' 159 159 -
trunk/anuga_core/source/anuga/structures/structure_operator.py
r8994 r9001 51 51 52 52 anuga.Operator.__init__(self,domain) 53 53 54 self.master_proc = 0 54 55 self.end_points = ensure_numeric(end_points) 55 56 self.exchange_lines = ensure_numeric(exchange_lines) … … 438 439 message += '\n' 439 440 440 message += ' line\n'441 message += '%s' % inlet. line441 message += 'region\n' 442 message += '%s' % inlet.region 442 443 message += '\n' 443 444 -
trunk/anuga_core/source/anuga_parallel/parallel_inlet.py
r8875 r9001 64 64 else: # poly is a polygon 65 65 66 self.triangle_indices = inside_polygon(domain_centroids, self.poly) 67 66 tris_0 = line_intersect(vertex_coordinates, [self.poly[0],self.poly[1]]) 67 tris_1 = inside_polygon(domain_centroids, self.poly) 68 self.triangle_indices = num.union1d(tris_0, tris_1) 69 #print self.triangle_indices 68 70 69 71 for i in self.triangle_indices: -
trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py
r8875 r9001 84 84 if verbose and myid == inlet_master_proc: 85 85 print "Parallel Inlet Operator =================" 86 print " Line = " + str(line)86 print "Poly = " + str(poly) 87 87 print "Master Processor is P%d" %(inlet_master_proc) 88 88 print "Processors are P%s" %(inlet_procs) … … 172 172 if apron is None: 173 173 apron = width 174 175 176 177 178 174 179 175 180 # Calculate location of inlet enquiry points and exchange lines … … 488 493 489 494 490 def allocate_inlet_procs(domain, line, enquiry_point = None, master_proc = 0, procs = None, verbose = False):495 def allocate_inlet_procs(domain, poly, enquiry_point = None, master_proc = 0, procs = None, verbose = False): 491 496 492 497 … … 510 515 # Calculate the number of points of the line inside full polygon 511 516 512 tri_id = line_intersect(vertex_coordinates, line) 517 #tri_id = line_intersect(vertex_coordinates, poly) 518 519 if len(poly) == 2: # poly is a line 520 if verbose : print "======================" 521 tri_id = line_intersect(vertex_coordinates, poly) 522 else: # poly is a polygon 523 if verbose : print "+++++++++++++++++++++++" 524 tris_0 = line_intersect(vertex_coordinates, [poly[0],poly[1]]) 525 tris_1 = inside_polygon(domain_centroids, poly) 526 tri_id = num.union1d(tris_0, tris_1) 527 513 528 514 529 if verbose: 515 print "P%d has %d triangles on line %s" %(myid, len(tri_id), line)530 print "P%d has %d triangles in poly %s" %(myid, len(tri_id), poly) 516 531 517 532 size = len(tri_id) -
trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py
r8950 r9001 136 136 137 137 # Slots for recording current statistics 138 self.accumulated_flow = 0.0 138 139 self.discharge = 0.0 139 140 self.velocity = 0.0 141 self.outlet_depth = 0.0 140 142 self.delta_total_energy = 0.0 141 143 self.driving_energy = 0.0 … … 143 145 if exchange_lines is not None: 144 146 self.__process_skew_culvert() 145 146 147 elif end_points is not None: 147 148 self.__process_non_skew_culvert() … … 156 157 if self.myid in self.inlet_procs[0]: 157 158 line0 = self.exchange_lines[0] 159 if self.apron is None: 160 poly0 = line0 161 else: 162 offset = -self.apron*self.outward_vector_0 163 poly0 = num.array([ line0[0], line0[1], line0[1]+offset, line0[0]+offset]) 158 164 159 165 if self.invert_elevations is None: … … 180 186 if self.myid in self.inlet_procs[1]: 181 187 line1 = self.exchange_lines[1] 188 if self.apron is None: 189 poly1 = line1 190 else: 191 offset = -self.apron*self.outward_vector_1 192 poly1 = num.array([ line1[0], line1[1], line1[1]+offset, line1[0]+offset]) 182 193 183 194 if self.invert_elevations is None: … … 358 369 359 370 self.culvert_vector /= self.culvert_length 371 self.outward_vector_0 = self.culvert_vector 372 self.outward_vector_1 = - self.culvert_vector 360 373 361 374 culvert_normal = num.array([-self.culvert_vector[1], self.culvert_vector[0]]) # Normal vector … … 393 406 centre_point0 = 0.5*(self.exchange_lines[0][0] + self.exchange_lines[0][1]) 394 407 centre_point1 = 0.5*(self.exchange_lines[1][0] + self.exchange_lines[1][1]) 395 396 if self.end_points is None: 408 409 n_exchange_0 = len(self.exchange_lines[0]) 410 n_exchange_1 = len(self.exchange_lines[1]) 411 412 assert n_exchange_0 == n_exchange_1, 'There should be the same number of points in both exchange_lines' 413 414 if n_exchange_0 == 2: 415 416 if self.end_points is None: 417 self.culvert_vector = centre_point1 - centre_point0 418 else: 419 self.culvert_vector = self.end_points[1] - self.end_points[0] 420 421 self.outward_vector_0 = self.culvert_vector 422 self.outward_vector_1 = - self.culvert_vector 423 424 elif n_exchange_0 == 4: 425 426 self.outward_vector_0 = self.exchange_lines[0][3] - self.exchange_lines[0][2] 427 self.outward_vector_1 = self.exchange_lines[1][3] - self.exchange_lines[1][2] 428 397 429 self.culvert_vector = centre_point1 - centre_point0 398 else: 399 self.culvert_vector = self.end_points[1] - self.end_points[0] 400 430 431 else: 432 raise Exception, 'n_exchange_0 != 2 or 4' 433 401 434 self.culvert_length = math.sqrt(num.sum(self.culvert_vector**2)) 402 435 assert self.culvert_length > 0.0, 'The length of culvert is less than 0' 436 self.culvert_vector /= self.culvert_length 437 438 outward_vector_0_length = math.sqrt(num.sum(self.outward_vector_0**2)) 439 assert outward_vector_0_length > 0.0, 'The length of outlet_vector_0 is less than 0' 440 self.outward_vector_0 /= outward_vector_0_length 441 442 outward_vector_1_length = math.sqrt(num.sum(self.outward_vector_1**2)) 443 assert outward_vector_1_length > 0.0, 'The length of outlet_vector_1 is less than 0' 444 self.outward_vector_1 /= outward_vector_1_length 445 403 446 404 447 if self.enquiry_points is None: 405 448 406 self.culvert_vector /= self.culvert_length 449 407 450 gap = (self.apron + self.enquiry_gap)*self.culvert_vector 408 451 … … 436 479 message += '%s' % self.description 437 480 message += '\n' 481 482 #print "Structure Myids ",self.myid, self.label 438 483 439 484 for i, inlet in enumerate(self.inlets): … … 443 488 message += '-------------------------------------\n' 444 489 445 if inlet is not None: stats = inlet.statistics() 490 #print "*****",inlet, i,self.myid 491 if inlet is not None: 492 493 494 stats = inlet.statistics() 446 495 447 496 if self.myid == self.master_proc: -
trunk/anuga_core/source/anuga_parallel/test_parallel_boyd_box_operator.py
r8825 r9001 52 52 width = 16. 53 53 54 dx = dy = 2# Resolution: Length of subdivisions on both axes54 dx = dy = 4 # Resolution: Length of subdivisions on both axes 55 55 56 56 #---------------------------------------------------------------------- … … 167 167 boyd_box0 = None 168 168 169 inlet0 = Inlet_operator(domain, line0, Q0, verbose = False )170 inlet1 = Inlet_operator(domain, line1, Q1, verbose = False )169 inlet0 = Inlet_operator(domain, line0, Q0, verbose = False, label = 'Inlet_0') 170 inlet1 = Inlet_operator(domain, line1, Q1, verbose = False, label = 'Inlet_1') 171 171 172 172 # Enquiry point [ 19. 2.5] is contained in two domains in 4 proc case … … 176 176 losses=1.5, 177 177 width=5.0, 178 apron=5.0,178 #apron=5., 179 179 use_momentum_jet=True, 180 180 use_velocity_head=False, 181 181 manning=0.013, 182 label='Boyd_Box_0', 182 183 verbose=False) 183 184 184 if inlet0 is not None and verbose: inlet0.print_statistics() 185 if inlet1 is not None and verbose: inlet1.print_statistics() 186 if boyd_box0 is not None and verbose: boyd_box0.print_statistics() 185 #if inlet0 is not None and verbose: inlet0.print_statistics() 186 #if inlet1 is not None and verbose: inlet1.print_statistics() 187 188 if boyd_box0 is not None and verbose: 189 print "++++", myid 190 boyd_box0.print_statistics() 187 191 188 192 # if parallel: … … 231 235 232 236 233 if boyd_box0 is not None and verbose : boyd_box0.print_timestepping_statistics() 237 if boyd_box0 is not None and verbose : 238 if myid == boyd_box0.master_proc: 239 print 'master_proc ',myid 240 boyd_box0.print_timestepping_statistics() 234 241 235 242 #for i in range(samples): -
trunk/anuga_core/source/anuga_parallel/test_parallel_frac_op.py
r8828 r9001 176 176 losses=1.5, 177 177 width=5.0, 178 apron=5.0,178 #apron=5.0, 179 179 use_momentum_jet=True, 180 180 use_velocity_head=False, -
trunk/anuga_core/source/anuga_parallel/test_parallel_inlet_operator.py
r8507 r9001 35 35 from anuga.geometry.polygon import inside_polygon, is_inside_polygon, line_intersect 36 36 37 from parallel_operator_factory import Inlet_operator , Boyd_box_operator37 from parallel_operator_factory import Inlet_operator 38 38 39 39 import random … … 172 172 # Enquiry point [ 19. 2.5] is contained in two domains in 4 proc case 173 173 174 boyd_box0 = Boyd_box_operator(domain,175 end_points=[[9.0, 2.5],[19.0, 2.5]],176 losses=1.5,177 width=5.0,178 apron=5.0,179 use_momentum_jet=True,180 use_velocity_head=False,181 manning=0.013,182 verbose=False)174 ## boyd_box0 = Boyd_box_operator(domain, 175 ## end_points=[[9.0, 2.5],[19.0, 2.5]], 176 ## losses=1.5, 177 ## width=5.0, 178 ## apron=5.0, 179 ## use_momentum_jet=True, 180 ## use_velocity_head=False, 181 ## manning=0.013, 182 ## verbose=False) 183 183 184 184 if inlet0 is not None and verbose: inlet0.print_statistics() 185 185 if inlet1 is not None and verbose: inlet1.print_statistics() 186 if boyd_box0 is not None and verbose: boyd_box0.print_statistics()186 #if boyd_box0 is not None and verbose: boyd_box0.print_statistics() 187 187 188 188 # if parallel: … … 231 231 232 232 233 if boyd_box0 is not None and verbose : boyd_box0.print_timestepping_statistics()233 #if boyd_box0 is not None and verbose : boyd_box0.print_timestepping_statistics() 234 234 235 235 #for i in range(samples): -
trunk/anuga_core/source/anuga_validation_tests/analytical_exact/avalanche_dry/validate_avalanche_dry.py
r8922 r9001 113 113 print indent+'Errors in xvelocity: ', eu10, eu30 114 114 115 assert eu10 < 0. 02, 'L^1 error %g greater than 2percent'% eu10116 assert eu30 < 0. 01, 'L^1 error %g greater than 2percent'% eu30115 assert eu10 < 0.1, 'L^1 error %g greater than 10 percent'% eu10 116 assert eu30 < 0.1, 'L^1 error %g greater than 10 percent'% eu30 117 117 118 118 -
trunk/anuga_core/source/anuga_validation_tests/saved_parameters.tex
r8932 r9001 2 2 \newcommand{\alg}{\UScore{1_5}} 3 3 \newcommand{\majorR}{\UScore{1.3.0-beta}} 4 \newcommand{\minorR}{\UScore{89 22}}5 \newcommand{\timeR}{{ Mon Jun 24 23:29:562013}}4 \newcommand{\minorR}{\UScore{8993}} 5 \newcommand{\timeR}{{Sat Sep 28 19:39:45 2013}} -
trunk/anuga_core/user_manual/anuga_installation_guide.tex
r8728 r9001 54 54 \label{sec:requirements} 55 55 56 To run ANUGA you will need a Windows PC (XP, Vista or 7)or a Linux PC with at57 least 512MB RAM. As ANUGA is a memory-intensive numerical system, more memory is better than less.56 To run ANUGA you will need a Windows PC or a Linux PC with at 57 least 1GB RAM. As ANUGA is a memory-intensive numerical system, more memory is better than less. 58 58 59 59 The viewer (Windows only) requires a graphics adapter that … … 62 62 Intel(R) 82915G Express chipset family. 63 63 64 The instructions below are written for the numpy version of ANUGA. ANUGA changed from 65 relying on the Numeric package to the numpy package early in July, 2009. If you have a Numeric ANUGA, 66 you should refer to the installation instructions for that version. The last Numeric version of 67 ANUGA had a build number of 7163. 68 69 Where the text below refers to a specific package file such as \code{python-2.5.msi} you will find that 70 file in a download area linked through the \emph{numpy_support_software} link on the page 71 \url{https://datamining.anu.edu.au/anuga/wiki/NumpyInstall}. 64 We recommend that you check out the page \url{http://anuga.anu.edu.au} for the latest information on installing Anuga. 65 66 %Where the text below refers to a specific package file such as \code{python-2.5.msi} you will find that 67 %file in a download area linked through the \emph{numpy_support_software} link on the page 68 %\url{https://datamining.anu.edu.au/anuga/wiki/NumpyInstall}. 72 69 73 70 74 71 \section{Installation} 75 72 76 Below are the install procedures for Windows XP, Windows Vista, Windows 7 (all 32 bit) and Linux (32 and 64 bit). 77 78 \subsection{Quick install - Windows XP (32 bit)} 79 \label{sec:winxp} 80 81 If you already have previous versions of Python, ANUGA support software or the ANUGA source code installed 82 on the target machine, start off by uninstalling them. Next, download the latest version of the ANUGA 83 Windows installer from \url{http://sourceforge.net/projects/anuga/files/}. The Windows installer will 84 install Python, MingW (select the "Minimal" install), NumPy, NetCDF, Scientific Python, Matplotlib, the 85 ANUGA source code and the viewer (animate). Note that you will need an internet connection to install MingW. 86 87 After all the necessary packages have been installed, the installer will proceed to compile the ANUGA C code, 88 run the test suite (optional) and then run a series of validation examples (optional). This may take some time. 89 Try the demonstrations provided in the ANUGA directory \code{anuga\_demos} (discussed in the ANUGA user manual at 90 \url{https://datamining.anu.edu.au/anuga/attachment/wiki/WikiStart/anuga_user_manual-1.2.0.pdf}) 91 and view the resulting \code{.sww} files with the ANUGA viewer. 73 Below are the install procedures for Windows 7 (32 bit) and Linux (32 and 64 bit). 74 75 \subsection{Install - Windows (32 bit)} 76 \label{sec:win} 77 78 79 80 We use PYTHON as our programming environment together with a number of standard PYTHON packages such as numpy, scipy, matplotlib, netcdf4. One way to install all the required packages is to use a distribution like python_xy. 81 82 \subsubsection{PYTHON xy} 83 84 So first install python xy. This will be a large download, maybe 500 MB or more, but will provide a complete installation (well see NetCDF4 note below) of python for our needs . You should first remove any other version of python and mingw that may be on your system. The python xy package is currently only 32 bits, but this will still work on 64 bit Windows. 85 86 Be sure to choose the win32 python 2.7 version. This is the version for which we are developing. 87 Netcdf4 Note 88 89 Check that netcdf is available. From a command line, try 90 \begin{verbatim} 91 python -c "import netCDF4" 92 \end{verbatim} 93 If no error occurs then netCDF4 is available and you can disregard the rest of this note. 94 95 But unfortunately version 2.7.3.1 (April 2013) python xy seems to be missing netCDF4. Please let us know if later versions are ok. 96 If it is missing then you need to install another package to cover this loss. For this we can use the precompiled scientific python binaries from \url{http://www.lfd.uci.edu/~gohlke/pythonlibs/#scientificpython}. I suggest you choose ScientificPython-2.9.2.win32-py2.7.âexe to install. To test this install try: 97 \begin{verbatim} 98 python -c "import Scientific.IO.NetCDF" 99 \end{verbatim} 100 101 \subsubsection{64 bit} 102 103 At the moment python xy is only 32 bit, but there seems to be a promise that a 64 bit distribution is not too far away. There is a 64 bit python distribution package from Enthought, but is free only to academic users. So at present we recommend win32 python xy. 104 Manual install 105 106 It is possible to install the required environment manually. You would need to install Mingw to provide a compiler, the standard distribution of python27 and then precompiled python libraries for numpy, scipy, matplotlib, netcdf4 from a site like \url{http://www.lfd.uci.edu/~gohlke/pythonlibs/}. It would be interesting to hear feedback on this option, as there is an opportunity to use versions using the Intel Math Kernel Library, which should provide a useful increase in speed. 107 Installing anuga 108 109 \subsection{Obtaining ANUGA source} 110 111 You can either use the source code avialble from sourceforge or download the latest version of the package using subversion. 112 113 You can obtain version 1.3 of the package from sourceforge by downloading the file \url{http://sourceforge/p/anuga} 114 115 116 \subsection{Source from development repository} 117 An alternative is checking out the most recent version of the package using subversion. 118 119 You need a subversion client. I suggest installing tortoise_svn downloads and then checking out the following svn repository. When you installed tortoise svn it creates a few extra menu items to your right click menu in the file manager. Just choose "tortoise" checkout to download the code. 120 \begin{verbatim} 121 https://anuga.anu.edu.au/svn/anuga/trunk/anuga_core 122 \end{verbatim} 123 This should produce an anuga_core directory 124 125 126 127 \subsection{Setup PYTHONPATH} 128 129 We need to tell python where the anuga source code is located. This is done via the PYTHONPATH environment variable. 130 131 For instance, if your anuga_core directory was located at 132 133 \begin{verbatim} 134 C:\Users\Steve\anuga_core 135 \end{verbatim} 136 137 then you should add 138 139 \begin{verbatim} 140 C:\Users\Steve\anuga_core\source 141 \end{verbatim} 142 143 to your PYTHONPATH 144 145 Environment variables are accessed via control panel -> advanced system settings -> Environment Variables and then add a new Environment variable PYTHONPATH with value \verb|C:\Users\Steve\anuga_core\source| (or what ever is appropriate for your installation) 146 147 \subsection{Compiling ANUGA} 148 149 Now go to the directory anuga_core and compile the anuga files. Fire up a cmd terminal, change to the anuga_core directory and run 150 \begin{verbatim} 151 python compile_all.py 152 \end{verbatim} 153 Check that all the files have been compiled correctly. There should be an "OK" at the end of each separate compile command. 154 155 \subsection{Run Unit tests} 156 157 From the anuga_core directory run the unit tests via: 158 \begin{verbatim} 159 python test_all.py 160 \end{verbatim} 161 162 \subsection{Conclusion} 163 164 Hopefully all the unit tests pass. As this is bleeding edge there are sometimes a small number of failures as this is a work in progress. Have a look at the demos in the directory anuga_core/documentation/user_manual/demos (along with the user manual) to see how to use anuga. 165 Updating 166 167 \subsection{Updating} 168 If you downloaded the source using subversoin, you can update your version of ANUGA. 169 This is fairly easy. Just choose the directory to "update" and then right click and choose "tortoise update" to update the code. 170 171 Then again from the anuga_core directory recompile the code and check the unit tests via 172 173 python compile_all.py 174 python test_all.py 175 176 177 178 179 %If you already have previous versions of Python, ANUGA support software or the ANUGA source code installed 180 %on the target machine, start off by uninstalling them. Next, download the latest version of the ANUGA 181 %Windows installer from \url{http://sourceforge.net/projects/anuga/files/}. The Windows installer will 182 %install Python, MingW (select the "Minimal" install), NumPy, NetCDF, Scientific Python, Matplotlib, the 183 %ANUGA source code and the viewer (animate). Note that you will need an internet connection to install MingW. 184 % 185 %After all the necessary packages have been installed, the installer will proceed to compile the ANUGA C code, 186 %run the test suite (optional) and then run a series of validation examples (optional). This may take some time. 187 %Try the demonstrations provided in the ANUGA directory \code{anuga\_demos} (discussed in the ANUGA user manual at 188 %\url{https://datamining.anu.edu.au/anuga/attachment/wiki/WikiStart/anuga_user_manual-1.2.0.pdf}) 189 %and view the resulting \code{.sww} files with the ANUGA viewer. 92 190 93 191
Note: See TracChangeset
for help on using the changeset viewer.