Changeset 5290
- Timestamp:
- May 7, 2008, 5:40:11 PM (17 years ago)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/config.py
r5181 r5290 88 88 tight_slope_limiters = True 89 89 90 # Use centroid velocities to reconstruct momentum at vertices 91 # This option has a firts order flavour to it, but we still have second order 92 # reconstruction of stage and this option speeds ANUGA up 93 # 94 # This option must be used with tight_slope_limiters. 95 use_centroid_velocities = True 90 96 91 97 -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r5186 r5290 105 105 from anuga.config import optimised_gradient_limiter 106 106 from anuga.config import use_edge_limiter 107 from anuga.config import use_centroid_velocities 108 107 109 108 110 #--------------------- … … 181 183 # Limiters 182 184 self.use_edge_limiter = use_edge_limiter 183 184 185 self.optimised_gradient_limiter = optimised_gradient_limiter 185 186 self.use_centroid_velocities = use_centroid_velocities 187 186 188 187 189 def set_all_limiters(self, beta): … … 741 743 Ymom.vertex_values, 742 744 Elevation.vertex_values, 743 int(domain.optimise_dry_cells)) 745 int(domain.optimise_dry_cells), 746 int(domain.use_centroid_velocities)) 744 747 745 748 … … 800 803 801 804 802 # Take bed elevation into account when water heights are small805 # Take bed elevation into account when water heights are small 803 806 balance_deep_and_shallow(domain) 804 807 805 # Compute edge values by interpolation808 # Compute edge values by interpolation 806 809 for name in domain.conserved_quantities: 807 810 Q = domain.quantities[name] -
anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r5238 r5290 144 144 145 145 // Compute Froude number; v/sqrt(gh) 146 146 // FIXME (Ole): Not currently in use 147 147 148 double froude_number; 148 149 … … 549 550 double H0, 550 551 int tight_slope_limiters, 552 int use_centroid_velocities, 551 553 double alpha_balance) { 552 554 553 int k, k3, i , excessive_froude_number=0;555 int k, k3, i; //, excessive_froude_number=0; 554 556 555 557 double dz, hmin, alpha, h_diff, hc_k; 556 558 double epsilon = 1.0e-6; // FIXME: Temporary measure 557 double g = 9.81; // FIXME: Temporary measure 558 double hv[3], h; // Depths at vertices 559 double Fx, Fy; // Froude numbers 559 double hv[3]; // Depths at vertices 560 //double Fx, Fy; // Froude numbers 560 561 double uc, vc; // Centroid speeds 561 562 … … 701 702 if (alpha < 1) { 702 703 for (i=0; i<3; i++) { 704 703 705 // FIXME (Ole): Simplify when (if) hvbar gets retired 704 706 if (beta_h > epsilon) { … … 709 711 710 712 // Update momentum at vertices 711 712 713 // Update momentum at vertices 714 // Update momentum as a linear combination of 715 // xmomc and ymomc (shallow) and momentum 716 // from extrapolator xmomv and ymomv (deep). 717 718 719 //xmomv[k3+i] = (1-alpha)*xmomc[k] + alpha*xmomv[k3+i]; 720 //ymomv[k3+i] = (1-alpha)*ymomc[k] + alpha*ymomv[k3+i]; 721 722 if (tight_slope_limiters == 1) { 723 // FIXME(Ole): Here's what I think (as of 17 Nov 2007) 724 // we need to do. Simple and efficient: 713 if (use_centroid_velocities == 1) { 714 // This is a simple, efficient and robust option 715 // It uses first order approximation of velocities, but retains 716 // the order used by stage. 725 717 726 718 // Speeds at centroids … … 738 730 xmomv[k3+i] = uc*hv[i]; 739 731 ymomv[k3+i] = vc*hv[i]; 732 740 733 } else { 741 734 // Update momentum as a linear combination of 742 735 // xmomc and ymomc (shallow) and momentum 743 736 // from extrapolator xmomv and ymomv (deep). 744 // FIXME (Ole): Is this really needed? Could we use the above 745 // instead? 737 // This assumes that values from xmomv and ymomv have 738 // been established e.g. by the gradient limiter. 739 746 740 747 741 xmomv[k3+i] = (1-alpha)*xmomc[k] + alpha*xmomv[k3+i]; … … 749 743 750 744 } 751 }752 }753 754 755 756 if (0) { // FIXME(Ole): Disabled while testing balancing of velocities above757 //if (tight_slope_limiters == 1) {758 759 // Ensure that the Froude number is kept realistic at vertices760 // FIXME (Ole): I think it could be used to adjust alpha down761 // whenever Fr is too large. Possible make sure it doesn't deviate762 // too much from the value at the centroid. I like this idea!763 764 // FIXME (Ole): currently only used with tights_SL765 766 // FIXME (Ole): may not be necessary now767 768 excessive_froude_number=0;769 for (i=0; i<3; i++) {770 771 // Recalculate depth at vertex i772 h = wv[k3+i] - zv[k3+i];773 774 Fx = compute_froude_number(xmomv[k3+i], h, g, epsilon);775 Fy = compute_froude_number(ymomv[k3+i], h, g, epsilon);776 777 if ( (fabs(Fx) > 100.0) || (fabs(Fy) > 100.0)) {778 // FIXME: use max_froude - or base it on centroid value of F779 // printf("Excessive Froude number detected: %f or %f\n", Fx, Fy);780 excessive_froude_number=1;781 }782 }783 784 if (excessive_froude_number) {785 786 // printf("Adjusting momentum to first order.\n");787 // Go back to first order (alpha = 0) for this triangle788 for (i=0; i<3; i++) {789 xmomv[k3+i] = xmomc[k];790 ymomv[k3+i] = ymomc[k];791 792 if (beta_h > epsilon) {793 wv[k3+i] = zv[k3+i] + hvbar[k3+i];794 } else {795 wv[k3+i] = zv[k3+i] + hc_k;796 }797 }798 745 } 799 746 } … … 1094 1041 double* ymom_vertex_values, 1095 1042 double* elevation_vertex_values, 1096 int optimise_dry_cells) { 1043 int optimise_dry_cells, 1044 int use_centroid_velocities) { 1097 1045 1098 1046 … … 1359 1307 // One internal neighbour and gradient is in direction of the neighbour's centroid 1360 1308 1361 // Find the only internal neighbour 1309 // Find the only internal neighbour (k1?) 1362 1310 for (k2=k3;k2<k3+3;k2++){ 1363 1311 // Find internal neighbour of triangle k … … 1367 1315 break; 1368 1316 } 1317 1369 1318 if ((k2==k3+3)) { 1370 1319 // If we didn't find an internal neighbour … … 1396 1345 dy2=dx2*dy1; 1397 1346 dx2*=dx1; 1398 1399 1347 1400 1348 … … 1561 1509 double beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry; 1562 1510 double minimum_allowed_height, epsilon; 1563 int optimise_dry_cells, number_of_elements, e ;1511 int optimise_dry_cells, number_of_elements, e, use_centroid_velocities; 1564 1512 1565 1513 // Provisional jumps from centroids to v'tices and safety factor re limiting 1566 1514 // by which these jumps are limited 1567 1515 // Convert Python arguments to C 1568 if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOi ",1516 if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOii", 1569 1517 &domain, 1570 1518 &surrogate_neighbours, … … 1580 1528 &ymom_vertex_values, 1581 1529 &elevation_vertex_values, 1582 &optimise_dry_cells)) { 1530 &optimise_dry_cells, 1531 &use_centroid_velocities)) { 1583 1532 1584 1533 PyErr_SetString(PyExc_RuntimeError, … … 1625 1574 (double*) ymom_vertex_values -> data, 1626 1575 (double*) elevation_vertex_values -> data, 1627 optimise_dry_cells); 1576 optimise_dry_cells, 1577 use_centroid_velocities); 1628 1578 if (e == -1) { 1629 1579 // Use error string set inside computational routine … … 2271 2221 double H0, beta_h; 2272 2222 2273 int N, tight_slope_limiters ; //, err;2223 int N, tight_slope_limiters, use_centroid_velocities; //, err; 2274 2224 2275 2225 // Convert Python arguments to C … … 2318 2268 2319 2269 2270 Tmp = PyObject_GetAttrString(domain, "use_centroid_velocities"); 2271 if (!Tmp) { 2272 PyErr_SetString(PyExc_RuntimeError, "shallow_water_ext.c: balance_deep_and_shallow could not obtain object use_centroid_velocities from domain"); 2273 return NULL; 2274 } 2275 use_centroid_velocities = PyInt_AsLong(Tmp); 2276 Py_DECREF(Tmp); 2277 2278 2279 2320 2280 N = wc -> dimensions[0]; 2321 2281 _balance_deep_and_shallow(N, … … 2332 2292 H0, 2333 2293 (int) tight_slope_limiters, 2294 (int) use_centroid_velocities, 2334 2295 alpha_balance); 2335 2296 -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r5288 r5290 235 235 236 236 self.domain.tight_slope_limiters = 0 # Backwards compatibility 237 self.domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 238 237 239 238 240 sww = get_dataobject(self.domain) … … 309 311 #domain.tight_slope_limiters = 1 310 312 domain.tight_slope_limiters = 0 # Backwards compatibility 313 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 314 311 315 312 316 sww = get_dataobject(domain) … … 7318 7322 # Look at sww file and see what happens when 7319 7323 # domain.tight_slope_limiters = 1 7320 domain.tight_slope_limiters = 0 7324 domain.tight_slope_limiters = 0 7325 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 7321 7326 7322 7327 Br = Reflective_boundary(domain) … … 7434 7439 # Create basic mesh (100m x 5m) 7435 7440 width = 5 7436 length = 1007441 length = 50 7437 7442 t_end = 10 7438 points, vertices, boundary = rectangular(length, width, 100, 5)7443 points, vertices, boundary = rectangular(length, width, 50, 5) 7439 7444 7440 7445 # Create shallow water domain … … 7522 7527 # Create basic mesh (100m x 5m) 7523 7528 width = 5 7524 length = 1007529 length = 50 7525 7530 t_end = 3 7526 7531 points, vertices, boundary = rectangular(length, width, … … 7651 7656 # Create basic mesh (100m x 5m) 7652 7657 width = 5 7653 length = 1007658 length = 50 7654 7659 t_end = 1 7655 7660 points, vertices, boundary = rectangular(length, width, -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r5178 r5290 1437 1437 domain.H0 = 0 # Backwards compatibility (6/2/7) 1438 1438 domain.beta_h = 0.2 # Backwards compatibility (14/2/7) 1439 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 1440 1439 1441 1440 1442 #----------------------------------------------------------------- … … 2657 2659 # FIXME (Ole): Need tests where this is commented out 2658 2660 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 2661 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 2659 2662 2660 2663 … … 3869 3872 # FIXME (Ole): Need tests where these two are commented out 3870 3873 domain.H0 = 0 # Backwards compatibility (6/2/7) 3871 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 3874 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 3875 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 3872 3876 3873 3877 #Bed-slope and friction … … 3941 3945 3942 3946 # FIXME (Ole): Need tests where this is commented out 3943 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 3947 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 3948 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 3944 3949 3945 3950 #Bed-slope and friction at vertices (and interpolated elsewhere) … … 4038 4043 # FIXME (Ole): Need tests where this is commented out 4039 4044 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 4040 domain.H0 = 0 # Backwards compatibility (6/2/7) 4045 domain.H0 = 0 # Backwards compatibility (6/2/7) 4046 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 4047 4041 4048 4042 4049 #Bed-slope and friction at vertices (and interpolated elsewhere) … … 4141 4148 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 4142 4149 domain.H0 = 0 # Backwards compatibility (6/2/7) 4150 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 4151 4143 4152 4144 4153 #Bed-slope and friction at vertices (and interpolated elsewhere) … … 4240 4249 domain.H0 = 0 # Backwards compatibility (6/2/7) 4241 4250 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 4251 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 4242 4252 4243 4253 … … 4504 4514 # FIXME (Ole): Need tests where these two are commented out 4505 4515 domain.H0 = 0 # Backwards compatibility (6/2/7) 4506 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 4516 domain.tight_slope_limiters = 0 # Backwards compatibility (14/4/7) 4517 domain.use_centroid_velocities = 0 # Backwards compatibility (7/5/8) 4507 4518 4508 4519 … … 5674 5685 suite = unittest.makeSuite(Test_Shallow_Water,'test') 5675 5686 5676 #suite = unittest.makeSuite(Test_Shallow_Water,'test_balance_deep_and_shallow_Froude') 5677 5687 #suite = unittest.makeSuite(Test_Shallow_Water,'test_bedslope_problem_first_order_moresteps') 5678 5688 #suite = unittest.makeSuite(Test_Shallow_Water,'test_fitting_using_shallow_water_domain') 5679 5689 #suite = unittest.makeSuite(Test_Shallow_Water,'test_tight_slope_limiters') -
anuga_validation/automated_validation_tests/fitting/validate_benchmark_fit.py
r4919 r5290 7 7 memory is measured here. What is actually happening is the mesh 8 8 generation is using less memory, in version 4917. In version 4897 9 mesh gen uses and frees up more memory, so p hython asks for less extra9 mesh gen uses and frees up more memory, so python asks for less extra 10 10 memory in the fitting stage. So overall version 4917 is an 11 11 improvement. … … 65 65 self.assert_(time<time_standard*1.2) 66 66 mem_standard = 302404 67 # 67 # 68 68 self.assert_(mem<mem_standard*1.2) 69 69 … … 90 90 time_standard = 14.2 91 91 self.assert_(time<time_standard*1.2) 92 mem_standard = 21008 # this will need to be updated, see top notes 93 self.assert_(mem<mem_standard*1.2) 92 mem_standard = 30000 # Updated by Ole 20080507 93 msg = 'Memory used was %d, mem_standard is %d' %(mem, mem_standard) 94 assert mem < mem_standard*1.2, msg 94 95 95 96 elif host.find('pc-31569') == 0: # DSG's PC -
anuga_validation/automated_validation_tests/validate_all.py
r4842 r5290 2 2 """ 3 3 4 import os 4 import os, time 5 5 6 6 … … 28 28 29 29 30 print 31 print '----------------------------------------------------------' 32 print 'Running all validation tests - this may take several hours' 33 print '----------------------------------------------------------' 30 34 31 35 for path, filename in validation_dirs_and_files: … … 33 37 34 38 os.chdir(path) 35 s = 'python %s' %( filename) 39 s = 'python %s' %(filename) 40 print s 41 t0 = time.time() 36 42 os.system(s) 37 # print 'current dir', os.getcwd()43 print 'That took %.2f seconds' %(time.time()-t0) 38 44 39 45 # Back to parent directory
Note: See TracChangeset
for help on using the changeset viewer.