Ignore:
Timestamp:
May 12, 2013, 8:11:11 PM (12 years ago)
Author:
davies
Message:

Updates to balanced_dev

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain.py

    r8772 r8865  
    5959                            number_of_full_triangles = number_of_full_triangles)
    6060       
     61        #self.forcing_terms.append(manning_friction_implicit)
    6162        #------------------------------------------------
    6263        # set some defaults
    6364        # Most of these override the options in config.py
    6465        #------------------------------------------------
    65         self.set_CFL(1.00)
     66        self.set_CFL(1.0)
    6667        self.set_use_kinematic_viscosity(False)
    67         self.timestepping_method='rk2' #'euler'#'rk2'#'euler'#'rk2'
     68        self.timestepping_method='rk2'#'rk2'#'euler'#'rk2'
    6869        # The following allows storage of the negative depths associated with this method
    6970        self.minimum_storable_height=-99999999999.0
     
    7677        # extrapolate_second_order_and_limit_by_edge) uses a constant value for
    7778        # all the betas. 
    78         self.beta_w=1.0
     79        self.beta_w=0.0
    7980        self.beta_w_dry=0.0
    80         self.beta_uh=1.0
     81        self.beta_uh=0.0
    8182        self.beta_uh_dry=0.0
    82         self.beta_vh=1.0
     83        self.beta_vh=0.0
    8384        self.beta_vh_dry=0.0
    8485
     
    241242
    242243        # Shortcuts
    243         if(domain.timestepping_method!='rk2'):
    244             err_mess='ERROR: Timestepping method is ' + domain.timestepping_method +'. '+\
    245                      'You need to use rk2 timestepping with this solver, ' +\
    246                      ' because there is presently a hack in compute fluxes central. \n'+\
    247                      ' The HACK: The timestep will only ' +\
    248                      'be recomputed on every 2nd call to compute_fluxes_central, to support'+\
    249                      ' correct treatment of wetting and drying'
    250 
    251             raise Exception, err_mess
     244        #if(domain.timestepping_method!='rk2'):
     245        #    err_mess='ERROR: Timestepping method is ' + domain.timestepping_method +'. '+\
     246        #             'You need to use rk2 timestepping with this solver, ' +\
     247        #             ' because there is presently a hack in compute fluxes central. \n'+\
     248        #             ' The HACK: The timestep will only ' +\
     249        #             'be recomputed on every 2nd call to compute_fluxes_central, to support'+\
     250        #             ' correct treatment of wetting and drying'
     251
     252        #    raise Exception, err_mess
     253
     254        if(domain.timestepping_method=='rk2'):
     255          timestep_order=2
     256        elif(domain.timestepping_method=='euler'):
     257          timestep_order=1
     258        #elif(domain.timestepping_method=='rk3'):
     259        #  timestep_order=3
     260        else:
     261          err_mess='ERROR: domain.timestepping_method= ' + domain.timestepping_method +' not supported in this solver'
     262          raise Exception, err_mess
     263
     264        #print 'timestep_order=', timestep_order
    252265
    253266        Stage = domain.quantities['stage']
     
    260273        flux_timestep = compute_fluxes_ext(timestep,
    261274                                           domain.epsilon,
    262                                            domain.H0,
     275                                           domain.minimum_allowed_height,
    263276                                           domain.g,
    264277                                           domain.boundary_flux_sum,
     
    284297                                           domain.max_speed,
    285298                                           int(domain.optimise_dry_cells),
     299                                           timestep_order,
    286300                                           Stage.centroid_values,
    287301                                           Xmom.centroid_values,
     
    293307        #pdb.set_trace()
    294308        #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.
     309        if(domain.timestepping_method=='rk2'):
     310          if(flux_timestep == float(sys.maxint)):
     311              domain.boundary_flux_integral[0]= domain.boundary_flux_integral[0] +\
     312                                                domain.boundary_flux_sum[0]*domain.timestep*0.5
     313              #print 'dbfi ', domain.boundary_flux_integral, domain.boundary_flux_sum
     314              domain.boundary_flux_sum[0]=0.
    300315
    301316        domain.flux_timestep = flux_timestep
     
    590605
    591606
     607#def manning_friction_implicit(domain):
     608#    """Apply (Manning) friction to water momentum
     609#    Wrapper for c version
     610#    """
     611#
     612#    from shallow_water_ext import manning_friction_flat
     613#    from shallow_water_ext import manning_friction_sloped
     614#
     615#    xmom = domain.quantities['xmomentum']
     616#    ymom = domain.quantities['ymomentum']
     617#
     618#    x = domain.get_vertex_coordinates()
     619#   
     620#    w = domain.quantities['stage'].centroid_values
     621#    z = domain.quantities['elevation'].vertex_values
     622#
     623#    uh = xmom.centroid_values
     624#    vh = ymom.centroid_values
     625#    eta = domain.quantities['friction'].centroid_values
     626#
     627#    xmom_update = xmom.semi_implicit_update
     628#    ymom_update = ymom.semi_implicit_update
     629#
     630#    eps = domain.epsilon
     631#    g = domain.g
     632#
     633#    if domain.use_sloped_mannings:
     634#        manning_friction_sloped(g, eps, x, w, uh, vh, z, eta, xmom_update, \
     635#                                ymom_update)
     636#    else:
     637#        manning_friction_flat(g, eps, w, uh, vh, z, eta, xmom_update, \
     638#                                #ymom_update)
Note: See TracChangeset for help on using the changeset viewer.