Changeset 5315
- Timestamp:
- May 13, 2008, 6:08:40 PM (16 years ago)
- Location:
- anuga_core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/demos/channel3.py
r5173 r5315 74 74 # Evolve system through time 75 75 #------------------------------------------------------------------------------ 76 for t in domain.evolve(yieldstep = 0. 2, finaltime = 16.0):76 for t in domain.evolve(yieldstep = 0.1, finaltime = 16.0): 77 77 print domain.timestepping_statistics() 78 78 -
anuga_core/source/anuga/config.py
r5313 r5315 88 88 tight_slope_limiters = True 89 89 90 # Use centroid velocities to reconstruct momentum at vertices in very shallow water 90 # Use centroid velocities to reconstruct momentum at vertices in 91 # very shallow water 91 92 # This option has a first order flavour to it, but we still have second order 92 # reconstruction of stage and this option only applies in balance_deep_and_shallow when 93 # reconstruction of stage and this option only applies in 94 # balance_deep_and_shallow when 93 95 # alpha < 1 so in deeper water the full second order scheme is used. 94 96 # -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r5306 r5315 732 732 Ymom.vertex_values, 733 733 Elevation.vertex_values, 734 int(domain.optimise_dry_cells), 735 int(domain.use_centroid_velocities)) 734 int(domain.optimise_dry_cells)) 736 735 737 736 -
anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r5306 r5315 550 550 double H0, 551 551 int tight_slope_limiters, 552 int use_centroid_velocities, 552 int use_centroid_velocities, 553 553 double alpha_balance) { 554 554 555 int k, k3, i; //, excessive_froude_number=0;555 int k, k3, i; 556 556 557 557 double dz, hmin, alpha, h_diff, hc_k; 558 558 double epsilon = 1.0e-6; // FIXME: Temporary measure 559 559 double hv[3]; // Depths at vertices 560 //double Fx, Fy; // Froude numbers561 560 double uc, vc; // Centroid speeds 562 561 … … 651 650 alpha = 1.0; 652 651 } 653 654 652 } 655 653 656 654 657 655 // Let … … 684 682 685 683 // Update momentum at vertices 686 if (use_centroid_velocities == 0) { 684 if (use_centroid_velocities == 1) { 685 // This is a simple, efficient and robust option 686 // It uses first order approximation of velocities, but retains 687 // the order used by stage. 688 689 // Speeds at centroids 690 if (hc_k > epsilon) { 691 uc = xmomc[k]/hc_k; 692 vc = ymomc[k]/hc_k; 693 } else { 694 uc = 0.0; 695 vc = 0.0; 696 } 697 698 // Vertex momenta guaranteed to be consistent with depth guaranteeing 699 // controlled speed 700 hv[i] = wv[k3+i] - zv[k3+i]; // Recompute (balanced) vertex depth 701 xmomv[k3+i] = uc*hv[i]; 702 ymomv[k3+i] = vc*hv[i]; 703 704 } else { 687 705 // Update momentum as a linear combination of 688 706 // xmomc and ymomc (shallow) and momentum … … 691 709 // been established e.g. by the gradient limiter. 692 710 711 // FIXME (Ole): I think this should be used with vertex momenta 712 // computed above using centroid_velocities instead of xmomc 713 // and ymomc as they'll be more representative first order 714 // values. 693 715 694 716 xmomv[k3+i] = (1-alpha)*xmomc[k] + alpha*xmomv[k3+i]; … … 697 719 } 698 720 } 699 } // If alpha == 1 use quantities as calculated by the gradient-limiter700 701 if (use_centroid_velocities == 1) {702 // This is a simple, efficient and robust option in shallow water703 // It uses first order approximation of velocities, but retains704 // the order used by stage.705 // In this case the xmomv and ymomv calculations should be switched off706 // in the gradient limiter.707 708 for (i=0; i<3; i++) {709 710 // Speeds at centroids711 if (hc_k > epsilon) {712 uc = xmomc[k]/hc_k;713 vc = ymomc[k]/hc_k;714 } else {715 uc = 0.0;716 vc = 0.0;717 }718 719 // Vertex momenta guaranteed to be consistent with depth guaranteeing720 // controlled speed721 hv[i] = wv[k3+i] - zv[k3+i]; // Recompute (balanced) vertex depth722 xmomv[k3+i] = uc*hv[i];723 ymomv[k3+i] = vc*hv[i];724 }725 721 } 726 722 } 727 723 return 0; 728 724 } 725 729 726 730 727 … … 1020 1017 double* ymom_vertex_values, 1021 1018 double* elevation_vertex_values, 1022 int optimise_dry_cells, 1023 int use_centroid_velocities) { 1019 int optimise_dry_cells) { 1024 1020 1025 1021 … … 1027 1023 // Local variables 1028 1024 double a, b; // Gradient vector used to calculate vertex values from centroids 1029 int k,k0,k1,k2,k3,k6,coord_index, 1025 int k,k0,k1,k2,k3,k6,coord_index,i; 1030 1026 double x,y,x0,y0,x1,y1,x2,y2,xv0,yv0,xv1,yv1,xv2,yv2; // Vertices of the auxiliary triangle 1031 1027 double dx1,dx2,dy1,dy2,dxv0,dxv1,dxv2,dyv0,dyv1,dyv2,dq0,dq1,dq2,area2; … … 1192 1188 for (i=0;i<3;i++) 1193 1189 stage_vertex_values[k3+i]=stage_centroid_values[k]+dqv[i]; 1194 1195 1196 if (use_centroid_velocities == 1) {1197 // Use first order reconstruction using speeds only.1198 1199 // This happens in balance_deep_and_shallow so there1200 // is no need to do more here1201 1202 // FIXME (Ole): Optionally we could put the computation here but then1203 // it'd go into all other variants of the gradient limiter1204 continue;1205 }1206 1190 1207 1191 … … 1500 1484 double beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry; 1501 1485 double minimum_allowed_height, epsilon; 1502 int optimise_dry_cells, number_of_elements, e , use_centroid_velocities;1486 int optimise_dry_cells, number_of_elements, e; 1503 1487 1504 1488 // Provisional jumps from centroids to v'tices and safety factor re limiting 1505 1489 // by which these jumps are limited 1506 1490 // Convert Python arguments to C 1507 if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOi i",1491 if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOi", 1508 1492 &domain, 1509 1493 &surrogate_neighbours, … … 1519 1503 &ymom_vertex_values, 1520 1504 &elevation_vertex_values, 1521 &optimise_dry_cells, 1522 &use_centroid_velocities)) { 1505 &optimise_dry_cells)) { 1523 1506 1524 1507 PyErr_SetString(PyExc_RuntimeError, … … 1565 1548 (double*) ymom_vertex_values -> data, 1566 1549 (double*) elevation_vertex_values -> data, 1567 optimise_dry_cells, 1568 use_centroid_velocities); 1550 optimise_dry_cells); 1569 1551 if (e == -1) { 1570 1552 // Use error string set inside computational routine
Note: See TracChangeset
for help on using the changeset viewer.