Ignore:
Timestamp:
Mar 8, 2012, 5:07:31 PM (13 years ago)
Author:
davies
Message:

balanced_dev major bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain_ext.c

    r8353 r8355  
    470470            }else{
    471471                // Treat nearly dry cells
    472                 bedslope_work =-0.5*g*max(ql[0]-zl,0.)*(ql[0]-zl)*length; //
     472                //bedslope_work =-0.5*g*max(ql[0]-zl,0.)*(ql[0]-zl)*length; //
    473473                //
    474                 //bedslope_work = -pressure_flux*length;
     474                bedslope_work = -pressure_flux*length;
    475475                xmom_explicit_update[k] -= normals[ki2]*bedslope_work;
    476476                ymom_explicit_update[k] -= normals[ki2+1]*bedslope_work;
     
    512512                }else{
    513513                    // Treat nearly dry cells
    514                     bedslope_work = -0.5*g*max(qr[0]-zr,0.)*(qr[0]-zr)*length; //-pressure_flux*length; //-0.5*g*max(qr[0]-zr,0.)*(qr[0]-zr)*length;
    515                     //bedslope_work = -pressure_flux*length;
     514                    //bedslope_work = -0.5*g*max(qr[0]-zr,0.)*(qr[0]-zr)*length; //-pressure_flux*length; //-0.5*g*max(qr[0]-zr,0.)*(qr[0]-zr)*length;
     515                    bedslope_work = -pressure_flux*length;
    516516                    xmom_explicit_update[n] += normals[ki2]*bedslope_work;
    517517                    ymom_explicit_update[n] += normals[ki2+1]*bedslope_work;
     
    782782  double x, y, x0, y0, x1, y1, x2, y2, xv0, yv0, xv1, yv1, xv2, yv2; // Vertices of the auxiliary triangle
    783783  double dx1, dx2, dy1, dy2, dxv0, dxv1, dxv2, dyv0, dyv1, dyv2, dq0, dq1, dq2, area2, inv_area2;
    784   double dqv[3], qmin, qmax, hmin, hmax;
     784  double dqv[3], qmin, qmax, hmin, hmax, bedmax, stagemin;
    785785  double hc, h0, h1, h2, beta_tmp, hfactor;
    786786  double xmom_centroid_store[number_of_elements], ymom_centroid_store[number_of_elements], dk, dv0, dv1, dv2;
     
    867867      k1 = surrogate_neighbours[k3 + 1];
    868868      k2 = surrogate_neighbours[k3 + 2];
    869       // If the mean stage value in neighbouring triangles is less than
    870       // the bed edge value at the common edge, then don't use this triangle
    871       // in the extrapolation.
     869     
     870      // Test to see whether we accept the surrogate neighbours
    872871      // Note that if ki is replaced with k in more than 1 neighbour, then the
    873872      // triangle area will be zero, and a first order extrapolation will be
    874873      // used
    875       if(0.5*(stage_centroid_values[k2]+stage_centroid_values[k])<=elevation_edge_values[k2]+minimum_allowed_height){
    876           k2 = k ;
    877       }
    878       if(0.5*(stage_centroid_values[k0]+stage_centroid_values[k])<=elevation_edge_values[k0]+minimum_allowed_height){
    879           k0 = k ;
    880       }
    881       if(0.5*(stage_centroid_values[k1]+stage_centroid_values[k])<=elevation_edge_values[k1]+minimum_allowed_height){
    882           k1 = k ;
    883       }
     874      //if(stage_centroid_values[k2]<=elevation_centroid_values[k2]){
     875      //    k2 = k ;
     876      //}
     877      //if(stage_centroid_values[k0]<=elevation_centroid_values[k0]){
     878      //    k0 = k ;
     879      //}
     880      //if(stage_centroid_values[k1]<=elevation_centroid_values[k1]){
     881      //    k1 = k ;
     882      //}
     883      // Alternative approach (BRUTAL) -- if the max neighbour bed elevation is greater
     884      // than the min neighbour stage, then we use first order extrapolation
     885      bedmax = max(elevation_centroid_values[k],
     886                   max(elevation_centroid_values[k0],
     887                       max(elevation_centroid_values[k1], elevation_centroid_values[k2])));
     888      stagemin =min(stage_centroid_values[k],
     889                   min(stage_centroid_values[k0],
     890                       min(stage_centroid_values[k1], stage_centroid_values[k2])));
     891 
     892      if(stagemin < bedmax){
     893         // This will cause first order extrapolation
     894         k2 = k;
     895         k0 = k;
     896         k1 = k;
     897      }
     898     
    884899      // Get the auxiliary triangle's vertex coordinates
    885900      // (really the centroids of neighbouring triangles)
     
    916931          //return -1;
    917932
    918           stage_edge_values[k3]   = 0.5*(stage_centroid_values[k]+stage_centroid_values[k0]);
    919           stage_edge_values[k3+1] = 0.5*(stage_centroid_values[k]+stage_centroid_values[k1]);
    920           stage_edge_values[k3+2] = 0.5*(stage_centroid_values[k]+stage_centroid_values[k2]);
     933          //stage_edge_values[k3]   = 0.5*(stage_centroid_values[k]+stage_centroid_values[k0]);
     934          //stage_edge_values[k3+1] = 0.5*(stage_centroid_values[k]+stage_centroid_values[k1]);
     935          //stage_edge_values[k3+2] = 0.5*(stage_centroid_values[k]+stage_centroid_values[k2]);
     936          stage_edge_values[k3]   = stage_centroid_values[k];
     937          stage_edge_values[k3+1] = stage_centroid_values[k];
     938          stage_edge_values[k3+2] = stage_centroid_values[k];
    921939          xmom_edge_values[k3]    = xmom_centroid_values[k];
    922940          xmom_edge_values[k3+1]  = xmom_centroid_values[k];
Note: See TracChangeset for help on using the changeset viewer.