Changeset 7741


Ignore:
Timestamp:
May 24, 2010, 2:41:35 PM (14 years ago)
Author:
mungkasi
Message:

Changing to be consistent with old anuga_1_1 code

Location:
anuga_work/development/sudi/sw_2d
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/sudi/sw_2d/swb_domain.py

    r7738 r7741  
    116116        #Call correct module function (either from this module or C-extension)
    117117
    118         #compute_fluxes(self)
    119 
    120         #return
     118        compute_fluxes(self)
     119
     120        return
     121
     122
     123   
    121124        from swb_domain_ext import compute_fluxes_c
    122125
     
    157160        """
    158161
    159         #Sww_domain.distribute_to_vertices_and_edges(self)
    160         #return
     162        Sww_domain.distribute_to_vertices_and_edges(self)
     163        return
     164
    161165   
    162166        #Shortcuts
     
    266270
    267271
    268     ##
    269     # @brief
    270     def distribute_to_vertices_and_edges_h(self):
    271         """Distribution from centroids to edges specific to the SWW eqn.
    272 
    273         It will ensure that h (w-z) is always non-negative even in the
    274         presence of steep bed-slopes by taking a weighted average between shallow
    275         and deep cases.
    276 
    277         In addition, all conserved quantities get distributed as per either a
    278         constant (order==1) or a piecewise linear function (order==2).
    279        
    280 
    281         Precondition:
    282         All conserved quantities defined at centroids and bed elevation defined at
    283         edges.
    284        
    285         Postcondition
    286         Evolved quantities defined at vertices and edges
    287         """
    288 
    289 
    290         #Shortcuts
    291         W  = self.quantities['stage']
    292         UH = self.quantities['xmomentum']
    293         VH = self.quantities['ymomentum']
    294         H  = self.quantities['height']
    295         Z  = self.quantities['elevation']
    296         U  = self.quantities['xvelocity']
    297         V  = self.quantities['yvelocity']
    298 
    299         #Arrays   
    300         w_C   = W.centroid_values   
    301         uh_C  = UH.centroid_values
    302         vh_C  = VH.centroid_values   
    303         z_C   = Z.centroid_values
    304         h_C   = H.centroid_values
    305         u_C   = U.centroid_values
    306         v_C   = V.centroid_values
    307 
    308         w_C[:] = num.maximum(w_C, z_C)
    309        
    310         h_C[:] = w_C - z_C
    311 
    312 
    313         assert num.min(h_C) >= 0
    314                
    315         num.putmask(uh_C, h_C < 1.0e-15, 0.0)
    316         num.putmask(vh_C, h_C < 1.0e-15, 0.0)
    317         num.putmask(h_C, h_C < 1.0e-15, 1.0e-16)       
    318        
    319         u_C[:]  = uh_C/h_C
    320         v_C[:]  = vh_C/h_C
    321 
    322         num.putmask(h_C, h_C < 1.0e-15, 0.0)
    323        
    324         for name in [ 'stage', 'height', 'xvelocity', 'yvelocity' ]:
    325             Q = self.quantities[name]
    326             if self._order_ == 1:
    327                 Q.extrapolate_first_order()
    328             elif self._order_ == 2:
    329                 Q.extrapolate_second_order_and_limit_by_edge()
    330                 #Q.extrapolate_second_order_and_limit_by_vertex()
    331             else:
    332                 raise 'Unknown order'
    333 
    334 
    335         w_E     = W.edge_values
    336         uh_E    = UH.edge_values
    337         vh_E    = VH.edge_values       
    338         h_E     = H.edge_values
    339         z_E     = Z.edge_values
    340         u_E     = U.edge_values
    341         v_E     = V.edge_values         
    342 
    343 
    344         #minh_E = num.min(h_E)
    345         #msg = 'min h_E = %g ' % minh_E
    346         #assert minh_E >= -1.0e-15, msg
    347 
    348         z_E[:]   = w_E - h_E
    349 
    350         num.putmask(h_E, h_E <= 1.0e-8, 0.0)
    351         num.putmask(u_E, h_E <= 1.0e-8, 0.0)
    352         num.putmask(v_E, h_E <= 1.0e-8, 0.0)
    353         num.putmask(w_E, h_E <= 1.0e-8, z_E)
    354         #num.putmask(h_E, h_E <= 0.0, 0.0)
    355        
    356         uh_E[:] = u_E * h_E
    357         vh_E[:] = v_E * h_E
    358 
    359         """
    360         print '=========================================================='
    361         print 'Time ', self.get_time()
    362         print h_E
    363         print uh_E
    364         print vh_E
    365         """
    366        
    367         # Compute vertex values by interpolation
    368         for name in self.evolved_quantities:
    369             Q = self.quantities[name]
    370             Q.interpolate_from_edges_to_vertices()
    371 
    372 
    373         w_V     = W.vertex_values
    374         uh_V    = UH.vertex_values
    375         vh_V    = VH.vertex_values     
    376         z_V     = Z.vertex_values       
    377         h_V     = H.vertex_values
    378         u_V     = U.vertex_values
    379         v_V     = V.vertex_values               
    380 
    381 
    382         #w_V[:]    = z_V + h_V
    383 
    384         #num.putmask(u_V, h_V <= 0.0, 0.0)
    385         #num.putmask(v_V, h_V <= 0.0, 0.0)
    386         #num.putmask(w_V, h_V <= 0.0, z_V)       
    387         #num.putmask(h_V, h_V <= 0.0, 0.0)
    388        
    389         uh_V[:] = u_V * h_V
    390         vh_V[:] = v_V * h_V
    391 
    392 
    393 
    394272
    395273    ##
  • anuga_work/development/sudi/sw_2d/test_swb_balance.py

    r7738 r7741  
    99from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
    1010from anuga.utilities.numerical_tools import mean
    11 from anuga.geometry.polygon import is_inside_polygon
     11from anuga.utilities.polygon import is_inside_polygon
    1212from anuga.coordinate_transforms.geo_reference import Geo_reference
    1313from anuga.abstract_2d_finite_volumes.quantity import Quantity
  • anuga_work/development/sudi/sw_2d/test_swb_boundary_condition.py

    r7740 r7741  
    99from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
    1010from anuga.utilities.numerical_tools import mean
    11 from anuga.geometry.polygon import is_inside_polygon
     11from anuga.utilities.polygon import is_inside_polygon
    1212from anuga.coordinate_transforms.geo_reference import Geo_reference
    1313from anuga.abstract_2d_finite_volumes.quantity import Quantity
  • anuga_work/development/sudi/sw_2d/test_swb_conservation.py

    r7738 r7741  
    458458        from anuga.shallow_water.shallow_water_domain import Reflective_boundary
    459459        from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary
    460         from anuga.shallow_water.forcing import Inflow
     460        from anuga.shallow_water.shallow_water_domain import Inflow
    461461        from anuga.shallow_water.data_manager \
    462462                import get_flow_through_cross_section
     
    551551        from anuga.shallow_water.shallow_water_domain import Reflective_boundary
    552552        from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary
    553         from anuga.shallow_water.forcing import Inflow
     553        from anuga.shallow_water.shallow_water_domain import Inflow
    554554        from anuga.shallow_water.data_manager import get_flow_through_cross_section
    555555
  • anuga_work/development/sudi/sw_2d/test_swb_forcing_terms.py

    r7738 r7741  
    13621362        from anuga.shallow_water.shallow_water_domain import Reflective_boundary
    13631363        from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary
    1364         from anuga.shallow_water.forcing import Inflow
     1364        from anuga.shallow_water.shallow_water_domain import Inflow
    13651365        from anuga.shallow_water.data_manager \
    13661366                import get_flow_through_cross_section
Note: See TracChangeset for help on using the changeset viewer.