Changeset 8772


Ignore:
Timestamp:
Mar 20, 2013, 12:01:46 AM (12 years ago)
Author:
davies
Message:

Updates to gd experimental

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  
    22from anuga.shallow_water.shallow_water_domain import *
    33from anuga.shallow_water.shallow_water_domain import Domain as Sww_domain
    4 
     4import numpy
    55
    66##############################################################################
     
    7777        # all the betas. 
    7878        self.beta_w=1.0
    79         self.beta_w_dry=1.0
     79        self.beta_w_dry=0.0
    8080        self.beta_uh=1.0
    81         self.beta_uh_dry=1.0
     81        self.beta_uh_dry=0.0
    8282        self.beta_vh=1.0
    83         self.beta_vh_dry=1.0
     83        self.beta_vh_dry=0.0
    8484
    8585        #self.optimise_dry_cells=True
     
    104104        #self.forcing_terms.append(manning_friction_explicit)
    105105        #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.
    106112
    107113        print '##########################################################################'
     
    256262                                           domain.H0,
    257263                                           domain.g,
     264                                           domain.boundary_flux_sum,
    258265                                           domain.neighbours,
    259266                                           domain.neighbour_edges,
     
    285292        #import pdb
    286293        #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.
    287300
    288301        domain.flux_timestep = flux_timestep
     302
    289303
    290304
  • trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain_ext.c

    r8751 r8772  
    139139  // Compute speeds in x-direction
    140140  w_left = q_left_rotated[0];         
    141   h_left = w_left - z;
     141  h_left = max(w_left - z,0.);
    142142  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  //}
    143148  u_left = _compute_speed(&uh_left, &h_left,
    144                           epsilon, h0, limiting_threshold);
     149                          epsilon, h0, limiting_threshold);
    145150
    146151  w_right = q_right_rotated[0];
    147   h_right = w_right - z;
     152  h_right = max(w_right - z, 0.);
    148153  uh_right = q_right_rotated[1];
    149154  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  //}
    151161
    152162  // Momentum in y-direction
     
    157167  // Leaving this out, improves speed significantly (Ole 27/5/2009)
    158168  // 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);
    163173
    164174  // Maximal and minimal wave speeds
     
    219229    {
    220230      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]);
    222232      edgeflux[i] *= inverse_denominator;
    223233    }
     
    242252        double H0,
    243253        double g,
     254        double* boundary_flux_sum,
    244255        long* neighbours,
    245256        long* neighbour_edges,
     
    272283    double h0 = H0*H0; // This ensures a good balance when h approaches H0.
    273284
    274     double limiting_threshold = 10 * H0; // Avoid applying limiter below this
     285    double limiting_threshold = H0; //10 * H0; // Avoid applying limiter below this
    275286    // threshold for performance reasons.
    276287    // See ANUGA manual under flux limiting
    277     int k, i, m, n,j;
     288    int k, i, m, n,j, ii;
    278289    int ki, nm = 0, ki2,ki3, nm3; // Index shorthands
    279290
     
    281292    double ql[3], qr[3], edgeflux[3]; // Work array for summing up fluxes
    282293    double stage_edges[3];//Work array
    283     double bedslope_work;
     294    double bedslope_work, local_timestep;
    284295    int neighbours_wet[3];//Work array
    285296    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;
    287298    static long call = 1; // Static local variable flagging already computed flux
    288299
     
    300311    memset((char*) xmom_explicit_update, 0, number_of_elements * sizeof (double));
    301312    memset((char*) ymom_explicit_update, 0, number_of_elements * sizeof (double));
     313
    302314
    303315    // Compute minimum bed edge value on each triangle
     
    424436            // every 2nd call.  This works for rk2 timestepping only, and is
    425437            // 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
    427442                if (max_speed > epsilon) {
    428443                    // Apply CFL condition for triangles joining this edge (triangle k and triangle n)
     
    449464    // Limit edgefluxes, for mass conservation near wet/dry cells
    450465    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 cells
    453         if(stage_centroid_values[k] <= max_bed_edgevalue[k] + H0){
    454466            hc = max(stage_centroid_values[k] - bed_centroid_values[k],0.);
    455467            // Loop over every edge
     
    457469                if(i==0){
    458470                    // Add up the outgoing flux through the cell
    459                     outgoing_flux_edges=0.0;
     471                    outgoing_mass_edges=0.0;
    460472                    for(useint=0; useint<3; useint++){
    461473                        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);
    464476                        }
    465477                    }
     
    473485                // Idea: The cell will not go dry if:
    474486                // 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.)){
    476488                   
    477489                    // This bound could be improved (e.g. we could actually sum
     
    480492                    // about subsequent changes to the + edgeflux caused by
    481493                    // 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) ;
    483495                    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;
    494499
    495500                        // Compute neighbour edge index
     
    498503                            nm = 3*n + neighbour_edges[ki];
    499504                            nm3 = nm*3;
    500                             edgeflux_store[nm3+0]*=tmp2;
    501                             edgeflux_store[nm3+1]*=tmp2;
    502                             edgeflux_store[nm3+2]*=tmp2;
     505                            edgeflux_store[nm3+0]*=tmp;
     506                            edgeflux_store[nm3+1]*=tmp;
     507                            edgeflux_store[nm3+2]*=tmp;
    503508                        }
    504509                    }
    505510                }
    506             }
    507511        }
    508512     }
    509 
    510513
    511514    // Now add up stage, xmom, ymom explicit updates
     
    520523            ki2=ki*2;
    521524            ki3 = ki*3;
     525            n=neighbours[ki];
    522526
    523527            // GD HACK
     
    533537
    534538
     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
    535545            // GD HACK
    536546            // Compute bed slope term
     
    552562        ymom_explicit_update[k] *= inv_area;
    553563    }  // end cell k
     564
     565    //if(call%2==0) timestep=local_timestep;
    554566
    555567    // Look for 'dry' edges, and set momentum (& component of momentum_update)
     
    790802  double dqv[3], qmin, qmax, hmin, hmax, bedmax, stagemin;
    791803  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;
    793805 
    794806  double *xmom_centroid_store, *ymom_centroid_store, *stage_centroid_store, *min_elevation_edgevalue, *max_elevation_edgevalue;
     
    835847      cell_wetness_scale[k] = 0.;
    836848      // 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){
    838851      //if(stage_centroid_values[k] > max_elevation_edgevalue[k] + minimum_allowed_height+epsilon){
    839852          cell_wetness_scale[k] = 1.; 
     
    918931          dyv1 = yv1 - y;
    919932          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);
    920947        }
    921948
     
    9951022          area2 = dy2*dx1 - dy1*dx2;
    9961023           
    997           // Treat triangles with zero or 1 wet neighbours (area2 <=0.)
     1024          //// Treat triangles with zero or 1 wet neighbours (area2 <=0.)
    9981025          if ((area2 <= 0.))// || (cell_wetness_scale[k]==0.)) //|(count_wet_neighbours[k]==0))
    9991026          {
    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
    10021058                stage_edge_values[k3]   = stage_centroid_values[k];
    10031059                stage_edge_values[k3+1] = stage_centroid_values[k];
    10041060                stage_edge_values[k3+2] = stage_centroid_values[k];
     1061              }
    10051062            //}else{
    10061063            //}else{
     
    11161173         
    11171174          // 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);
    11231180          //// GD FIXME: No longer needed?
    11241181          //hfactor = 0.0;
     
    11301187            //hfactor=hmin/(hmin + 0.004);
    11311188          //}
     1189          hfactor= min(2.0*max(hmin,0)/max(hc,1.0e-06), 1.0);
    11321190         
    11331191          //-----------------------------------
     
    11431201          dq1 = stage_centroid_values[k1] - stage_centroid_values[k0];
    11441202          dq2 = stage_centroid_values[k2] - stage_centroid_values[k0];
    1145          
     1203         
     1204          //if( (area2>0.0) ){
     1205
    11461206          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          //}
    11591233          // Calculate provisional jumps in stage from the centroid
    11601234          // of triangle k to its vertices, to be limited
     
    11751249          //if((count_wet_neighbours[k]>0)&&(cell_wetness_scale[k]=1.0)){//&&(k_wetdry==0)){
    11761250          //if(stage_centroid_values[k] > max_elevation_edgevalue[k]){
     1251          //if( (area2>0) ){
     1252          //if(count_wet_neighbours[k]>0){
    11771253              limit_gradient(dqv, qmin, qmax, beta_tmp);
     1254          //}
     1255          //}
    11781256              stage_edge_values[k3+0] = stage_centroid_values[k] + dqv[0];
    11791257              stage_edge_values[k3+1] = stage_centroid_values[k] + dqv[1];
     
    11941272          //}
    11951273          //}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)
    11971275          //    hc=max(stage_centroid_values[k] - elevation_centroid_values[k],0.0);
    11981276          //    tmp = sqrt(xmom_centroid_values[k]*xmom_centroid_values[k] +
     
    12651343          //if((k!=k0)&(k!=k1)&(k!=k2))
    12661344          //if(stagemin>=bedmax){
    1267           if((count_wet_neighbours[k]>0)){ // &&
     1345          //if((count_wet_neighbours[k]>0)){ // &&
    12681346            // (cell_wetness_scale[k]==1.0)){
    12691347          //if(stage_centroid_values[k]>(minimum_allowed_height+max_elevation_edgevalue[k])){
    12701348            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          //}
    12771355          //limit_gradient2(dqv, qmin, qmax, beta_tmp,r0scale);
    12781356         
     
    13181396          // Limit the gradient
    13191397          //if(stagemin>=bedmax){
    1320           if((count_wet_neighbours[k]>0)){//&&
     1398          //if((count_wet_neighbours[k]>0)){//&&
    13211399             //(cell_wetness_scale[k]==1.0)){
    13221400            //(stage_centroid_values[k]>(minimum_allowed_height+elevation_centroid_values[k]))){
    13231401          //if(stage_centroid_values[k]>(minimum_allowed_height+max_elevation_edgevalue[k])){
    13241402            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          //}
    13301408         
    13311409          for (i=0;i<3;i++)
     
    16441722
    16451723
    1646   PyArrayObject *neighbours, *neighbour_edges,
     1724  PyArrayObject *boundary_flux_sum, *neighbours, *neighbour_edges,
    16471725    *normals, *edgelengths, *radii, *areas,
    16481726    *tri_full_flag,
     
    16701748   
    16711749  // Convert Python arguments to C
    1672   if (!PyArg_ParseTuple(args, "ddddOOOOOOOOOOOOOOOOOOOOiOOOOO",
     1750  if (!PyArg_ParseTuple(args, "ddddOOOOOOOOOOOOOOOOOOOOOiOOOOO",
    16731751            &timestep,
    16741752            &epsilon,
    16751753            &H0,
    16761754            &g,
     1755            &boundary_flux_sum,
    16771756            &neighbours,
    16781757            &neighbour_edges,
     
    17391818                     H0,
    17401819                     g,
     1820                     (double*) boundary_flux_sum -> data,
    17411821                     (long*) neighbours -> data,
    17421822                     (long*) neighbour_edges -> data,
  • trunk/anuga_work/development/gareth/tests/dam_break/plotme.py

    r8751 r8772  
    99p2_st=util.get_centroids(p_st)
    1010
    11 p_dev = util.get_output('dam_break_20130219_202649/dam_break.sww', 0.001)
     11p_dev = util.get_output('dam_break_20130319_235611/dam_break.sww', 0.001)
    1212p2_dev=util.get_centroids(p_dev, velocity_extrapolation=True)
    1313
  • trunk/anuga_work/development/gareth/tests/runup/runup.py

    r8751 r8772  
    3838
    3939def stagefun(x,y):
    40     #stg=-0.2*(x<0.5) -0.1*(x>=0.5)
    41     stg=-0.2 # Stage
     40    stg=-0.2*(x<0.5) -0.1*(x>=0.5)
     41    #stg=-0.2 # Stage
    4242    #topo=topography(x,y) #Bed
    4343    return stg #*(stg>topo) + topo*(stg<=topo)
     
    4646domain.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.
    4747
    48 domain.set_quantity('friction',0.10)             # Constant friction
     48domain.set_quantity('friction',0.03)             # Constant friction
    4949
    5050domain.set_quantity('stage', stagefun)              # Constant negative initial stage
  • trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoid.py

    r8751 r8772  
    8080for t in domain.evolve(yieldstep=0.200,finaltime=40.00):
    8181    print domain.timestepping_statistics()
     82    print domain.boundary_flux_integral
    8283    xx = domain.quantities['xmomentum'].centroid_values
    8384    yy = domain.quantities['ymomentum'].centroid_values
     
    8990    print 'Peak velocity is: ', vv.max(), vv.argmax()
    9091    print 'Volume is', sum(dd_raw*domain.areas)   
     92    print 'Volume less flux int', sum(dd_raw*domain.areas) - domain.boundary_flux_integral
    9193
    9294
  • trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_sparse.py

    r8751 r8772  
    22Water flowing down a channel
    33"""
    4 import sys
    54import numpy
    65#---------------
     
    2120from anuga import rectangular_cross as rectangular_cross
    2221from anuga.structures.inlet_operator import Inlet_operator
    23 #from anuga.shallow_water.shallow_water_domain import Domain as Domain
     22from anuga.shallow_water.shallow_water_domain import Domain as Domain
    2423from balanced_dev import *
    2524from balanced_dev import Domain as Domain
     
    3736#------------------------------------------------------------------------------
    3837def topography(x, y):
    39         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
    4039
    4140def stagetopo(x,y):
     
    7675for t in domain.evolve(yieldstep=4.0, finaltime=400.0):
    7776    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()
    7879    #print domain.quantities['stage'].centroid_values[myindex] - domain.quantities['elevation'].centroid_values[myindex]
    7980    s3 = domain.get_flow_through_cross_section([[30., 0.0], [30., 100.]])
Note: See TracChangeset for help on using the changeset viewer.