Changeset 9014


Ignore:
Timestamp:
Nov 3, 2013, 6:33:53 PM (11 years ago)
Author:
davies
Message:

Updates to improve well balancing at wet-dry edge

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  
    7676
    7777        self.beta_w=1.0
    78         self.beta_w_dry=1.0
     78        self.beta_w_dry=0.0
    7979        self.beta_uh=1.0
    8080        self.beta_uh_dry=0.0
  • trunk/anuga_work/development/gareth/experimental/bal_and/swb2_domain_ext.c

    r9012 r9014  
    6868    if (*h < epsilon) {
    6969      //*h = max(0.0,*h);  // Could have been negative
    70       //*h = 0.0;  // Could have been negative
    7170      u = 0.0;
    7271    } else {
     
    146145
    147146
    148   //z=max(zl,zr);
    149   //z = 0.5*(z_left + z_right); // Average elevation values.
    150                               // Even though this will nominally allow
    151                               // for discontinuities in the elevation data,
    152                               // there is currently no numerical support for
    153                               // this so results may be strange near
    154                               // jumps in the bed.
    155 
    156147  // Compute speeds in x-direction
    157148  w_left = q_left_rotated[0];         
    158149  uh_left=q_left_rotated[1];
    159150  vh_left=q_left_rotated[2];
    160   if(h_left>1.0e-03){
     151  if(hle>1.0e-03){
    161152    u_left = uh_left/(hle+0.0e-03) ; //max(h_left, 1.0e-06);
    162153    uh_left=h_left*u_left;
     
    167158    vh_left=0.;
    168159  }
    169   // NOTE: using hle instead of h_left here seems to help prevent velocity spikes
     160 
    170161  //u_left = _compute_speed(&uh_left, &hle,
    171162  //            epsilon, h0, limiting_threshold);
     
    174165  uh_right = q_right_rotated[1];
    175166  vh_right = q_right_rotated[2];
    176   if(h_right>1.0e-03){
     167  if(hre>1.0e-03){
    177168    u_right = uh_right/(hre+0.0e-03);//max(h_right, 1.0e-06);
    178169    uh_right=h_right*u_right;
     
    180171  }else{
    181172    u_right=0.;
    182     uh_right=0.;//h_right*u_right;
     173    uh_right=0.;
    183174    vh_right=0.;
    184175  }
    185   // NOTE: using hre instead of h_right here seems to help prevent velocity spikes
    186176  //u_right = _compute_speed(&uh_right, &hre,
    187177  //              epsilon, h0, limiting_threshold);
    188178
    189179 
    190 
    191   // Limit y-momentum if necessary
    192   // 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 
    199180  // Maximal and minimal wave speeds
    200181  soundspeed_left  = sqrt(g*h_left);
     
    441422            // Audusse magic
    442423            z_half=max(zl,zr);
     424
    443425            h_left= max(hle+zl-z_half,0.);
    444426            h_right= max(hre+zr-z_half,0.);
     427
    445428            //if (fabs(zl-zr)>1.0e-10) {
    446429            //    report_python_error(AT,"Discontinuous Elevation");
     
    467450            // Don't allow an outward advective flux if the cell centroid stage
    468451            // 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            //}
    484467
    485468
     
    641624            // GD HACK
    642625            // Compute bed slope term
    643             //if(hc > -h0){
     626            //if(hc > H0*0.5){
    644627                xmom_explicit_update[k] -= normals[ki2]*pressuregrad_store[ki];
    645628                ymom_explicit_update[k] -= normals[ki2+1]*pressuregrad_store[ki];
     
    932915      // Check if cell k is wet
    933916      //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){
    935918      //if(stage_centroid_values[k] > max_elevation_edgevalue[k] + minimum_allowed_height+epsilon){
    936919          cell_wetness_scale[k] = 1.; 
     
    11241107          //if(stage_centroid_values[k2]<=elevation_centroid_values[k2]+minimum_allowed_height+epsilon){
    11251108          // 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])){
    11271110              k2 = k ;
    11281111          }
    11291112          //if(stage_centroid_values[k0]<=max_elevation_edgevalue[k0]+epsilon){
    11301113          //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])){
    11321115              k0 = k ;
    11331116          }
    11341117          //if(stage_centroid_values[k1]<=max_elevation_edgevalue[k1]+epsilon){
    11351118          //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])){
    11371121              k1 = k ;
    11381122          }
     
    11791163           
    11801164          //// Treat triangles with zero or 1 wet neighbours (area2 <=0.)
    1181           if ((area2 <= 0.) )// || (cell_wetness_scale[k]==0.)) //|(count_wet_neighbours[k]==0))
     1165          if ((area2 <= 0.) )//|| (cell_wetness_scale[k]==0.)) //|(count_wet_neighbours[k]==0))
    11821166          {
    11831167
     
    12141198          h1 = stage_centroid_values[k1] - elevation_centroid_values[k1];
    12151199          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         
    12161208          hmin = min(min(h0, min(h1, h2)), hc);
    12171209          hmax = max(max(h0, max(h1, h2)), hc);
     
    12301222          hfactor= min(2.0*max(hmin,0.0)/max(hc,minimum_allowed_height),
    12311223                       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));
    12321229
    12331230          //hfactor=1.0;
    1234           //hfactor=max(hmin,0.)/(max(hmin,0.)+10.*minimum_allowed_height);
     1231          //hfactor=min( max(hmin,0.)/(max(hmin,0.)+10.*minimum_allowed_height), 1.0);
    12351232          //if(hc<minimum_allowed_height*10.) hfactor=0.;
    12361233          //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  
    4545bumpiness=50. # Higher = shorter wavelength oscillations in topography
    4646tstep=0.2
    47 lasttime=90.
     47lasttime=150.
    4848
    4949#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  
    99import scipy
    1010from matplotlib import pyplot as pyplot
    11 from anuga.utilities import plot_utils as util
     11#from anuga.utilities import plot_utils as util
     12from bal_and import plot_utils as util
    1213#--------------
    1314# Get variables
     
    2930mann=0.03 # Manning's coef
    3031bedslope=-0.1
    31 fluxin=20./100. #The momentum flux at the upstream boundary ( = discharge / width)
     32fluxin=0.5/100. #The momentum flux at the upstream boundary ( = discharge / width)
    3233
    3334#---------------------------------------------
     
    4647pyplot.ion()
    4748
    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() ) )
     49line, = 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() ) )
    4950line.set_label('Numerical')
    5051pyplot.plot( (0,100),(dana,dana), 'r',label='Analytical' )
     52pyplot.yscale('log')
    5153pyplot.legend()
    5254#pyplot.plot(x[v],elev[v],'green')
    5355for i in range(p2.xmom.shape[0]):
    5456    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])
    5658    pyplot.draw()
    5759    pyplot.title('Flow depth: should be converging to steady uniform flow ' )
     
    9799pyplot.plot(p2.y[v],p2.xvel[100,v], 'o', label='Numerical')
    98100pyplot.plot((0,100),(uana,uana),label='Analytical')
    99 pyplot.ylim([1.0,3.0])
     101#pyplot.ylim([1.0,3.0])
    100102pyplot.xlabel('Distance along the line x==50 (across the slope) (m)')
    101103pyplot.ylabel('Velocity m/s')
  • trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_sparse.py

    r9012 r9014  
    3636#------------------------------------------------------------------------------
    3737def topography(x, y):
    38         return -x/10. + 1.*(numpy.sin(x/10.) +abs(y-50.)/10.) -0.*(x>80.) # linear bed slope
     38        return -x/10. # + 1.*(numpy.sin(x/10.) +abs(y-50.)/10.) -0.*(x>80.) # linear bed slope
    3939
    4040def stagetopo(x,y):
     
    5454# Setup boundary conditions
    5555#------------------------------------------------------------------------------
    56 #Bi = anuga.Dirichlet_boundary([0.06309625, 0.00, 0.00]) # Inflow for steady uniform flow with a depth integrated velocity of 0.1
     56#Bi = anuga.Dirichlet_boundary([0.06309625, Qin/100., 0.00]) # Inflow for steady uniform flow with a depth integrated velocity of 0.1
    5757
    5858Br = anuga.Reflective_boundary(domain) # Solid reflective wall
Note: See TracChangeset for help on using the changeset viewer.