Changeset 9014
- Timestamp:
- Nov 3, 2013, 6:33:53 PM (11 years ago)
- Location:
- trunk/anuga_work/development/gareth
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/experimental/bal_and/swb2_domain.py
r9010 r9014 76 76 77 77 self.beta_w=1.0 78 self.beta_w_dry= 1.078 self.beta_w_dry=0.0 79 79 self.beta_uh=1.0 80 80 self.beta_uh_dry=0.0 -
trunk/anuga_work/development/gareth/experimental/bal_and/swb2_domain_ext.c
r9012 r9014 68 68 if (*h < epsilon) { 69 69 //*h = max(0.0,*h); // Could have been negative 70 //*h = 0.0; // Could have been negative71 70 u = 0.0; 72 71 } else { … … 146 145 147 146 148 //z=max(zl,zr);149 //z = 0.5*(z_left + z_right); // Average elevation values.150 // Even though this will nominally allow151 // for discontinuities in the elevation data,152 // there is currently no numerical support for153 // this so results may be strange near154 // jumps in the bed.155 156 147 // Compute speeds in x-direction 157 148 w_left = q_left_rotated[0]; 158 149 uh_left=q_left_rotated[1]; 159 150 vh_left=q_left_rotated[2]; 160 if(h _left>1.0e-03){151 if(hle>1.0e-03){ 161 152 u_left = uh_left/(hle+0.0e-03) ; //max(h_left, 1.0e-06); 162 153 uh_left=h_left*u_left; … … 167 158 vh_left=0.; 168 159 } 169 // NOTE: using hle instead of h_left here seems to help prevent velocity spikes160 170 161 //u_left = _compute_speed(&uh_left, &hle, 171 162 // epsilon, h0, limiting_threshold); … … 174 165 uh_right = q_right_rotated[1]; 175 166 vh_right = q_right_rotated[2]; 176 if(h _right>1.0e-03){167 if(hre>1.0e-03){ 177 168 u_right = uh_right/(hre+0.0e-03);//max(h_right, 1.0e-06); 178 169 uh_right=h_right*u_right; … … 180 171 }else{ 181 172 u_right=0.; 182 uh_right=0.; //h_right*u_right;173 uh_right=0.; 183 174 vh_right=0.; 184 175 } 185 // NOTE: using hre instead of h_right here seems to help prevent velocity spikes186 176 //u_right = _compute_speed(&uh_right, &hre, 187 177 // epsilon, h0, limiting_threshold); 188 178 189 179 190 191 // Limit y-momentum if necessary192 // Leaving this out, improves speed significantly (Ole 27/5/2009)193 // All validation tests pass, so do we really need it anymore?194 //_compute_speed(&vh_left, &h_left,195 // epsilon, h0, limiting_threshold);196 //_compute_speed(&vh_right, &h_right,197 // epsilon, h0, limiting_threshold);198 199 180 // Maximal and minimal wave speeds 200 181 soundspeed_left = sqrt(g*h_left); … … 441 422 // Audusse magic 442 423 z_half=max(zl,zr); 424 443 425 h_left= max(hle+zl-z_half,0.); 444 426 h_right= max(hre+zr-z_half,0.); 427 445 428 //if (fabs(zl-zr)>1.0e-10) { 446 429 // report_python_error(AT,"Discontinuous Elevation"); … … 467 450 // Don't allow an outward advective flux if the cell centroid stage 468 451 // is < the edge value 469 if(((stage_centroid_values[k] < z_half)| hle<H0) && edgeflux[0] > 0.){470 edgeflux[0] = 0.;471 edgeflux[1] = 0.;472 edgeflux[2] = 0.;473 //max_speed=0.;474 //pressure_flux=0.;475 }476 // 477 if(((stage_centroid_values[n] < z_half)| hre<H0) && edgeflux[0] < 0.){478 edgeflux[0] = 0.;479 edgeflux[1] = 0.;480 edgeflux[2] = 0.;481 //max_speed=0.;482 //pressure_flux=0.;483 }452 //if(((stage_centroid_values[k] < z_half)| hle<H0) && edgeflux[0] > 0.){ 453 // edgeflux[0] = 0.; 454 // edgeflux[1] = 0.; 455 // edgeflux[2] = 0.; 456 // //max_speed=0.; 457 // //pressure_flux=0.; 458 //} 459 //// 460 //if(((stage_centroid_values[n] < z_half)| hre<H0) && edgeflux[0] < 0.){ 461 // edgeflux[0] = 0.; 462 // edgeflux[1] = 0.; 463 // edgeflux[2] = 0.; 464 // //max_speed=0.; 465 // //pressure_flux=0.; 466 //} 484 467 485 468 … … 641 624 // GD HACK 642 625 // Compute bed slope term 643 //if(hc > -h0){626 //if(hc > H0*0.5){ 644 627 xmom_explicit_update[k] -= normals[ki2]*pressuregrad_store[ki]; 645 628 ymom_explicit_update[k] -= normals[ki2+1]*pressuregrad_store[ki]; … … 932 915 // Check if cell k is wet 933 916 //if(stage_centroid_values[k] > elevation_centroid_values[k]){ 934 if(stage_centroid_values[k] > elevation_centroid_values[k] + 1. *minimum_allowed_height+epsilon){917 if(stage_centroid_values[k] > elevation_centroid_values[k] + 1.0*minimum_allowed_height){ 935 918 //if(stage_centroid_values[k] > max_elevation_edgevalue[k] + minimum_allowed_height+epsilon){ 936 919 cell_wetness_scale[k] = 1.; … … 1124 1107 //if(stage_centroid_values[k2]<=elevation_centroid_values[k2]+minimum_allowed_height+epsilon){ 1125 1108 // FIXME: Remove cell_wetness_scale if you don't need it 1126 if(k2<0 || (cell_wetness_scale[k2]== 0.0 && stage_centroid_values[k]<max_elevation_edgevalue[k])){1109 if(k2<0 || (cell_wetness_scale[k2]==-10.0 && stage_centroid_values[k]<max_elevation_edgevalue[k])){ 1127 1110 k2 = k ; 1128 1111 } 1129 1112 //if(stage_centroid_values[k0]<=max_elevation_edgevalue[k0]+epsilon){ 1130 1113 //if(stage_centroid_values[k0]<=elevation_centroid_values[k0]+minimum_allowed_height+epsilon){ 1131 if(k0 < 0 || (cell_wetness_scale[k0]== 0.0 && stage_centroid_values[k]<max_elevation_edgevalue[k])){1114 if(k0 < 0 || (cell_wetness_scale[k0]==-10.0 && stage_centroid_values[k]<max_elevation_edgevalue[k])){ 1132 1115 k0 = k ; 1133 1116 } 1134 1117 //if(stage_centroid_values[k1]<=max_elevation_edgevalue[k1]+epsilon){ 1135 1118 //if(stage_centroid_values[k1]<=elevation_centroid_values[k1]+minimum_allowed_height+epsilon){ 1136 if(k1 < 0 || (cell_wetness_scale[k1]==0.0 && stage_centroid_values[k]<max_elevation_edgevalue[k])){ 1119 //if(k1 < 0 || (cell_wetness_scale[k1]==0.0 && stage_centroid_values[k]<elevation_edge_values[3*k+1])){ 1120 if(k1 < 0 || (cell_wetness_scale[k1]==-10.0 && stage_centroid_values[k]<max_elevation_edgevalue[k])){ 1137 1121 k1 = k ; 1138 1122 } … … 1179 1163 1180 1164 //// Treat triangles with zero or 1 wet neighbours (area2 <=0.) 1181 if ((area2 <= 0.) )// 1165 if ((area2 <= 0.) )//|| (cell_wetness_scale[k]==0.)) //|(count_wet_neighbours[k]==0)) 1182 1166 { 1183 1167 … … 1214 1198 h1 = stage_centroid_values[k1] - elevation_centroid_values[k1]; 1215 1199 h2 = stage_centroid_values[k2] - elevation_centroid_values[k2]; 1200 //h0=0.; 1201 //h1=0.; 1202 //h2=0.; 1203 1204 //if(k!=k0) h0 = stage_centroid_values[k0] - elevation_centroid_values[k0]; 1205 //if(k!=k1) h1 = stage_centroid_values[k1] - elevation_centroid_values[k1]; 1206 //if(k!=k2) h2 = stage_centroid_values[k2] - elevation_centroid_values[k2]; 1207 1216 1208 hmin = min(min(h0, min(h1, h2)), hc); 1217 1209 hmax = max(max(h0, max(h1, h2)), hc); … … 1230 1222 hfactor= min(2.0*max(hmin,0.0)/max(hc,minimum_allowed_height), 1231 1223 min(2.0*max(hc,0.)/max(hmax,minimum_allowed_height), 1.0)); 1224 //hfactor= min(2.0*max(hc,0.)/max(hmax,minimum_allowed_height), 1.0); 1225 //hfactor=0.; 1226 //if(hmin==hc) hfactor=0.; 1227 //hfactor= min(2.0*max(hmin,0.0)/max(hc,minimum_allowed_height+bedmax-bedmin), 1228 // min(2.0*max(hc,0.)/max(hmax,minimum_allowed_height+bedmax-bedmin), 1.0)); 1232 1229 1233 1230 //hfactor=1.0; 1234 //hfactor=m ax(hmin,0.)/(max(hmin,0.)+10.*minimum_allowed_height);1231 //hfactor=min( max(hmin,0.)/(max(hmin,0.)+10.*minimum_allowed_height), 1.0); 1235 1232 //if(hc<minimum_allowed_height*10.) hfactor=0.; 1236 1233 //if(cell_wetness_scale[k0]==0 | cell_wetness_scale[k1]==0 | cell_wetness_scale[k2]==0) hfactor=0; -
trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoid.py
r8992 r9014 45 45 bumpiness=50. # Higher = shorter wavelength oscillations in topography 46 46 tstep=0.2 47 lasttime= 90.47 lasttime=150. 48 48 49 49 #domain.minimum_allowed_height=domain.minimum_allowed_height*scale_me # Seems needed to make the algorithms behave -
trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_2plot.py
r8547 r9014 9 9 import scipy 10 10 from matplotlib import pyplot as pyplot 11 from anuga.utilities import plot_utils as util 11 #from anuga.utilities import plot_utils as util 12 from bal_and import plot_utils as util 12 13 #-------------- 13 14 # Get variables … … 29 30 mann=0.03 # Manning's coef 30 31 bedslope=-0.1 31 fluxin= 20./100. #The momentum flux at the upstream boundary ( = discharge / width)32 fluxin=0.5/100. #The momentum flux at the upstream boundary ( = discharge / width) 32 33 33 34 #--------------------------------------------- … … 46 47 pyplot.ion() 47 48 48 line, = pyplot.plot( (p2.x[v].min(),p2.x[v].max()) ,( (p2.stage[:,v]-p2.elev[ :,v]).max(),(p2.stage[:,v]-p2.elev[v]).min() ) )49 line, = pyplot.plot( (p2.x[v].min(),p2.x[v].max()) ,( (p2.stage[:,v]-p2.elev[1,v]).max(),(p2.stage[:,v]-p2.elev[1,v]).min() ) ) 49 50 line.set_label('Numerical') 50 51 pyplot.plot( (0,100),(dana,dana), 'r',label='Analytical' ) 52 pyplot.yscale('log') 51 53 pyplot.legend() 52 54 #pyplot.plot(x[v],elev[v],'green') 53 55 for i in range(p2.xmom.shape[0]): 54 56 line.set_xdata(p2.x[v]) 55 line.set_ydata(p2.stage[i,v]-p2.elev[ v])57 line.set_ydata(p2.stage[i,v]-p2.elev[1,v]) 56 58 pyplot.draw() 57 59 pyplot.title('Flow depth: should be converging to steady uniform flow ' ) … … 97 99 pyplot.plot(p2.y[v],p2.xvel[100,v], 'o', label='Numerical') 98 100 pyplot.plot((0,100),(uana,uana),label='Analytical') 99 pyplot.ylim([1.0,3.0])101 #pyplot.ylim([1.0,3.0]) 100 102 pyplot.xlabel('Distance along the line x==50 (across the slope) (m)') 101 103 pyplot.ylabel('Velocity m/s') -
trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_sparse.py
r9012 r9014 36 36 #------------------------------------------------------------------------------ 37 37 def topography(x, y): 38 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 39 39 40 40 def stagetopo(x,y): … … 54 54 # Setup boundary conditions 55 55 #------------------------------------------------------------------------------ 56 #Bi = anuga.Dirichlet_boundary([0.06309625, 0.00, 0.00]) # Inflow for steady uniform flow with a depth integrated velocity of 0.156 #Bi = anuga.Dirichlet_boundary([0.06309625, Qin/100., 0.00]) # Inflow for steady uniform flow with a depth integrated velocity of 0.1 57 57 58 58 Br = anuga.Reflective_boundary(domain) # Solid reflective wall
Note: See TracChangeset
for help on using the changeset viewer.