Ignore:
Timestamp:
May 13, 2013, 5:09:25 PM (12 years ago)
Author:
davies
Message:

Updates to bal_dev

File:
1 edited

Legend:

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

    r8865 r8866  
    6666        self.set_CFL(1.0)
    6767        self.set_use_kinematic_viscosity(False)
    68         self.timestepping_method='rk2'#'rk2'#'euler'#'rk2'
     68        self.timestepping_method='rk2'#'rk2'#'rk2'#'euler'#'rk2'
    6969        # The following allows storage of the negative depths associated with this method
    7070        self.minimum_storable_height=-99999999999.0
     
    7474        self.extrapolate_velocity_second_order=True
    7575
    76         # Note that the extrapolation method used in quantity_ext.c (e.g.
    77         # extrapolate_second_order_and_limit_by_edge) uses a constant value for
    78         # all the betas. 
    7976        self.beta_w=0.0
    8077        self.beta_w_dry=0.0
     
    8380        self.beta_vh=0.0
    8481        self.beta_vh_dry=0.0
     82
     83        #self.epsilon=1.0e-100
    8584
    8685        #self.optimise_dry_cells=True
     
    111110        self.boundary_flux_sum=numpy.ndarray(1)
    112111        self.boundary_flux_sum[0]=0.
     112
     113        self.call=1 # Integer counting how many times we call compute_fluxes_central
     114
     115        # Integer recording the order of the time-stepping scheme
     116        if(self.timestepping_method=='rk2'):
     117          self.timestep_order=2
     118        elif(self.timestepping_method=='euler'):
     119          self.timestep_order=1
     120        elif(self.timestepping_method=='rk3'):
     121          self.timestep_order=3
     122        else:
     123          err_mess='ERROR: timestepping_method= ' + self.timestepping_method +' not supported in this solver'
     124          raise Exception, err_mess
    113125
    114126        print '##########################################################################'
     
    252264        #    raise Exception, err_mess
    253265
    254         if(domain.timestepping_method=='rk2'):
    255           timestep_order=2
    256         elif(domain.timestepping_method=='euler'):
    257           timestep_order=1
     266        #if(domain.timestepping_method=='rk2'):
     267        #  timestep_order=2
     268        #elif(domain.timestepping_method=='euler'):
     269        #  timestep_order=1
    258270        #elif(domain.timestepping_method=='rk3'):
    259271        #  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
     272        #else:
     273        #  err_mess='ERROR: domain.timestepping_method= ' + domain.timestepping_method +' not supported in this solver'
     274        #  raise Exception, err_mess
     275
     276        ##print 'timestep_order=', timestep_order
    265277
    266278        Stage = domain.quantities['stage']
     
    271283        timestep = float(sys.maxint)
    272284
     285        domain.call+=1
    273286        flux_timestep = compute_fluxes_ext(timestep,
    274287                                           domain.epsilon,
     
    297310                                           domain.max_speed,
    298311                                           int(domain.optimise_dry_cells),
    299                                            timestep_order,
     312                                           domain.timestep_order,
    300313                                           Stage.centroid_values,
    301314                                           Xmom.centroid_values,
     
    304317                                           Bed.vertex_values)
    305318
    306         #import pdb
    307         #pdb.set_trace()
    308         #print 'flux timestep: ', flux_timestep, domain.timestep
     319
     320        # Update the boundary flux integral
    309321        if(domain.timestepping_method=='rk2'):
    310           if(flux_timestep == float(sys.maxint)):
     322            if(domain.call%2==1):
    311323              domain.boundary_flux_integral[0]= domain.boundary_flux_integral[0] +\
    312324                                                domain.boundary_flux_sum[0]*domain.timestep*0.5
    313325              #print 'dbfi ', domain.boundary_flux_integral, domain.boundary_flux_sum
    314326              domain.boundary_flux_sum[0]=0.
     327
     328        elif(domain.timestepping_method=='euler'):
     329            domain.boundary_flux_integral=0.
     330            # This presently doesn't work -- this section of code may need to go elsewhere
     331            #domain.boundary_flux_integral[0]= domain.boundary_flux_integral[0] +\
     332            #                                  domain.boundary_flux_sum[0]*domain.timestep
     333            #domain.boundary_flux_sum[0]=0.
     334
     335        elif(domain.timestepping_method=='rk3'):
     336            domain.boundary_flux_integral=0.
     337            # This needs to be designed
     338        else:
     339            mess='ERROR: domain.timestepping_method', domain.timestepping_method,' method not recognised'
     340            raise Exception, mess
    315341
    316342        domain.flux_timestep = flux_timestep
Note: See TracChangeset for help on using the changeset viewer.