Changeset 6121
- Timestamp:
- Jan 7, 2009, 4:34:45 PM (16 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/culvert_flows/culvert_class.py
r6111 r6121 6 6 from anuga.utilities.polygon import plot_polygons 7 7 8 from anuga.utilities.numerical_tools import mean 8 9 from anuga.utilities.numerical_tools import ensure_numeric 10 11 from anuga.config import g, epsilon 12 from Numeric import take, sqrt 13 from anuga.config import velocity_protection 14 15 16 17 9 18 from Numeric import allclose 19 from Numeric import sqrt, sum 20 21 10 22 11 23 import sys … … 16 28 17 29 18 # FIXME(Ole): Write in C and reuse this function by similar code in interpolate.py 30 # FIXME(Ole): Write in C and reuse this function by similar code 31 # in interpolate.py 19 32 def interpolate_linearly(x, xvec, yvec): 33 34 msg = 'Input to function interpolate_linearly could not be converted ' 35 msg += 'to numerical scalar: x = %s' % str(x) 36 try: 37 x = float(x) 38 except: 39 raise Exception, msg 40 20 41 21 42 # Check bounds 22 43 if x < xvec[0]: 23 msg = 'Value provided = %.2f, interpolation minimum = %.2f.' %(x, xvec[0]) 44 msg = 'Value provided = %.2f, interpolation minimum = %.2f.'\ 45 % (x, xvec[0]) 24 46 raise Below_interval, msg 25 47 26 48 if x > xvec[-1]: 27 msg = 'Value provided = %.2f, interpolation maximum = %.2f.' %(x, xvec[-1]) 49 msg = 'Value provided = %.2f, interpolation maximum = %.2f.'\ 50 %(x, xvec[-1]) 28 51 raise Above_interval, msg 29 52 … … 61 84 barrel_velocity = float(fields[2].strip()) 62 85 63 rating_curve.append( [head_difference, flow_rate, barrel_velocity])86 rating_curve.append([head_difference, flow_rate, barrel_velocity]) 64 87 65 88 if i == 0: … … 107 130 end_point0=None, 108 131 end_point1=None, 132 enquiry_point0=None, 133 enquiry_point1=None, 109 134 update_interval=None, 110 135 log_file=False, … … 112 137 verbose=False): 113 138 114 from Numeric import sqrt, sum115 139 116 140 … … 155 179 number_of_barrels=number_of_barrels) 156 180 181 # Select enquiry points 182 if enquiry_point0 is None: 183 enquiry_point0 = P['enquiry_point0'] 184 185 if enquiry_point1 is None: 186 enquiry_point1 = P['enquiry_point1'] 187 157 188 if verbose is True: 158 189 pass … … 160 191 # P['exchange_polygon0'], 161 192 # P['exchange_polygon1'], 162 # P['enquiry_polygon0'],163 # P['enquiry_polygon1']],193 # [enquiry_point0, 1.005*enquiry_point0], 194 # [enquiry_point1, 1.005*enquiry_point1]], 164 195 # figname='culvert_polygon_output') 165 196 166 167 # Compute the average point for enquiry 168 enquiry_point0 = sum(P['enquiry_polygon0'][:2])/2 169 enquiry_point1 = sum(P['enquiry_polygon1'][:2])/2 170 197 198 171 199 self.enquiry_points = [enquiry_point0, enquiry_point1] 200 172 201 self.enquiry_indices = [] 173 202 for point in self.enquiry_points: … … 225 254 dq = domain.quantities 226 255 for i, opening in enumerate(self.openings): 227 #elevation = dq['elevation'].get_values(location='centroids',228 # interpolation_points=[self.enquiry_points[i]])229 230 256 elevation = dq['elevation'].get_values(location='centroids', 231 257 indices=[self.enquiry_indices[i]]) … … 258 284 self.verbose = verbose 259 285 self.last_update = 0.0 # For use with update_interval 286 self.last_time = 0.0 260 287 self.update_interval = update_interval 261 288 … … 274 301 275 302 def __call__(self, domain): 276 from anuga.utilities.numerical_tools import mean277 278 from anuga.config import g, epsilon279 from Numeric import take, sqrt280 from anuga.config import velocity_protection281 282 303 283 304 # Time stuff … … 288 309 if self.update_interval is None: 289 310 update = True 311 delta_t = domain.timestep # Next timestep has been computed in domain.py 290 312 else: 291 313 if time - self.last_update > self.update_interval or time == 0.0: 292 314 update = True 293 315 delta_t = self.update_interval 316 317 s = '\nTime = %.2f, delta_t = %f' %(time, delta_t) 318 if hasattr(self, 'log_filename'): 319 log_to_file(self.log_filename, s) 320 294 321 295 322 if update is True: 296 323 self.last_update = time 324 297 325 dq = domain.quantities 298 326 … … 303 331 # Compute mean values of selected quantitites in the 304 332 # enquiry area in front of the culvert 305 # Stage and velocity comes from enquiry area306 # and elevation from exchange area307 333 308 334 stage = dq['stage'].get_values(location='centroids', … … 346 372 log_to_file(self.log_filename, msg) 347 373 except Above_interval, e: 348 Q = self.rating_curve[-1,1] 374 Q = self.rating_curve[-1,1] 349 375 msg = '%.2fs: Delta head greater than rating curve maximum: ' %time 350 376 msg += str(e) … … 360 386 Q *= self.number_of_barrels 361 387 362 388 389 # Adjust Q downwards depending on available water at inlet 390 stage = self.inlet.get_quantity_values(quantity_name='stage') 391 elevation = self.inlet.get_quantity_values(quantity_name='elevation') 392 depth = stage-elevation 393 394 395 V = 0 396 for i, d in enumerate(depth): 397 V += d * domain.areas[i] 398 399 #Vsimple = mean(depth)*self.inlet.exchange_area # Current volume in exchange area 400 #print 'Q', Q, 'dt', delta_t, 'Q*dt', Q*delta_t, 'V', V, 'Vsimple', Vsimple 401 402 dt = delta_t 403 if Q*dt > V: 404 405 Q_reduced = 0.9*V/dt # Reduce with safety factor 406 407 msg = '%.2fs: Computed extraction for this time interval (Q*dt) is ' % time 408 msg += 'greater than current volume (V) at inlet.\n' 409 msg += ' Q will be reduced from %.2f m^3/s to %.2f m^3/s.' % (Q, Q_reduced) 410 411 #print msg 412 413 if self.verbose is True: 414 print msg 415 if hasattr(self, 'log_filename'): 416 log_to_file(self.log_filename, msg) 417 418 Q = Q_reduced 419 363 420 self.inlet.rate = -Q 364 421 self.outlet.rate = Q … … 373 430 fid.close() 374 431 375 432 # Store value of time 433 self.last_time = time 376 434 377 435 … … 445 503 culvert_routine=None, 446 504 number_of_barrels=1, 505 enquiry_point0=None, 506 enquiry_point1=None, 447 507 update_interval=None, 448 508 verbose=False): … … 525 585 number_of_barrels=number_of_barrels) 526 586 587 # Select enquiry points 588 if enquiry_point0 is None: 589 enquiry_point0 = P['enquiry_point0'] 590 591 if enquiry_point1 is None: 592 enquiry_point1 = P['enquiry_point1'] 593 527 594 if verbose is True: 528 595 pass … … 530 597 # P['exchange_polygon0'], 531 598 # P['exchange_polygon1'], 532 # P['enquiry_polygon0'],533 # P['enquiry_polygon1']],599 # [enquiry_point0, 1.005*enquiry_point0], 600 # [enquiry_point1, 1.005*enquiry_point1]], 534 601 # figname='culvert_polygon_output') 535 #import sys; sys.exit() 536 537 538 # Compute the average point for enquiry 539 enquiry_point0 = sum(P['enquiry_polygon0'][:2])/2 540 enquiry_point1 = sum(P['enquiry_polygon1'][:2])/2 541 602 603 542 604 self.enquiry_points = [enquiry_point0, enquiry_point1] 605 606 543 607 self.enquiry_indices = [] 544 608 for point in self.enquiry_points: … … 579 643 for key in P.keys(): 580 644 if key in ['exchange_polygon0', 581 'exchange_polygon1', 582 'enquiry_polygon0', 583 'enquiry_polygon1']: 645 'exchange_polygon1']: 584 646 for point in P[key]: 585 647 … … 606 668 self.invert_levels = [invert_level0, invert_level1] 607 669 #self.enquiry_polygons = [P['enquiry_polygon0'], P['enquiry_polygon1']] 608 self.enquiry_polylines = [P['enquiry_polygon0'][:2],609 P['enquiry_polygon1'][:2]]670 #self.enquiry_polylines = [P['enquiry_polygon0'][:2], 671 # P['enquiry_polygon1'][:2]] 610 672 self.vector = P['vector'] 611 673 self.length = P['length']; assert self.length > 0.0 … … 657 719 658 720 def __call__(self, domain): 659 from anuga.utilities.numerical_tools import mean660 661 from anuga.config import g, epsilon662 from Numeric import take, sqrt663 from anuga.config import velocity_protection664 665 721 666 722 log_filename = self.log_filename … … 669 725 time = domain.get_time() 670 726 671 727 # Short hand 728 dq = domain.quantities 729 730 672 731 update = False 673 732 if self.update_interval is None: 674 733 update = True 734 delta_t = domain.timestep # Next timestep has been computed in domain.py 675 735 else: 676 736 if time - self.last_update > self.update_interval or time == 0.0: 677 737 update = True 678 679 #print 'call', time, time - self.last_update 738 delta_t = self.update_interval 739 740 s = '\nTime = %.2f, delta_t = %f' %(time, delta_t) 741 if hasattr(self, 'log_filename'): 742 log_to_file(log_filename, s) 680 743 681 744 682 745 if update is True: 683 #print 'Updating', time, time - self.last_update684 746 self.last_update = time 685 686 delta_t = time-self.last_time 687 s = '\nTime = %.2f, delta_t = %f' %(time, delta_t) 688 log_to_file(log_filename, s) 689 747 690 748 msg = 'Time did not advance' 691 749 if time > 0.0: assert delta_t > 0.0, msg … … 695 753 openings = self.openings # There are two Opening [0] and [1] 696 754 for i, opening in enumerate(openings): 697 dq = domain.quantities698 755 699 756 # Compute mean values of selected quantitites in the 700 757 # exchange area in front of the culvert 701 # Stage and velocity comes from enquiry area 702 # and elevation from exchange area 703 704 stage = dq['stage'].get_values(location='centroids', 705 indices=opening.exchange_indices) 758 759 stage = opening.get_quantity_values(quantity_name='stage') 706 760 w = mean(stage) # Average stage 707 761 … … 711 765 z = invert_level 712 766 else: 713 elevation = dq['elevation'].get_values(location='centroids', 714 indices=opening.exchange_indices) 767 elevation = opening.get_quantity_values(quantity_name='elevation') 715 768 z = mean(elevation) # Average elevation 716 769 … … 734 787 735 788 # Average measures of energy in front of this opening 736 #polyline = self.enquiry_polylines[i]737 #opening.total_energy = domain.get_energy_through_cross_section(polyline,738 # kind='total')739 789 740 790 id = [self.enquiry_indices[i]] … … 742 792 indices=id) 743 793 elevation = dq['elevation'].get_values(location='centroids', 744 indices=id)794 indices=id) 745 795 xmomentum = dq['xmomentum'].get_values(location='centroids', 746 indices=id)796 indices=id) 747 797 ymomentum = dq['xmomentum'].get_values(location='centroids', 748 798 indices=id) … … 840 890 841 891 # Update momentum 842 delta_t = time - self.last_time 892 843 893 if delta_t > 0.0: 844 894 xmomentum_rate = outlet_mom_x - outlet.momentum[0].value … … 873 923 log_to_file(log_filename, s) 874 924 925 # Store value of time 926 self.last_time = time 875 927 876 928 … … 886 938 self.outlet.momentum[1](domain) 887 939 888 # Store value of time #FIXME(Ole): Maybe only every time we update889 self.last_time = time890 940 891 941 -
anuga_core/source/anuga/culvert_flows/culvert_polygons.py
r6098 r6121 5 5 from math import sqrt 6 6 from Numeric import array, sum 7 from anuga.utilities.polygon import inside_polygon, polygon_area 7 8 8 9 def create_culvert_polygons(end_point0, 9 10 end_point1, 10 11 width, height=None, 11 enquiry_gap_factor=1.0, 12 enquiry_shape_factor=2.0, 12 enquiry_gap_factor=0.2, 13 13 number_of_barrels=1): 14 14 """Create polygons at the end of a culvert inlet and outlet. … … 23 23 Input (optional): 24 24 height - culvert height, defaults to width making a square culvert 25 enquiry_gap_factor - sets the distance to the enquiry polygon 26 enquiry_shape_factor - sets the shape of the enquiry polygon 27 (large value widens polygon but reduces height 28 to preserve same area as exchange polygon) 25 enquiry_gap_factor - sets the distance to the enquiry point as fraction of the height 29 26 number_of_barrels - number of identical pipes. 30 27 … … 34 31 'exchange_polygon0' - polygon defining the flow area at end_point0 35 32 'exchange_polygon1' - polygon defining the flow area at end_point1 36 'enquiry_polygon0' - polygon defining the enquiry field near end_point0 37 'enquiry_polygon1' - polygon defining the enquiry field near end_point1 33 'enquiry_point0' - point beyond exchange_polygon0 34 'enquiry_point1' - point beyond exchange_polygon1 35 'vector' 36 'length' 37 'normal' 38 38 """ 39 39 … … 62 62 63 63 # Unit direction vector and normal 64 vector /= length 65 normal = array([-dy, dx])/length 64 vector /= length # Unit vector in culvert direction 65 normal = array([-dy, dx])/length # Normal vector 66 66 67 culvert_polygons['vector'] = vector 68 culvert_polygons['length'] = length 69 culvert_polygons['normal'] = normal 67 70 68 71 # Short hands 69 72 w = 0.5*width*normal # Perpendicular vector of 1/2 width 70 h = height*vector # Vector of length=height in the 71 # direction of the culvert 73 h = height*vector # Vector of length=height in the 74 # direction of the culvert 75 gap = (1 + enquiry_gap_factor)*h 76 72 77 73 # Build exchange polygon 078 # Build exchange polygon and enquiry point for opening 0 74 79 p0 = end_point0 + w 75 80 p1 = end_point0 - w … … 77 82 p3 = p0 - h 78 83 culvert_polygons['exchange_polygon0'] = array([p0,p1,p2,p3]) 84 culvert_polygons['enquiry_point0'] = end_point0 - gap 85 79 86 80 # Build exchange polygon 187 # Build exchange polygon and enquiry point for opening 1 81 88 p0 = end_point1 + w 82 89 p1 = end_point1 - w … … 84 91 p3 = p0 + h 85 92 culvert_polygons['exchange_polygon1'] = array([p0,p1,p2,p3]) 93 culvert_polygons['enquiry_point1'] = end_point1 + gap 86 94 95 # Check that enquiry polygons are outside exchange polygons 96 for key1 in ['exchange_polygon0', 97 'exchange_polygon1']: 98 polygon = culvert_polygons[key1] 99 area = polygon_area(polygon) 100 101 msg = 'Polygon %s ' %(polygon) 102 msg += ' has area = %f' % area 103 assert area > 0.0, msg 87 104 88 89 # Redefine shorthands for enquiry polygons 90 w = w*enquiry_shape_factor 91 h = h/enquiry_shape_factor 92 gap = (enquiry_gap_factor + h)*vector 93 94 # Build enquiry polygon 0 95 p0 = end_point0 + w - gap 96 p1 = end_point0 - w - gap 97 p2 = p1 - h 98 p3 = p0 - h 99 culvert_polygons['enquiry_polygon0'] = array([p0,p1,p2,p3]) 100 101 # Build enquiry polygon 1 102 p0 = end_point1 + w + gap 103 p1 = end_point1 - w + gap 104 p2 = p1 + h 105 p3 = p0 + h 106 culvert_polygons['enquiry_polygon1'] = array([p0,p1,p2,p3]) 105 for key2 in ['enquiry_point0', 'enquiry_point1']: 106 point = culvert_polygons[key2] 107 msg = 'Enquiry point falls inside an enquiry point.' 108 msg += 'Email Ole.Nielsen@ga.gov.au' 109 assert not inside_polygon(point, polygon), msg 107 110 108 111 # Return results 109 culvert_polygons['vector'] = vector110 culvert_polygons['length'] = length111 culvert_polygons['normal'] = normal112 112 return culvert_polygons -
anuga_core/source/anuga/culvert_flows/culvert_routines.py
r5862 r6121 6 6 7 7 """ 8 9 #NOTE: 10 # Inlet control: Delta_Et > Es at the inlet 11 # Outlet control: Delta_Et < Es at the inlet 12 # where Et is total energy (w + 0.5*v^2/g) and 13 # Es is the specific energy (h + 0.5*v^2/g) 14 15 8 16 9 17 # NEW DEFINED CULVERT FLOW---- Flow from INLET 1 ------> INLET 2 (Outlet) … … 61 69 if inlet.depth_trigger >= 0.01 and inlet.depth >= 0.01: 62 70 # Calculate driving energy 71 # FIXME(Ole): Should this be specific energy? 63 72 E = inlet.total_energy 64 73 -
anuga_core/source/anuga/culvert_flows/test_culvert_class.py
r6111 r6121 143 143 144 144 145 def test_that_culvert_dry_bed_rating (self):145 def test_that_culvert_dry_bed_rating_does_not_produce_flow(self): 146 146 """test_that_culvert_in_dry_bed_does_not_produce_flow(self): 147 147 … … 243 243 244 244 245 246 def test_that_culvert_dry_bed_boyd(self): 247 """test_that_culvert_in_dry_bed_does_not_produce_flow(self): 245 246 def Xtest_that_culvert_rating_limits_flow_in_shallow_inlet_condition(self): 247 """test_that_culvert_rating_limits_flow_in_shallow_inlet_condition 248 249 Test that culvert on a sloping dry bed limits flows when very little water 250 is present at inlet 251 252 This one is using the rating curve variant 253 """ 254 255 path = get_pathname_from_package('anuga.culvert_flows') 256 257 length = 40. 258 width = 5. 259 260 dx = dy = 1 # Resolution: Length of subdivisions on both axes 261 262 points, vertices, boundary = rectangular_cross(int(length/dx), 263 int(width/dy), 264 len1=length, 265 len2=width) 266 domain = Domain(points, vertices, boundary) 267 domain.set_name('Test_culvert_shallow') # Output name 268 domain.set_default_order(2) 269 270 271 #---------------------------------------------------------------------- 272 # Setup initial conditions 273 #---------------------------------------------------------------------- 274 275 def topography(x, y): 276 """Set up a weir 277 278 A culvert will connect either side 279 """ 280 # General Slope of Topography 281 z=-x/1000 282 283 N = len(x) 284 for i in range(N): 285 286 # Sloping Embankment Across Channel 287 if 5.0 < x[i] < 10.1: 288 # Cut Out Segment for Culvert FACE 289 if 1.0+(x[i]-5.0)/5.0 < y[i] < 4.0 - (x[i]-5.0)/5.0: 290 z[i]=z[i] 291 else: 292 z[i] += 0.5*(x[i] -5.0) # Sloping Segment U/S Face 293 if 10.0 < x[i] < 12.1: 294 z[i] += 2.5 # Flat Crest of Embankment 295 if 12.0 < x[i] < 14.5: 296 # Cut Out Segment for Culvert FACE 297 if 2.0-(x[i]-12.0)/2.5 < y[i] < 3.0 + (x[i]-12.0)/2.5: 298 z[i]=z[i] 299 else: 300 z[i] += 2.5-1.0*(x[i] -12.0) # Sloping D/S Face 301 302 303 return z 304 305 306 domain.set_quantity('elevation', topography) 307 domain.set_quantity('friction', 0.01) # Constant friction 308 domain.set_quantity('stage', 309 expression='elevation + 0.2') # Shallow initial condition 310 311 # NOTE: Shallow values may cause this test to fail regardless of the 312 # culvert due to initial adjustments. A good value is 0.2 313 314 315 filename = os.path.join(path, 'example_rating_curve.csv') 316 culvert = Culvert_flow_rating(domain, 317 culvert_description_filename=filename, 318 end_point0=[9.0, 2.5], 319 end_point1=[13.0, 2.5], 320 verbose=False) 321 322 domain.forcing_terms.append(culvert) 323 324 325 #----------------------------------------------------------------------- 326 # Setup boundary conditions 327 #----------------------------------------------------------------------- 328 329 # Inflow based on Flow Depth and Approaching Momentum 330 331 Br = Reflective_boundary(domain) # Solid reflective wall 332 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 333 334 335 #----------------------------------------------------------------------- 336 # Evolve system through time 337 #----------------------------------------------------------------------- 338 339 ref_volume = domain.get_quantity('stage').get_integral() 340 for t in domain.evolve(yieldstep = 1, finaltime = 25): 341 print domain.timestepping_statistics() 342 new_volume = domain.get_quantity('stage').get_integral() 343 344 msg = 'Total volume has changed: Is %.2f m^3 should have been %.2f m^3'\ 345 % (new_volume, ref_volume) 346 assert allclose(new_volume, ref_volume), msg 347 348 349 350 def test_that_culvert_dry_bed_boyd_does_not_produce_flow(self): 351 """test_that_culvert_in_dry_bed_boyd_does_not_produce_flow(self): 248 352 249 353 Test that culvert on a sloping dry bed doesn't produce flows … … 436 540 #------------------------------------------------------------- 437 541 if __name__ == "__main__": 438 #suite = unittest.makeSuite(Test_Culvert, 'test_predicted_boyd_flow')439 suite = unittest.makeSuite(Test_Culvert, 'test')542 suite = unittest.makeSuite(Test_Culvert, 'test_that_culvert_rating_limits_flow_in_shallow_inlet_condition') 543 #suite = unittest.makeSuite(Test_Culvert, 'test') 440 544 runner = unittest.TextTestRunner() 441 545 runner.run(suite) -
anuga_core/source/anuga/culvert_flows/test_culvert_polygons.py
r6098 r6121 27 27 28 28 P = create_culvert_polygons(end_point0, 29 end_point1,30 width=width,31 height=height,32 number_of_barrels=number_of_barrels)29 end_point1, 30 width=width, 31 height=height, 32 number_of_barrels=number_of_barrels) 33 33 34 34 # Compute area and check that it is greater than 0 35 for key in ['exchange_polygon0', 36 'exchange_polygon1', 37 'enquiry_polygon0', 38 'enquiry_polygon1']: 39 polygon = P[key] 35 for key1 in ['exchange_polygon0', 36 'exchange_polygon1']: 37 polygon = P[key1] 40 38 area = polygon_area(polygon) 41 39 … … 44 42 assert area > 0.0, msg 45 43 44 for key2 in ['enquiry_point0', 'enquiry_point1']: 45 point = P[key2] 46 assert not inside_polygon(point, polygon) 47 46 48 47 49 def test_2(self): … … 55 57 56 58 P = create_culvert_polygons(end_point0, 57 end_point1,58 width=width,59 height=height,60 number_of_barrels=number_of_barrels)59 end_point1, 60 width=width, 61 height=height, 62 number_of_barrels=number_of_barrels) 61 63 62 64 # Compute area and check that it is greater than 0 63 for key in ['exchange_polygon0', 64 'exchange_polygon1', 65 'enquiry_polygon0', 66 'enquiry_polygon1']: 67 polygon = P[key] 65 for key1 in ['exchange_polygon0', 66 'exchange_polygon1']: 67 polygon = P[key1] 68 68 area = polygon_area(polygon) 69 69 … … 71 71 msg += ' has area = %f' % area 72 72 assert area > 0.0, msg 73 73 74 for key2 in ['enquiry_point0', 'enquiry_point1']: 75 point = P[key2] 76 assert not inside_polygon(point, polygon) 74 77 75 78 -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r6086 r6121 1929 1929 1930 1930 1931 def get_quantity_values(self ):1931 def get_quantity_values(self, quantity_name=None): 1932 1932 """Return values for specified quantity restricted to opening 1933 """ 1934 1935 q = self.domain.quantities[self.quantity_name] 1936 return q.get_values(indices=self.exchange_indices) 1933 1934 Optionally a quantity name can be specified if values from another 1935 quantity is sought 1936 """ 1937 1938 if quantity_name is None: 1939 quantity_name = self.quantity_name 1940 1941 q = self.domain.quantities[quantity_name] 1942 return q.get_values(location='centroids', 1943 indices=self.exchange_indices) 1937 1944 1938 1945 1939 def set_quantity_values(self, val ):1946 def set_quantity_values(self, val, quantity_name=None): 1940 1947 """Set values for specified quantity restricted to opening 1941 """ 1942 1948 1949 Optionally a quantity name can be specified if values from another 1950 quantity is sought 1951 """ 1952 1953 if quantity_name is None: 1954 quantity_name = self.quantity_name 1955 1943 1956 q = self.domain.quantities[self.quantity_name] 1944 q.set_values(val, indices=self.exchange_indices) 1957 q.set_values(val, 1958 location='centroids', 1959 indices=self.exchange_indices) 1945 1960 1946 1961
Note: See TracChangeset
for help on using the changeset viewer.