Changeset 8772
- Timestamp:
- Mar 20, 2013, 12:01:46 AM (12 years ago)
- Location:
- trunk/anuga_work/development/gareth
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain.py
r8751 r8772 2 2 from anuga.shallow_water.shallow_water_domain import * 3 3 from anuga.shallow_water.shallow_water_domain import Domain as Sww_domain 4 4 import numpy 5 5 6 6 ############################################################################## … … 77 77 # all the betas. 78 78 self.beta_w=1.0 79 self.beta_w_dry= 1.079 self.beta_w_dry=0.0 80 80 self.beta_uh=1.0 81 self.beta_uh_dry= 1.081 self.beta_uh_dry=0.0 82 82 self.beta_vh=1.0 83 self.beta_vh_dry= 1.083 self.beta_vh_dry=0.0 84 84 85 85 #self.optimise_dry_cells=True … … 104 104 #self.forcing_terms.append(manning_friction_explicit) 105 105 #self.forcing_terms.remove(manning_friction_implicit) 106 107 # Keep track of the fluxes through the boundaries 108 self.boundary_flux_integral=numpy.ndarray(1) 109 self.boundary_flux_integral[0]=0. 110 self.boundary_flux_sum=numpy.ndarray(1) 111 self.boundary_flux_sum[0]=0. 106 112 107 113 print '##########################################################################' … … 256 262 domain.H0, 257 263 domain.g, 264 domain.boundary_flux_sum, 258 265 domain.neighbours, 259 266 domain.neighbour_edges, … … 285 292 #import pdb 286 293 #pdb.set_trace() 294 #print 'flux timestep: ', flux_timestep, domain.timestep 295 if(flux_timestep == float(sys.maxint)): 296 domain.boundary_flux_integral[0]= domain.boundary_flux_integral[0] +\ 297 domain.boundary_flux_sum[0]*domain.timestep*0.5 298 #print 'dbfi ', domain.boundary_flux_integral, domain.boundary_flux_sum 299 domain.boundary_flux_sum[0]=0. 287 300 288 301 domain.flux_timestep = flux_timestep 302 289 303 290 304 -
trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain_ext.c
r8751 r8772 139 139 // Compute speeds in x-direction 140 140 w_left = q_left_rotated[0]; 141 h_left = w_left - z;141 h_left = max(w_left - z,0.); 142 142 uh_left = q_left_rotated[1]; 143 //if(h_left>1.e-06){ 144 // u_left = uh_left/max(h_left, 1.0e-06); 145 //}else{ 146 // u_left=0.; 147 //} 143 148 u_left = _compute_speed(&uh_left, &h_left, 144 epsilon, h0, limiting_threshold);149 epsilon, h0, limiting_threshold); 145 150 146 151 w_right = q_right_rotated[0]; 147 h_right = w_right - z;152 h_right = max(w_right - z, 0.); 148 153 uh_right = q_right_rotated[1]; 149 154 u_right = _compute_speed(&uh_right, &h_right, 150 epsilon, h0, limiting_threshold); 155 epsilon, h0, limiting_threshold); 156 //if(h_right>1.0e-06){ 157 // u_right = uh_right/max(h_right, 1.0e-06); 158 //}else{ 159 // u_right=0.; 160 //} 151 161 152 162 // Momentum in y-direction … … 157 167 // Leaving this out, improves speed significantly (Ole 27/5/2009) 158 168 // All validation tests pass, so do we really need it anymore? 159 _compute_speed(&vh_left, &h_left,160 epsilon, h0, limiting_threshold);161 _compute_speed(&vh_right, &h_right,162 epsilon, h0, limiting_threshold);169 //_compute_speed(&vh_left, &h_left, 170 // epsilon, h0, limiting_threshold); 171 //_compute_speed(&vh_right, &h_right, 172 // epsilon, h0, limiting_threshold); 163 173 164 174 // Maximal and minimal wave speeds … … 219 229 { 220 230 edgeflux[i] = s_max*flux_left[i] - s_min*flux_right[i]; 221 edgeflux[i] += s_max*s_min*(q_right_rotated[i] - q_left_rotated[i]);231 edgeflux[i] += (s_max*s_min)*(q_right_rotated[i] - q_left_rotated[i]); 222 232 edgeflux[i] *= inverse_denominator; 223 233 } … … 242 252 double H0, 243 253 double g, 254 double* boundary_flux_sum, 244 255 long* neighbours, 245 256 long* neighbour_edges, … … 272 283 double h0 = H0*H0; // This ensures a good balance when h approaches H0. 273 284 274 double limiting_threshold = 10 * H0; // Avoid applying limiter below this285 double limiting_threshold = H0; //10 * H0; // Avoid applying limiter below this 275 286 // threshold for performance reasons. 276 287 // See ANUGA manual under flux limiting 277 int k, i, m, n,j ;288 int k, i, m, n,j, ii; 278 289 int ki, nm = 0, ki2,ki3, nm3; // Index shorthands 279 290 … … 281 292 double ql[3], qr[3], edgeflux[3]; // Work array for summing up fluxes 282 293 double stage_edges[3];//Work array 283 double bedslope_work ;294 double bedslope_work, local_timestep; 284 295 int neighbours_wet[3];//Work array 285 296 int useint; 286 double stage_edge_lim, outgoing_ flux_edges, bedtop, bedbot, pressure_flux, hc, hc_n, tmp, tmp2;297 double stage_edge_lim, outgoing_mass_edges, bedtop, bedbot, pressure_flux, hc, hc_n, tmp, tmp2; 287 298 static long call = 1; // Static local variable flagging already computed flux 288 299 … … 300 311 memset((char*) xmom_explicit_update, 0, number_of_elements * sizeof (double)); 301 312 memset((char*) ymom_explicit_update, 0, number_of_elements * sizeof (double)); 313 302 314 303 315 // Compute minimum bed edge value on each triangle … … 424 436 // every 2nd call. This works for rk2 timestepping only, and is 425 437 // needed for correct wetting and drying treatment 426 if ((tri_full_flag[k] == 1) && (call%2==0)) { 438 if ((tri_full_flag[k] == 1) ) { 439 440 if(call%2==1) max_speed = max_speed_array[k]; // HACK to Ensure that local timestep is the same as the last timestep 441 427 442 if (max_speed > epsilon) { 428 443 // Apply CFL condition for triangles joining this edge (triangle k and triangle n) … … 449 464 // Limit edgefluxes, for mass conservation near wet/dry cells 450 465 for(k=0; k< number_of_elements; k++){ 451 // Only check cells that are **near dry**452 // Found I could get problems by checking all cells453 if(stage_centroid_values[k] <= max_bed_edgevalue[k] + H0){454 466 hc = max(stage_centroid_values[k] - bed_centroid_values[k],0.); 455 467 // Loop over every edge … … 457 469 if(i==0){ 458 470 // Add up the outgoing flux through the cell 459 outgoing_ flux_edges=0.0;471 outgoing_mass_edges=0.0; 460 472 for(useint=0; useint<3; useint++){ 461 473 if(edgeflux_store[3*(3*k+useint)]< 0.){ 462 //outgoing_ flux_edges+=1.0;463 outgoing_ flux_edges+=(edgeflux_store[3*(3*k+useint)]*timestep);474 //outgoing_mass_edges+=1.0; 475 outgoing_mass_edges+=(edgeflux_store[3*(3*k+useint)]*timestep); 464 476 } 465 477 } … … 473 485 // Idea: The cell will not go dry if: 474 486 // total_outgoing_flux <= cell volume = Area_triangle*hc 475 if((edgeflux_store[ki3]< 0.0) && (outgoing_ flux_edges<0.)){487 if((edgeflux_store[ki3]< 0.0) && (outgoing_mass_edges<0.)){ 476 488 477 489 // This bound could be improved (e.g. we could actually sum … … 480 492 // about subsequent changes to the + edgeflux caused by 481 493 // constraints associated with neighbouring triangles. 482 tmp = (areas[k]*hc)/(fabs(outgoing_ flux_edges)+1.0e-10) ;494 tmp = (areas[k]*hc)/(fabs(outgoing_mass_edges)+1.0e-10) ; 483 495 if(tmp< 1.0){ 484 // Idea: we should be close to conserving mass if this holds, 485 // --- consider CFL condition. 486 tmp2 = min(hc/((stage_edge_values[ki]-bed_edge_values[ki])+1.0e-10), 1.0); 487 //tmp2=(xmom_centroid_values[k]*xmom_centroid_values[k]+ymom_centroid_values[k]*ymom_centroid_values[k]); 488 //tmp2/=(xmom_edge_values[ki]*xmom_edge_values[ki]+ ymom_edge_values[ki]*ymom_edge_values[ki]+1.0e-10); 489 //tmp2 = sqrt(tmp2); 490 //tmp2 = min(tmp2, 1.0); 491 edgeflux_store[ki3+0]*=tmp2; 492 edgeflux_store[ki3+1]*=tmp2; 493 edgeflux_store[ki3+2]*=tmp2; 496 edgeflux_store[ki3+0]*=tmp; 497 edgeflux_store[ki3+1]*=tmp; 498 edgeflux_store[ki3+2]*=tmp; 494 499 495 500 // Compute neighbour edge index … … 498 503 nm = 3*n + neighbour_edges[ki]; 499 504 nm3 = nm*3; 500 edgeflux_store[nm3+0]*=tmp 2;501 edgeflux_store[nm3+1]*=tmp 2;502 edgeflux_store[nm3+2]*=tmp 2;505 edgeflux_store[nm3+0]*=tmp; 506 edgeflux_store[nm3+1]*=tmp; 507 edgeflux_store[nm3+2]*=tmp; 503 508 } 504 509 } 505 510 } 506 }507 511 } 508 512 } 509 510 513 511 514 // Now add up stage, xmom, ymom explicit updates … … 520 523 ki2=ki*2; 521 524 ki3 = ki*3; 525 n=neighbours[ki]; 522 526 523 527 // GD HACK … … 533 537 534 538 539 // If neighbour is a boundary condition, add the flux to the boundary_flux_integral 540 if(n<0){ 541 boundary_flux_sum[0] += edgeflux_store[ki3]; 542 //printf("%f, %f, %d \n", boundary_flux_sum[0], timestep, ki3); 543 } 544 535 545 // GD HACK 536 546 // Compute bed slope term … … 552 562 ymom_explicit_update[k] *= inv_area; 553 563 } // end cell k 564 565 //if(call%2==0) timestep=local_timestep; 554 566 555 567 // Look for 'dry' edges, and set momentum (& component of momentum_update) … … 790 802 double dqv[3], qmin, qmax, hmin, hmax, bedmax, stagemin; 791 803 double hc, h0, h1, h2, beta_tmp, hfactor, xtmp, ytmp, weight, tmp; 792 double dk, dv0, dv1, dv2, de[3], demin, dcmax, r0scale, vect_norm, l1, l2 ;804 double dk, dv0, dv1, dv2, de[3], demin, dcmax, r0scale, vect_norm, l1, l2, a_bs, b_bs, area_e, inv_area_e; 793 805 794 806 double *xmom_centroid_store, *ymom_centroid_store, *stage_centroid_store, *min_elevation_edgevalue, *max_elevation_edgevalue; … … 835 847 cell_wetness_scale[k] = 0.; 836 848 // Check if cell k is wet 837 if(stage_centroid_values[k] > elevation_centroid_values[k] + minimum_allowed_height+epsilon){ 849 if(stage_centroid_values[k] > elevation_centroid_values[k]){ 850 //if(stage_centroid_values[k] > elevation_centroid_values[k] + minimum_allowed_height+epsilon){ 838 851 //if(stage_centroid_values[k] > max_elevation_edgevalue[k] + minimum_allowed_height+epsilon){ 839 852 cell_wetness_scale[k] = 1.; … … 918 931 dyv1 = yv1 - y; 919 932 dyv2 = yv2 - y; 933 934 935 // Compute bed slope as a reference 936 area_e = (yv2-yv0)*(xv1-xv0) - (yv1-yv0)*(xv2-xv0); 937 inv_area_e=1.0/area_e; 938 a_bs = (yv2 - yv0)*(elevation_edge_values[k3+1]-elevation_edge_values[k3+0]) - 939 (yv1 - yv0)*(elevation_edge_values[k3+2]-elevation_edge_values[k3+0]); 940 a_bs *= inv_area_e; 941 942 b_bs = -(xv2 - xv0)*(elevation_edge_values[k3+1]-elevation_edge_values[k3+0]) + 943 (xv1 - xv0)*(elevation_edge_values[k3+2]-elevation_edge_values[k3+0]); 944 b_bs *= inv_area_e; 945 946 //printf("slopes: %f, %f \n", a_bs, b_bs); 920 947 } 921 948 … … 995 1022 area2 = dy2*dx1 - dy1*dx2; 996 1023 997 // Treat triangles with zero or 1 wet neighbours (area2 <=0.)1024 //// Treat triangles with zero or 1 wet neighbours (area2 <=0.) 998 1025 if ((area2 <= 0.))// || (cell_wetness_scale[k]==0.)) //|(count_wet_neighbours[k]==0)) 999 1026 { 1000 //if((cell_wetness_scale[k]==1.0) | (k==k0)&&(k==k1)&&(k==k2)){ 1001 //if(count_wet_neighbours[k] > 5.){ 1027 1028 if(0==1){ 1029 // Friction slope type extrapolation -- emulating steady flow 1030 // d(stage)/dx = - u*sqrt(u**2 + v**2)*n**2/depth**(4/3) 1031 hc=max(stage_centroid_values[k] - elevation_centroid_values[k],0.0); 1032 if(hc>1.0e-06){ 1033 tmp = sqrt(xmom_centroid_values[k]*xmom_centroid_values[k] + 1034 ymom_centroid_values[k]*ymom_centroid_values[k])*0.03*0.03; 1035 tmp /=pow(hc,10.0/3.0); 1036 }else{ 1037 tmp=0.0; 1038 } 1039 a = -xmom_centroid_values[k]*tmp; 1040 b = -ymom_centroid_values[k]*tmp; 1041 1042 // Limit gradient to be between the bed slope, and zero 1043 if(a*a_bs<0.) a=0.; 1044 if(fabs(a)>fabs(a_bs)) a=a_bs; 1045 if(b*b_bs<0.) b=0.; 1046 if(fabs(b)>fabs(b_bs)) b=b_bs; 1047 1048 1049 dqv[0] = a*dxv0 + b*dyv0; 1050 dqv[1] = a*dxv1 + b*dyv1; 1051 dqv[2] = a*dxv2 + b*dyv2; 1052 1053 stage_edge_values[k3+0] = stage_centroid_values[k] + dqv[0]; 1054 stage_edge_values[k3+1] = stage_centroid_values[k] + dqv[1]; 1055 stage_edge_values[k3+2] = stage_centroid_values[k] + dqv[2]; 1056 }else{ 1057 // Constant stage extrapolation 1002 1058 stage_edge_values[k3] = stage_centroid_values[k]; 1003 1059 stage_edge_values[k3+1] = stage_centroid_values[k]; 1004 1060 stage_edge_values[k3+2] = stage_centroid_values[k]; 1061 } 1005 1062 //}else{ 1006 1063 //}else{ … … 1116 1173 1117 1174 // Calculate heights of neighbouring cells 1118 //hc = stage_centroid_values[k] - elevation_centroid_values[k];1119 //h0 = stage_centroid_values[k0] - elevation_centroid_values[k0];1120 //h1 = stage_centroid_values[k1] - elevation_centroid_values[k1];1121 //h2 = stage_centroid_values[k2] - elevation_centroid_values[k2];1122 //hmin = min(min(h0, min(h1, h2)), hc);1175 hc = stage_centroid_values[k] - elevation_centroid_values[k]; 1176 h0 = stage_centroid_values[k0] - elevation_centroid_values[k0]; 1177 h1 = stage_centroid_values[k1] - elevation_centroid_values[k1]; 1178 h2 = stage_centroid_values[k2] - elevation_centroid_values[k2]; 1179 hmin = min(min(h0, min(h1, h2)), hc); 1123 1180 //// GD FIXME: No longer needed? 1124 1181 //hfactor = 0.0; … … 1130 1187 //hfactor=hmin/(hmin + 0.004); 1131 1188 //} 1189 hfactor= min(2.0*max(hmin,0)/max(hc,1.0e-06), 1.0); 1132 1190 1133 1191 //----------------------------------- … … 1143 1201 dq1 = stage_centroid_values[k1] - stage_centroid_values[k0]; 1144 1202 dq2 = stage_centroid_values[k2] - stage_centroid_values[k0]; 1145 1203 1204 //if( (area2>0.0) ){ 1205 1146 1206 inv_area2 = 1.0/area2; 1147 // Calculate the gradient of stage on the auxiliary triangle 1148 a = dy2*dq1 - dy1*dq2; 1149 a *= inv_area2; 1150 b = dx1*dq2 - dx2*dq1; 1151 b *= inv_area2; 1152 // d(stage)/dx = - u*sqrt(u**2 + v**2)*n**2/depth 1153 //hc=max(stage_centroid_values[k] - elevation_centroid_values[k],0.0); 1154 //tmp = sqrt(xmom_centroid_values[k]*xmom_centroid_values[k] + 1155 // ymom_centroid_values[k]*ymom_centroid_values[k])*0.03*0.03; 1156 //tmp /=max(hc*hc*hc, 1.0e-09); 1157 //a = -xmom_centroid_values[k]*tmp; 1158 //b = -ymom_centroid_values[k]*tmp; 1207 //if(count_wet_neighbours[k] > 1){ 1208 //if(1==1){ 1209 // // Calculate the gradient of stage on the auxiliary triangle 1210 a = dy2*dq1 - dy1*dq2; 1211 a *= inv_area2; 1212 b = dx1*dq2 - dx2*dq1; 1213 b *= inv_area2; 1214 //}else{ 1215 //// //// Friction slope type extrapolation -- emulating steady flow 1216 //// //// d(stage)/dx = - u*sqrt(u**2 + v**2)*n**2/depth**(4/3) 1217 // hc=max(stage_centroid_values[k] - elevation_centroid_values[k],0.0); 1218 // if(hc>1.0e-06){ 1219 // tmp = sqrt(xmom_centroid_values[k]*xmom_centroid_values[k] + 1220 // ymom_centroid_values[k]*ymom_centroid_values[k])*0.03*0.03; 1221 // tmp /=max(pow(hc,10.0/3.0), 1.0e-30); 1222 // }else{ 1223 // tmp=0.0; 1224 // } 1225 // a = -xmom_centroid_values[k]*tmp; 1226 // b = -ymom_centroid_values[k]*tmp; 1227 //// // Limit gradient to be between the bed slope, and zero 1228 //// if(a*a_bs<0.) a=0.; 1229 //// if(fabs(a)>fabs(a_bs)) a=a_bs; 1230 //// if(b*b_bs<0.) b=0.; 1231 //// if(fabs(b)>fabs(b_bs)) b=b_bs; 1232 //} 1159 1233 // Calculate provisional jumps in stage from the centroid 1160 1234 // of triangle k to its vertices, to be limited … … 1175 1249 //if((count_wet_neighbours[k]>0)&&(cell_wetness_scale[k]=1.0)){//&&(k_wetdry==0)){ 1176 1250 //if(stage_centroid_values[k] > max_elevation_edgevalue[k]){ 1251 //if( (area2>0) ){ 1252 //if(count_wet_neighbours[k]>0){ 1177 1253 limit_gradient(dqv, qmin, qmax, beta_tmp); 1254 //} 1255 //} 1178 1256 stage_edge_values[k3+0] = stage_centroid_values[k] + dqv[0]; 1179 1257 stage_edge_values[k3+1] = stage_centroid_values[k] + dqv[1]; … … 1194 1272 //} 1195 1273 //}else{ 1196 // d(stage)/dx = - u*sqrt(u**2 + v**2)*n**2/depth 1274 // d(stage)/dx = - u*sqrt(u**2 + v**2)*n**2/depth**(4/3) 1197 1275 // hc=max(stage_centroid_values[k] - elevation_centroid_values[k],0.0); 1198 1276 // tmp = sqrt(xmom_centroid_values[k]*xmom_centroid_values[k] + … … 1265 1343 //if((k!=k0)&(k!=k1)&(k!=k2)) 1266 1344 //if(stagemin>=bedmax){ 1267 if((count_wet_neighbours[k]>0)){ // &&1345 //if((count_wet_neighbours[k]>0)){ // && 1268 1346 // (cell_wetness_scale[k]==1.0)){ 1269 1347 //if(stage_centroid_values[k]>(minimum_allowed_height+max_elevation_edgevalue[k])){ 1270 1348 limit_gradient(dqv, qmin, qmax, beta_tmp); 1271 }else{1272 dqv[0]=0.;1273 dqv[1]=0.;1274 dqv[2]=0.;1275 // limit_gradient(dqv, qmin, qmax, 0.);1276 }1349 //}else{ 1350 // dqv[0]=0.; 1351 // dqv[1]=0.; 1352 // dqv[2]=0.; 1353 //// limit_gradient(dqv, qmin, qmax, 0.); 1354 //} 1277 1355 //limit_gradient2(dqv, qmin, qmax, beta_tmp,r0scale); 1278 1356 … … 1318 1396 // Limit the gradient 1319 1397 //if(stagemin>=bedmax){ 1320 if((count_wet_neighbours[k]>0)){//&&1398 //if((count_wet_neighbours[k]>0)){//&& 1321 1399 //(cell_wetness_scale[k]==1.0)){ 1322 1400 //(stage_centroid_values[k]>(minimum_allowed_height+elevation_centroid_values[k]))){ 1323 1401 //if(stage_centroid_values[k]>(minimum_allowed_height+max_elevation_edgevalue[k])){ 1324 1402 limit_gradient(dqv, qmin, qmax, beta_tmp); 1325 }else{1326 dqv[0]=0.;1327 dqv[1]=0.;1328 dqv[2]=0.;1329 }1403 //}else{ 1404 // dqv[0]=0.; 1405 // dqv[1]=0.; 1406 // dqv[2]=0.; 1407 //} 1330 1408 1331 1409 for (i=0;i<3;i++) … … 1644 1722 1645 1723 1646 PyArrayObject * neighbours, *neighbour_edges,1724 PyArrayObject *boundary_flux_sum, *neighbours, *neighbour_edges, 1647 1725 *normals, *edgelengths, *radii, *areas, 1648 1726 *tri_full_flag, … … 1670 1748 1671 1749 // Convert Python arguments to C 1672 if (!PyArg_ParseTuple(args, "ddddOOOOOOOOOOOOOOOOOOOO iOOOOO",1750 if (!PyArg_ParseTuple(args, "ddddOOOOOOOOOOOOOOOOOOOOOiOOOOO", 1673 1751 ×tep, 1674 1752 &epsilon, 1675 1753 &H0, 1676 1754 &g, 1755 &boundary_flux_sum, 1677 1756 &neighbours, 1678 1757 &neighbour_edges, … … 1739 1818 H0, 1740 1819 g, 1820 (double*) boundary_flux_sum -> data, 1741 1821 (long*) neighbours -> data, 1742 1822 (long*) neighbour_edges -> data, -
trunk/anuga_work/development/gareth/tests/dam_break/plotme.py
r8751 r8772 9 9 p2_st=util.get_centroids(p_st) 10 10 11 p_dev = util.get_output('dam_break_20130 219_202649/dam_break.sww', 0.001)11 p_dev = util.get_output('dam_break_20130319_235611/dam_break.sww', 0.001) 12 12 p2_dev=util.get_centroids(p_dev, velocity_extrapolation=True) 13 13 -
trunk/anuga_work/development/gareth/tests/runup/runup.py
r8751 r8772 38 38 39 39 def stagefun(x,y): 40 #stg=-0.2*(x<0.5) -0.1*(x>=0.5)41 stg=-0.2 # Stage40 stg=-0.2*(x<0.5) -0.1*(x>=0.5) 41 #stg=-0.2 # Stage 42 42 #topo=topography(x,y) #Bed 43 43 return stg #*(stg>topo) + topo*(stg<=topo) … … 46 46 domain.get_quantity('elevation').smooth_vertex_values() # Steve's fix -- without this, substantial artificial velcities are generated everywhere in the domain. With this fix, there are artificial velocities near the coast, but not elsewhere. 47 47 48 domain.set_quantity('friction',0. 10) # Constant friction48 domain.set_quantity('friction',0.03) # Constant friction 49 49 50 50 domain.set_quantity('stage', stagefun) # Constant negative initial stage -
trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoid.py
r8751 r8772 80 80 for t in domain.evolve(yieldstep=0.200,finaltime=40.00): 81 81 print domain.timestepping_statistics() 82 print domain.boundary_flux_integral 82 83 xx = domain.quantities['xmomentum'].centroid_values 83 84 yy = domain.quantities['ymomentum'].centroid_values … … 89 90 print 'Peak velocity is: ', vv.max(), vv.argmax() 90 91 print 'Volume is', sum(dd_raw*domain.areas) 92 print 'Volume less flux int', sum(dd_raw*domain.areas) - domain.boundary_flux_integral 91 93 92 94 -
trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_sparse.py
r8751 r8772 2 2 Water flowing down a channel 3 3 """ 4 import sys5 4 import numpy 6 5 #--------------- … … 21 20 from anuga import rectangular_cross as rectangular_cross 22 21 from anuga.structures.inlet_operator import Inlet_operator 23 #from anuga.shallow_water.shallow_water_domain import Domain as Domain22 from anuga.shallow_water.shallow_water_domain import Domain as Domain 24 23 from balanced_dev import * 25 24 from balanced_dev import Domain as Domain … … 37 36 #------------------------------------------------------------------------------ 38 37 def topography(x, y): 39 return -x/10. + 1.*(numpy.sin(x/10.) +abs(y-50.)/10.) -0.*(x>80.) # linear bed slope38 return -x/10. #+ 1.*(numpy.sin(x/10.) +abs(y-50.)/10.) -0.*(x>80.) # linear bed slope 40 39 41 40 def stagetopo(x,y): … … 76 75 for t in domain.evolve(yieldstep=4.0, finaltime=400.0): 77 76 print domain.timestepping_statistics() 77 print domain.boundary_flux_integral 78 print (domain.areas*(domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values)).sum() 78 79 #print domain.quantities['stage'].centroid_values[myindex] - domain.quantities['elevation'].centroid_values[myindex] 79 80 s3 = domain.get_flow_through_cross_section([[30., 0.0], [30., 100.]])
Note: See TracChangeset
for help on using the changeset viewer.