Changeset 5175


Ignore:
Timestamp:
Mar 19, 2008, 8:02:05 PM (17 years ago)
Author:
steve
Message:

Ole and I seem to have got edge limiteri working.
Set domain.use_edge_limiter = True
to test the method

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/config.py

    r5162 r5175  
    176176optimise_dry_cells = True # Exclude dry and still cells from flux computation
    177177optimised_gradient_limiter = True # Use hardwired gradient limiter
     178use_edge_limiter = False # The edge limiter is better, but most runs have been using vertex limiting
    178179
    179180points_file_block_line_size = 500 # Number of lines read in from a points file
  • anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r5162 r5175  
    104104from anuga.config import optimise_dry_cells
    105105from anuga.config import optimised_gradient_limiter
     106from anuga.config import use_edge_limiter
    106107
    107108#---------------------
     
    179180
    180181        # Limiters
    181         self.use_old_limiter = True
     182        self.use_edge_limiter = use_edge_limiter
    182183
    183184        self.optimised_gradient_limiter = optimised_gradient_limiter
     
    395396        # Call correct module function
    396397        # (either from this module or C-extension)
    397         if self.use_old_limiter:
    398             distribute_to_vertices_and_edges(self)
    399         else:
     398        if self.use_edge_limiter:           
    400399            for name in self.conserved_quantities:
    401400                Q = self.quantities[name]
     
    404403                elif self._order_ == 2:
    405404                    Q.extrapolate_second_order_and_limit()
    406                     if name == 'stage':
    407                         Q.bound_vertices_below_by_quantity(self.quantities['elevation'])
    408405                else:
    409406                    raise 'Unknown order'
    410  
     407            balance_deep_and_shallow(self)
     408
     409            #Compute edge values by interpolation
     410            for name in self.conserved_quantities:
     411                Q = self.quantities[name]
     412                Q.interpolate_from_vertices_to_edges()
     413        else:
     414            distribute_to_vertices_and_edges(self)
     415
    411416
    412417
     
    871876    #
    872877    from shallow_water_ext import balance_deep_and_shallow as balance_deep_and_shallow_c
    873    
     878
     879
     880    #print 'calling balance depth and shallow'
    874881    # Shortcuts
    875882    wc = domain.quantities['stage'].centroid_values
  • anuga_core/source/anuga/shallow_water/shallow_water_ext.c

    r5162 r5175  
    589589    // Calculate minimal depth across all three vertices
    590590    hmin = min(hv[0], min(hv[1], hv[2]));
     591
     592    //if (hmin < 0.0 ) {
     593    //  printf("hmin = %f\n",hmin);
     594    //}
    591595   
    592596
     
    647651      }
    648652
    649      
     653      //printf("alpha=%f, tight_slope_limiters=%d\n", alpha, tight_slope_limiters);
     654
    650655      /*     
    651656      // Experimental code for controlling velocities at vertices.
     
    704709
    705710        // Update momentum at vertices
    706         if (tight_slope_limiters == 1) {       
    707           // FIXME(Ole): Here's what I think (as of 17 Nov 2007)
     711
     712
     713        // Update momentum at vertices
     714        // Update momentum as a linear combination of
     715        // xmomc and ymomc (shallow) and momentum
     716        // from extrapolator xmomv and ymomv (deep).
     717
     718
     719        //xmomv[k3+i] = (1-alpha)*xmomc[k] + alpha*xmomv[k3+i];
     720        //ymomv[k3+i] = (1-alpha)*ymomc[k] + alpha*ymomv[k3+i];
     721
     722        if (tight_slope_limiters == 1) {
     723          // FIXME(Ole): Here's what I think (as of 17 Nov 2007)
    708724          // we need to do. Simple and efficient:
    709725       
     
    721737          hv[i] = wv[k3+i] - zv[k3+i]; // Recompute (balanced) vertex depth
    722738          xmomv[k3+i] = uc*hv[i];
    723           ymomv[k3+i] = vc*hv[i];       
     739          ymomv[k3+i] = vc*hv[i];
    724740        } else {
    725741          // Update momentum as a linear combination of
    726742          // xmomc and ymomc (shallow) and momentum
    727743          // from extrapolator xmomv and ymomv (deep).
    728           // FIXME (Ole): Is this really needed? Could we use the above 
     744          // FIXME (Ole): Is this really needed? Could we use the above
    729745          // instead?
    730746         
     
    11891205
    11901206      hfactor = 0.0;
    1191       if (hmin > 0.1 ) {
    1192           hfactor = (hmin-0.1)/(hmin+0.4);
     1207      if (hmin > 0.001 ) {
     1208          hfactor = (hmin-0.001)/(hmin+0.004);
    11931209      }
    11941210     
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r5162 r5175  
    244244        # Get the variables
    245245        range = fid.variables['stage_range'][:]
     246        #print range
    246247        assert allclose(range,[-0.93519, 0.15]) or\
    247                allclose(range,[-0.9352743, 0.15]) # Old slope limiters
     248               allclose(range,[-0.9352743, 0.15]) or\
     249               allclose(range,[-0.93522203, 0.15000001]) # Old slope limiters
    248250       
    249251        range = fid.variables['xmomentum_range'][:]
    250 
    251 
    252 
     252        #print range
    253253        assert allclose(range,[0,0.4695096]) or \
    254254               allclose(range,[0,0.47790655]) or\
    255                allclose(range,[0,0.46941957])
     255               allclose(range,[0,0.46941957]) or\
     256               allclose(range,[0,0.47769409])
     257
    256258       
    257259        range = fid.variables['ymomentum_range'][:]
    258         #assert allclose(range,[0,0.02174380])
    259        
    260         assert allclose(range,[0,0.02174439]) or\
     260        #print range
     261        assert allclose(range,[0,0.02174380]) or\
     262              allclose(range,[0,0.02174439]) or\
    261263               allclose(range,[0,0.02283983]) or\
    262                allclose(range,[0,0.0217342]) # Old slope limiters
     264               allclose(range,[0,0.0217342]) or\
     265               allclose(range,[0,0.0227564]) # Old slope limiters
    263266       
    264267        fid.close()
     
    330333
    331334        extrema = fid.variables['xmomentum.extrema'][:]
    332         assert allclose(extrema,[-0.06062178, 0.47873023])
     335        assert allclose(extrema,[-0.06062178, 0.47873023]) or allclose(extrema, [-0.06062178, 0.47847986])
    333336       
    334337        extrema = fid.variables['ymomentum.extrema'][:]
    335         assert allclose(extrema,[0.00, 0.0625786])        
     338        assert allclose(extrema,[0.00, 0.0625786]) or allclose(extrema,[0.00, 0.06062178])
    336339
    337340        time_interval = fid.variables['extrema.time_interval'][:]
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r5119 r5175  
    25182518        #print L[1]
    25192519        assert allclose(L[1], [4.23370103, 16.06529897, 20.001]) or\
    2520                allclose(L[1], [4.18944138, 16.10955862, 20.001]) # old limiters
     2520               allclose(L[1], [4.18944138, 16.10955862, 20.001]) or\
     2521               allclose(L[1], [4.19351461, 16.10548539, 20.001]) # old limiters
    25212522       
    25222523        for i in range(len(L)):
  • anuga_validation/convergence_study/dam_break.py

    r5162 r5175  
    4141# Setup domain
    4242#------------------------------------------------------------------------------
    43 dx = 250.
     43dx = 200.
    4444dy = dx
    4545L = 100000.
    46 W = dx
     46W = 10*dx
    4747
    4848# structured mesh
     
    6262print domain.get_timestepping_method()
    6363
    64 domain.use_old_limiter = True
     64domain.use_old_limiter = False
     65domain.tight_slope_limiters = True
     66
    6567domain.CFL = 1.0
    6668
    67 domain.beta_w      = 1.7
    68 domain.beta_w_dry  = 0.0
    69 domain.beta_uh     = 1.7
    70 domain.beta_uh_dry = 0.0
    71 domain.beta_vh     = 1.7
    72 domain.beta_vh_dry = 0.0
    73 
     69domain.beta_w      = 0.6
     70domain.beta_uh     = 0.6
     71domain.beta_vh     = 0.6
     72domain.beta_h    = 0.0
    7473
    7574
     
    120119#------------------------------------------------------------------------------
    121120
    122 for t in domain.evolve(yieldstep = 20.0, finaltime = 60*60.):
    123     domain.write_time()
     121for t in domain.evolve(yieldstep = 100.0, finaltime = 60*60.):
     122    print domain.timestepping_statistics(track_speeds=True)
    124123    vis.update()
    125124   
  • anuga_validation/convergence_study/wave.py

    r5162 r5175  
    4242# Setup domain
    4343#------------------------------------------------------------------------------
    44 dx = 500.
     44dx = 200.
    4545dy = dx
    4646L = 100000.
     
    5858# Setup Algorithm
    5959#------------------------------------------------------------------------------
    60 #domain.set_timestepping_method('euler')
     60domain.set_timestepping_method('rk2')
     61domain.set_default_order(2)
    6162
    62 #domain.set_default_order(2)
    63 #domain.set_timestepping_method('euler')
    64 #domain.set_all_limiters(2.0)
    65 #domain.use_old_limiter = True
    66 #domain.CFL = 1.0
     63print domain.get_timestepping_method()
    6764
     65domain.use_edge_limiter = True
     66domain.tight_slope_limiters = True
    6867
    69 domain.set_default_order(2)
    70 #domain.set_timestepping_method('euler')
     68domain.CFL = 1.0
    7169
    72 domain.use_old_limiter = True
    73 
    74 domain.beta_w      = 2.0
    75 domain.beta_w_dry  = 0.5
    76 domain.beta_uh     = 2.0
    77 domain.beta_uh_dry = 0.5
    78 domain.beta_vh     = 2.0
    79 domain.beta_vh_dry = 0.5
     70domain.beta_w      = 0.6
     71domain.beta_w_dry  = 0.0
     72domain.beta_uh     = 0.6
     73domain.beta_uh_dry = 0.0
     74domain.beta_vh     = 0.6
     75domain.beta_vh_dry = 0.0
     76domain.beta_h    = 0.0
    8077
    8178
  • anuga_work/development/attenuation_near_shore/run_beach_structured.py

    r5166 r5175  
    140140    domain.set_datadir(pro_instance.outputdir)
    141141    domain.set_default_order(2) # Use second order spatial scheme
     142
    142143    domain.set_timestepping_method('rk2')
    143     domain.beta_w      = 2.0
    144     domain.beta_uh     = 2.0
    145     domain.beta_vh     = 2.0
    146     domain.beta_h      = 2.0
     144    domain.set_default_order(2)
     145    domain.use_old_limiter = False
     146    domain.tight_slope_limiters = True
     147   
     148    domain.beta_w      = 0.6
     149    domain.beta_uh     = 0.6
     150    domain.beta_vh     = 0.6
     151    domain.beta_h      = 0.0
     152
     153
    147154    domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    148155    domain.set_minimum_storable_height(0.001)
Note: See TracChangeset for help on using the changeset viewer.