Changeset 8582
- Timestamp:
- Sep 18, 2012, 3:42:23 PM (13 years ago)
- Location:
- trunk/anuga_core
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py
r8578 r8582 141 141 self.geo_reference = self.mesh.geo_reference 142 142 143 self.verbose = verbose 143 144 144 145 if verbose: log.critical('Domain: Expose quantity names and types') -
trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r8578 r8582 344 344 345 345 # We demand that vertex values are stored uniquely 346 self.set_store_vertices_smoothly(False)346 #self.set_store_vertices_smoothly(False) 347 347 348 348 self.maximum_allowed_speed=0.0 349 #self.minimum_allowed_height=0.01 350 349 351 #self.forcing_terms.append(manning_friction_explicit) 350 352 #self.forcing_terms.remove(manning_friction_implicit) 351 353 352 print '##########################################################################'353 print '#'354 print '# Using anuga_tsunami solver in anuga_work/development/gareth/experimental/anuga_tsunami/'355 print "#"356 print "# This solver is experimental. Here are some tips on using it"357 print "#"358 print "# 1) When plotting outputs, I strongly suggest you examine centroid values, not vertex values"359 print "# , as the latter can be completely misleading near strong gradients in the flow. "360 print "# There is a plot_util.py script in anuga_core/utilities/ which might help you extract"361 print "# quantities at centroid values from sww files."362 print "# Note that to accuractely compute centroid values from sww files, the files need to store "363 print "# vertices uniquely. This makes for large sww files (3x), but is the price to pay for the right answer"364 print "# (unless we alter IO to allow centroids to be written to sww files, which would then affect"365 print "# ANUGA viewer as well -- I expect this would be lots of work)"366 print "#"367 print "# 2) In field scale applications (where the depth is typically > 1m), I suggest you set"368 print "# domain.minimum_allowed_height=0.01 (the default is 1.0e-3). "369 print "#"370 print "# 3) This solver is not expected to perform well in problems with very"371 print "# shallow water flowing down steep slopes (such that the stage_centroid_value "372 print "# is less than the maximum bed_edge_value on a given triangle). However, analytical tests"373 print "# suggest it can do typical wetting/drying situations very well (parabolic oscillations test case) "374 print "#"375 print "# 4) This solver allows the stage_centroid_value to drop to slightly below the minimum bed_vertex_value"376 print "# on it's triangle. In other ANUGA versions (e.g. 1.2.1), the limit would be the"377 print "# bed_centroid_value. This means that triangles store slightly more water than they are"378 print "# typically interpreted to store, which might have significance in some applications."379 print "#"380 print "# You will probably be able to tell this is causing you problems by convergence testing"381 print "#"382 print '# 5) Note that many options in config.py have been overridden by the solver -- I have '383 print '# deliberately attempted to get the solver to perform well with consistent values of '384 print '# these parameters -- so I would advise against changing them unless you at least check that '385 print '# it really does improve things'386 print '#'387 print '##########################################################################'354 # print '##########################################################################' 355 # print '#' 356 # print '# Using anuga_tsunami solver in anuga_work/development/gareth/experimental/anuga_tsunami/' 357 # print "#" 358 # print "# This solver is experimental. Here are some tips on using it" 359 # print "#" 360 # print "# 1) When plotting outputs, I strongly suggest you examine centroid values, not vertex values" 361 # print "# , as the latter can be completely misleading near strong gradients in the flow. " 362 # print "# There is a plot_util.py script in anuga_core/utilities/ which might help you extract" 363 # print "# quantities at centroid values from sww files." 364 # print "# Note that to accuractely compute centroid values from sww files, the files need to store " 365 # print "# vertices uniquely. This makes for large sww files (3x), but is the price to pay for the right answer" 366 # print "# (unless we alter IO to allow centroids to be written to sww files, which would then affect" 367 # print "# ANUGA viewer as well -- I expect this would be lots of work)" 368 # print "#" 369 # print "# 2) In field scale applications (where the depth is typically > 1m), I suggest you set" 370 # print "# domain.minimum_allowed_height=0.01 (the default is 1.0e-3). " 371 # print "#" 372 # print "# 3) This solver is not expected to perform well in problems with very" 373 # print "# shallow water flowing down steep slopes (such that the stage_centroid_value " 374 # print "# is less than the maximum bed_edge_value on a given triangle). However, analytical tests" 375 # print "# suggest it can do typical wetting/drying situations very well (parabolic oscillations test case) " 376 # print "#" 377 # print "# 4) This solver allows the stage_centroid_value to drop to slightly below the minimum bed_vertex_value" 378 # print "# on it's triangle. In other ANUGA versions (e.g. 1.2.1), the limit would be the" 379 # print "# bed_centroid_value. This means that triangles store slightly more water than they are" 380 # print "# typically interpreted to store, which might have significance in some applications." 381 # print "#" 382 # print "# You will probably be able to tell this is causing you problems by convergence testing" 383 # print "#" 384 # print '# 5) Note that many options in config.py have been overridden by the solver -- I have ' 385 # print '# deliberately attempted to get the solver to perform well with consistent values of ' 386 # print '# these parameters -- so I would advise against changing them unless you at least check that ' 387 # print '# it really does improve things' 388 # print '#' 389 # print '##########################################################################' 388 390 389 391 … … 1123 1125 areas = self.areas 1124 1126 1125 protect(self.minimum_allowed_height, self.maximum_allowed_speed,1127 mass_error = protect(self.minimum_allowed_height, self.maximum_allowed_speed, 1126 1128 self.epsilon, wc, wv, zc,zv, xmomc, ymomc, areas) 1129 1130 if mass_error > 0.0 and self.verbose : 1131 print 'Cumulative mass protection: %g m^3 '% mass_error 1127 1132 1128 1133 … … 1278 1283 areas = self.areas 1279 1284 1280 protect(self.minimum_allowed_height, self.maximum_allowed_speed,1285 mass_error = protect(self.minimum_allowed_height, self.maximum_allowed_speed, 1281 1286 self.epsilon, wc, wv, zc,zv, xmomc, ymomc, areas) 1287 1288 print 'Cumulative mass protection: python'+str(mass_error)+'m^3 ' 1289 1282 1290 1283 1291 else: -
trunk/anuga_core/source/anuga/shallow_water/swb2_domain_ext.c
r8580 r8582 558 558 559 559 // Protect against the water elevation falling below the triangle bed 560 int_protect(int N,560 double _protect(int N, 561 561 double minimum_allowed_height, 562 562 double maximum_allowed_speed, … … 573 573 double hc, bmin, bmax; 574 574 double u, v, reduced_speed; 575 staticdouble mass_error=0.;575 double mass_error=0.; 576 576 // This acts like minimum_allowed height, but scales with the vertical 577 577 // distance between the bed_centroid_value and the max bed_edge_value of … … 626 626 } 627 627 628 /* 628 629 if(mass_added==1){ 629 630 printf("Cumulative mass protection: %f m^3 \n", mass_error); 630 631 } 631 return 0; 632 */ 633 return mass_error; 632 634 } 633 635 … … 1734 1736 int N; 1735 1737 double minimum_allowed_height, maximum_allowed_speed, epsilon; 1738 double mass_error; 1736 1739 1737 1740 // Convert Python arguments to C … … 1747 1750 N = wc -> dimensions[0]; 1748 1751 1749 _protect(N,1752 mass_error = _protect(N, 1750 1753 minimum_allowed_height, 1751 1754 maximum_allowed_speed, … … 1759 1762 (double*) areas -> data); 1760 1763 1761 return Py_BuildValue(" ");1764 return Py_BuildValue("d", mass_error); 1762 1765 } 1763 1766 -
trunk/anuga_core/source/anuga_parallel/parallel_api.py
r8553 r8582 68 68 domain_store = domain.get_store() 69 69 domain_minimum_storable_height = domain.minimum_storable_height 70 domain_flow_algorithm = domain.get_flow_algorithm() 71 domain_minimum_allowed_height = domain.get_minimum_allowed_height() 70 72 georef = domain.geo_reference 71 73 number_of_global_triangles = domain.number_of_triangles … … 77 79 # FIXME SR: Creates cPickle dump 78 80 send((domain_name, domain_dir, domain_store, \ 79 domain_minimum_storable_height, georef, \ 81 domain_minimum_storable_height, domain_flow_algorithm, \ 82 domain_minimum_allowed_height, georef, \ 80 83 number_of_global_triangles, number_of_global_nodes), p) 81 84 else: … … 83 86 84 87 domain_name, domain_dir, domain_store, \ 85 domain_minimum_storable_height, \86 georef, number_of_global_triangles, \88 domain_minimum_storable_height, domain_flow_algorithm, \ 89 domain_minimum_allowed_height, georef, number_of_global_triangles, \ 87 90 number_of_global_nodes = receive(0) 88 91 … … 236 239 domain.set_store(domain_store) 237 240 domain.set_minimum_storable_height(domain_minimum_storable_height) 241 domain.set_minimum_allowed_height(domain_minimum_allowed_height) 242 domain.set_flow_algorithm(domain_flow_algorithm) 238 243 domain.geo_reference = georef 239 244 -
trunk/anuga_core/source/anuga_parallel/run_parallel_sw_rectangular_cross.py
r8573 r8582 21 21 # Sequential interface 22 22 #--------------------------- 23 from anuga import Domain24 23 from anuga import Transmissive_boundary, Reflective_boundary 25 24 from anuga import rectangular_cross_domain … … 44 43 #dx = dy = 0.00125 45 44 #dx = dy = 0.5 46 seq_domain = rectangular_cross_domain(int(length/dx), int(width/dy),45 domain = rectangular_cross_domain(int(length/dx), int(width/dy), 47 46 len1=length, len2=width, verbose=verbose) 48 47 49 seq_domain.set_store(False) 50 seq_domain.set_quantity('elevation', lambda x,y : -1.0-x ) 51 seq_domain.set_quantity('stage', 1.0) 52 seq_domain.print_statistics() 48 49 domain.set_store(True) 50 domain.set_quantity('elevation', lambda x,y : -1.0-x ) 51 domain.set_quantity('stage', 1.0) 52 domain.set_flow_algorithm('tsunami') 53 domain.print_statistics() 53 54 else: 54 seq_domain = None55 domain = None 55 56 56 57 t1 = time.time() … … 65 66 barrier() 66 67 67 # setup parameters to test using different ghost_layer_widths 68 parameters = dict(ghost_layer_width = 2) 69 domain = distribute(seq_domain,verbose=verbose, parameters=parameters) 70 71 del seq_domain 68 #------------------------------------------------------------------------- 69 # Distribute domain 70 #------------------------------------------------------------------------- 71 domain = distribute(domain,verbose=verbose) 72 72 73 73 … … 121 121 if myid == 0 : print 'after set quantity' 122 122 123 # Set Evolve parameters124 domain.set_flow_algorithm('2_0')125 126 127 128 129 #domain.update_ghosts()130 131 132 #print 'after evolve parameters'133 134 135 #import pdb; pdb.set_trace()136 137 123 138 124 -
trunk/anuga_core/validation_tests/Tests/Simple/runup_sinusoid/runup_sinusoid.py
r8548 r8582 9 9 10 10 from math import sin, pi, exp 11 from anuga.shallow_water.shallow_water_domain import Domain as Domain 12 #from anuga.shallow_water_balanced2.swb2_domain import Domain as Domain 13 #path.append('/home/gareth/storage/anuga_clean/anuga_jan12/trunk/anuga_work/development/gareth/balanced_basic') 14 #from swb2_domain import * 15 #from balanced_basic import * 16 #from balanced_dev import * 11 12 from anuga import Domain 13 17 14 #--------- 18 15 #Setup computational domain 19 16 #--------- 20 points, vertices, boundary = anuga.rectangular_cross(40,40, len1=1., len2=1.)17 domain = anuga.rectangular_cross_domain(40,40, len1=1., len2=1.) 21 18 22 domain=Domain(points,vertices,boundary) # Create Domain23 domain.set_name('runup_sinusoid_v2') # Output to file runup.sww24 domain.set_datadir('.') # Use current folder25 domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1})26 #domain.set_store_vertices_uniquely(True)27 #domain.minimum_allowed_height=0.00128 19 29 20 #------------------------------------------------------------------------------ … … 35 26 domain.set_flow_algorithm(alg) 36 27 domain.set_CFL(cfl) 28 29 30 domain.set_name('runup_sinusoid_v2') # Output to file runup.sww 31 domain.set_datadir('.') # Use current folder 32 domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1}) 33 #domain.set_store_vertices_uniquely(True) 34 domain.set_minimum_allowed_height(0.01) 35 37 36 38 37 … … 87 86 #------------------------------ 88 87 89 for t in domain.evolve(yieldstep=0. 1,finaltime=20.0):88 for t in domain.evolve(yieldstep=0.5,finaltime=20.0): 90 89 print domain.timestepping_statistics() 91 90 xx = domain.quantities['xmomentum'].centroid_values -
trunk/anuga_core/validation_tests/Tests/Simple/runup_sinusoid/runup_sinusoidplot.py
r8433 r8582 30 30 pyplot.draw() 31 31 pyplot.plot( (0,1),(0,0), 'r' ) 32 pyplot.title(str(i)+'/ 200') # : velocity does not converge to zero' )32 pyplot.title(str(i)+'/40') # : velocity does not converge to zero' ) 33 33 pyplot.xlabel('x') 34 34 pyplot.ylabel('Velocity (m/s)') -
trunk/anuga_core/validation_tests/parameters.py
r8528 r8582 8 8 9 9 10 alg = ' 2_0'10 alg = 'tsunami' 11 11 cfl = 1.0 12 12
Note: See TracChangeset
for help on using the changeset viewer.