Changeset 4731
- Timestamp:
- Sep 12, 2007, 1:05:19 PM (18 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r4730 r4731 280 280 // Flux computation 281 281 denom = s_max-s_min; 282 if (denom == 0.0) { // FIXME (Ole): Try using epsilonhere282 if (denom < epsilon) { // FIXME (Ole): Try using H0 here 283 283 for (i=0; i<3; i++) edgeflux[i] = 0.0; 284 284 *max_speed = 0.0; … … 623 623 double u, v, reduced_speed; 624 624 625 // Protect against initesimal and negative heights 626 for (k=0; k<N; k++) { 627 hc = wc[k] - zc[k]; 628 629 if (hc < minimum_allowed_height) { 625 626 // Protect against initesimal and negative heights 627 if (maximum_allowed_speed < epsilon) { 628 for (k=0; k<N; k++) { 629 hc = wc[k] - zc[k]; 630 631 if (hc < minimum_allowed_height) { 630 632 631 //Old code: Set momentum to zero and ensure h is non negative 632 //xmomc[k] = 0.0; 633 //ymomc[k] = 0.0; 634 //if (hc <= 0.0) wc[k] = zc[k]; 635 636 637 //New code: Adjust momentum to guarantee speeds are physical 638 // ensure h is non negative 639 //FIXME (Ole): This is only implemented in this C extension and 640 // has no Python equivalent 641 642 if (hc <= 0.0) { 643 wc[k] = zc[k]; 633 // Set momentum to zero and ensure h is non negative 644 634 xmomc[k] = 0.0; 645 635 ymomc[k] = 0.0; 646 } else { 647 //Reduce excessive speeds derived from division by small hc 648 //FIXME (Ole): This may be unnecessary with new slope limiters 649 //in effect. 650 651 u = xmomc[k]/hc; 652 if (fabs(u) > maximum_allowed_speed) { 653 reduced_speed = maximum_allowed_speed * u/fabs(u); 654 //printf("Speed (u) has been reduced from %.3f to %.3f\n", 655 // u, reduced_speed); 656 xmomc[k] = reduced_speed * hc; 657 } 658 659 v = ymomc[k]/hc; 660 if (fabs(v) > maximum_allowed_speed) { 661 reduced_speed = maximum_allowed_speed * v/fabs(v); 662 //printf("Speed (v) has been reduced from %.3f to %.3f\n", 663 // v, reduced_speed); 664 ymomc[k] = reduced_speed * hc; 665 } 636 if (hc <= 0.0) wc[k] = zc[k]; 637 } 638 } 639 } else { 640 641 // Protect against initesimal and negative heights 642 for (k=0; k<N; k++) { 643 hc = wc[k] - zc[k]; 644 645 if (hc < minimum_allowed_height) { 646 647 //New code: Adjust momentum to guarantee speeds are physical 648 // ensure h is non negative 649 //FIXME (Ole): This is only implemented in this C extension and 650 // has no Python equivalent 651 652 if (hc <= 0.0) { 653 wc[k] = zc[k]; 654 xmomc[k] = 0.0; 655 ymomc[k] = 0.0; 656 } else { 657 //Reduce excessive speeds derived from division by small hc 658 //FIXME (Ole): This may be unnecessary with new slope limiters 659 //in effect. 660 661 u = xmomc[k]/hc; 662 if (fabs(u) > maximum_allowed_speed) { 663 reduced_speed = maximum_allowed_speed * u/fabs(u); 664 //printf("Speed (u) has been reduced from %.3f to %.3f\n", 665 // u, reduced_speed); 666 xmomc[k] = reduced_speed * hc; 667 } 668 669 v = ymomc[k]/hc; 670 if (fabs(v) > maximum_allowed_speed) { 671 reduced_speed = maximum_allowed_speed * v/fabs(v); 672 //printf("Speed (v) has been reduced from %.3f to %.3f\n", 673 // v, reduced_speed); 674 ymomc[k] = reduced_speed * hc; 675 } 676 } 666 677 } 667 678 } … … 669 680 return 0; 670 681 } 671 672 682 673 683 … … 680 690 double cw) { 681 691 682 // Assign windfield values to momentum updates692 // Assign windfield values to momentum updates 683 693 684 694 int k; -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r4710 r4731 873 873 N = 5 874 874 points, vertices, boundary = rectangular_cross(N, N) 875 domain = Domain(points, vertices, boundary) 875 domain = Domain(points, vertices, boundary) 876 domain.set_maximum_allowed_speed(1.0) 876 877 877 878 #-------------------------------------------------------------- … … 1020 1021 domain = Domain(points, vertices, boundary) 1021 1022 domain.set_name('runup_test') 1023 domain.set_maximum_allowed_speed(1.0) 1022 1024 #domain.tight_slope_limiters = 1 #FIXME: This works better with old limiters 1023 1025 … … 2989 2991 domain.beta_vh_dry = 0.9 2990 2992 #domain.minimum_allowed_height = 0.0 #Makes it like the 'oldstyle' balance 2991 domain.H0 = 0 # Backwards compatibility (6/2/7) 2993 domain.H0 = 0 # Backwards compatibility (6/2/7) 2994 domain.set_maximum_allowed_speed(1.0) 2992 2995 2993 2996 # Boundary conditions … … 3104 3107 domain.beta_vh = 0.9 3105 3108 domain.beta_vh_dry = 0.9 3106 domain.H0 = 0 # Backwards compatibility (6/2/7) 3109 domain.H0 = 0 # Backwards compatibility (6/2/7) 3110 domain.set_maximum_allowed_speed(1.0) 3107 3111 3108 3112 # Boundary conditions
Note: See TracChangeset
for help on using the changeset viewer.