Changeset 7704
 Timestamp:
 Apr 30, 2010, 5:11:19 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r7573 r7704 15 15 16 16 from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh 17 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 18 import Boundary 19 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 20 import File_boundary 21 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 22 import AWI_boundary 23 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 24 import Dirichlet_boundary 25 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 26 import Time_boundary 27 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 28 import Transmissive_boundary 17 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions \ 18 import ( Boundary, File_boundary, AWI_boundary, 19 Dirichlet_boundary, Time_boundary, Transmissive_boundary ) 29 20 from anuga.abstract_2d_finite_volumes.pmesh2domain import pmesh_to_domain 30 from anuga.abstract_2d_finite_volumes.region \31 21 from anuga.abstract_2d_finite_volumes.region \ 22 import Set_region as region_set_region 32 23 from anuga.utilities.polygon import inside_polygon 33 24 from anuga.abstract_2d_finite_volumes.util import get_textual_float … … 1853 1844 # Protect against degenerate timesteps arising from isolated 1854 1845 # triangles 1855 # FIXME (Steve): This should be in shallow_water as it assumes x and y 1856 # momentum 1857 if self.protect_against_isolated_degenerate_timesteps is True and \ 1858 num.max(self.max_speed) > 10.0: # FIXME (Ole): Make this configurable 1859 1860 # Setup 10 bins for speed histogram 1861 from anuga.utilities.numerical_tools import histogram, create_bins 1862 1863 bins = create_bins(self.max_speed, 10) 1864 hist = histogram(self.max_speed, bins) 1865 1866 # Look for characteristic signature 1867 if len(hist) > 1 and hist[1] > 0 and \ 1868 hist[4] == hist[5] == hist[6] == hist[7] == hist[8] == 0: 1869 # Danger of isolated degenerate triangles 1870 1871 # Find triangles in last bin 1872 # FIXME  speed up using numeric package 1873 d = 0 1874 for i in range(self.number_of_full_triangles): 1875 if self.max_speed[i] > bins[1]: 1876 msg = 'Time=%f: Ignoring isolated high ' % self.time 1877 msg += 'speed triangle ' 1878 msg += '#%d of %d with max speed=%f' \ 1879 % (i, self.number_of_full_triangles, 1880 self.max_speed[i]) 1881 1882 self.get_quantity('xmomentum').\ 1883 set_values(0.0, indices=[i]) 1884 self.get_quantity('ymomentum').\ 1885 set_values(0.0, indices=[i]) 1886 self.max_speed[i]=0.0 1887 d += 1 1888 1846 self.apply_protection_against_isolated_degenerate_timesteps() 1847 1889 1848 # self.timestep is calculated from speed of characteristics 1890 1849 # Apply CFL condition here … … 2027 1986 2028 1987 return normfunc(self.quantities[quantity].centroid_values) 1988 1989 1990 1991 def apply_protection_against_isolated_degenerate_timesteps(self): 1992 1993 # FIXME (Steve): This should be in shallow_water as it assumes x and y 1994 # momentum 1995 if self.protect_against_isolated_degenerate_timesteps is False: 1996 return 1997 1998 # FIXME (Ole): Make this configurable 1999 if num.max(self.max_speed) < 10.0: 2000 return 2001 2002 # Setup 10 bins for speed histogram 2003 from anuga.utilities.numerical_tools import histogram, create_bins 2004 2005 bins = create_bins(self.max_speed, 10) 2006 hist = histogram(self.max_speed, bins) 2007 2008 # Look for characteristic signature 2009 if len(hist) > 1 and hist[1] > 0 and \ 2010 hist[4] == hist[5] == hist[6] == hist[7] == hist[8] == 0: 2011 # Danger of isolated degenerate triangles 2012 2013 # Find triangles in last bin 2014 # FIXME  speed up using numeric package 2015 d = 0 2016 for i in range(self.number_of_full_triangles): 2017 if self.max_speed[i] > bins[1]: 2018 msg = 'Time=%f: Ignoring isolated high ' % self.time 2019 msg += 'speed triangle ' 2020 msg += '#%d of %d with max speed=%f' \ 2021 % (i, self.number_of_full_triangles, self.max_speed[i]) 2022 2023 self.get_quantity('xmomentum').\ 2024 set_values(0.0, indices=[i]) 2025 self.get_quantity('ymomentum').\ 2026 set_values(0.0, indices=[i]) 2027 self.max_speed[i]=0.0 2028 d += 1 2029 2029 2030 2030
Note: See TracChangeset
for help on using the changeset viewer.