- Timestamp:
- May 12, 2013, 8:11:11 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain.py
r8772 r8865 59 59 number_of_full_triangles = number_of_full_triangles) 60 60 61 #self.forcing_terms.append(manning_friction_implicit) 61 62 #------------------------------------------------ 62 63 # set some defaults 63 64 # Most of these override the options in config.py 64 65 #------------------------------------------------ 65 self.set_CFL(1.0 0)66 self.set_CFL(1.0) 66 67 self.set_use_kinematic_viscosity(False) 67 self.timestepping_method='rk2' #'euler'#'rk2'#'euler'#'rk2'68 self.timestepping_method='rk2'#'rk2'#'euler'#'rk2' 68 69 # The following allows storage of the negative depths associated with this method 69 70 self.minimum_storable_height=-99999999999.0 … … 76 77 # extrapolate_second_order_and_limit_by_edge) uses a constant value for 77 78 # all the betas. 78 self.beta_w= 1.079 self.beta_w=0.0 79 80 self.beta_w_dry=0.0 80 self.beta_uh= 1.081 self.beta_uh=0.0 81 82 self.beta_uh_dry=0.0 82 self.beta_vh= 1.083 self.beta_vh=0.0 83 84 self.beta_vh_dry=0.0 84 85 … … 241 242 242 243 # 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 252 265 253 266 Stage = domain.quantities['stage'] … … 260 273 flux_timestep = compute_fluxes_ext(timestep, 261 274 domain.epsilon, 262 domain. H0,275 domain.minimum_allowed_height, 263 276 domain.g, 264 277 domain.boundary_flux_sum, … … 284 297 domain.max_speed, 285 298 int(domain.optimise_dry_cells), 299 timestep_order, 286 300 Stage.centroid_values, 287 301 Xmom.centroid_values, … … 293 307 #pdb.set_trace() 294 308 #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. 300 315 301 316 domain.flux_timestep = flux_timestep … … 590 605 591 606 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.