Changeset 7741
- Timestamp:
- May 24, 2010, 2:41:35 PM (15 years ago)
- 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 116 116 #Call correct module function (either from this module or C-extension) 117 117 118 #compute_fluxes(self) 119 120 #return 118 compute_fluxes(self) 119 120 return 121 122 123 121 124 from swb_domain_ext import compute_fluxes_c 122 125 … … 157 160 """ 158 161 159 #Sww_domain.distribute_to_vertices_and_edges(self) 160 #return 162 Sww_domain.distribute_to_vertices_and_edges(self) 163 return 164 161 165 162 166 #Shortcuts … … 266 270 267 271 268 ##269 # @brief270 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 the274 presence of steep bed-slopes by taking a weighted average between shallow275 and deep cases.276 277 In addition, all conserved quantities get distributed as per either a278 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 at283 edges.284 285 Postcondition286 Evolved quantities defined at vertices and edges287 """288 289 290 #Shortcuts291 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 #Arrays300 w_C = W.centroid_values301 uh_C = UH.centroid_values302 vh_C = VH.centroid_values303 z_C = Z.centroid_values304 h_C = H.centroid_values305 u_C = U.centroid_values306 v_C = V.centroid_values307 308 w_C[:] = num.maximum(w_C, z_C)309 310 h_C[:] = w_C - z_C311 312 313 assert num.min(h_C) >= 0314 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_C320 v_C[:] = vh_C/h_C321 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_values336 uh_E = UH.edge_values337 vh_E = VH.edge_values338 h_E = H.edge_values339 z_E = Z.edge_values340 u_E = U.edge_values341 v_E = V.edge_values342 343 344 #minh_E = num.min(h_E)345 #msg = 'min h_E = %g ' % minh_E346 #assert minh_E >= -1.0e-15, msg347 348 z_E[:] = w_E - h_E349 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_E357 vh_E[:] = v_E * h_E358 359 """360 print '=========================================================='361 print 'Time ', self.get_time()362 print h_E363 print uh_E364 print vh_E365 """366 367 # Compute vertex values by interpolation368 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_values374 uh_V = UH.vertex_values375 vh_V = VH.vertex_values376 z_V = Z.vertex_values377 h_V = H.vertex_values378 u_V = U.vertex_values379 v_V = V.vertex_values380 381 382 #w_V[:] = z_V + h_V383 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_V390 vh_V[:] = v_V * h_V391 392 393 394 272 395 273 ## -
anuga_work/development/sudi/sw_2d/test_swb_balance.py
r7738 r7741 9 9 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 10 10 from anuga.utilities.numerical_tools import mean 11 from anuga. geometry.polygon import is_inside_polygon11 from anuga.utilities.polygon import is_inside_polygon 12 12 from anuga.coordinate_transforms.geo_reference import Geo_reference 13 13 from anuga.abstract_2d_finite_volumes.quantity import Quantity -
anuga_work/development/sudi/sw_2d/test_swb_boundary_condition.py
r7740 r7741 9 9 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 10 10 from anuga.utilities.numerical_tools import mean 11 from anuga. geometry.polygon import is_inside_polygon11 from anuga.utilities.polygon import is_inside_polygon 12 12 from anuga.coordinate_transforms.geo_reference import Geo_reference 13 13 from anuga.abstract_2d_finite_volumes.quantity import Quantity -
anuga_work/development/sudi/sw_2d/test_swb_conservation.py
r7738 r7741 458 458 from anuga.shallow_water.shallow_water_domain import Reflective_boundary 459 459 from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary 460 from anuga.shallow_water. forcingimport Inflow460 from anuga.shallow_water.shallow_water_domain import Inflow 461 461 from anuga.shallow_water.data_manager \ 462 462 import get_flow_through_cross_section … … 551 551 from anuga.shallow_water.shallow_water_domain import Reflective_boundary 552 552 from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary 553 from anuga.shallow_water. forcingimport Inflow553 from anuga.shallow_water.shallow_water_domain import Inflow 554 554 from anuga.shallow_water.data_manager import get_flow_through_cross_section 555 555 -
anuga_work/development/sudi/sw_2d/test_swb_forcing_terms.py
r7738 r7741 1362 1362 from anuga.shallow_water.shallow_water_domain import Reflective_boundary 1363 1363 from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary 1364 from anuga.shallow_water. forcingimport Inflow1364 from anuga.shallow_water.shallow_water_domain import Inflow 1365 1365 from anuga.shallow_water.data_manager \ 1366 1366 import get_flow_through_cross_section
Note: See TracChangeset
for help on using the changeset viewer.