- Timestamp:
- Aug 22, 2007, 4:39:07 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r4619 r4677 171 171 172 172 #Defaults 173 from anuga.config import max_smallsteps, beta_w, beta_h, epsilon, CFL 173 from anuga.config import max_smallsteps, beta_w, beta_h, epsilon 174 from anuga.config import CFL 175 from anuga.config import protect_against_isolated_degenerate_timesteps 174 176 self.beta_w = beta_w 175 177 self.beta_h = beta_h 176 178 self.epsilon = epsilon 179 self.protect_against_isolated_degenerate_timesteps = protect_against_isolated_degenerate_timesteps 180 177 181 178 182 #FIXME: Maybe have separate orders for h-limiter and w-limiter? … … 646 650 for name in self.quantities: 647 651 q = self.quantities[name] 648 X,Y,A,V = q.get_vertex_values() 652 653 V = q.get_values(location='vertices', indices=[k])[0] 654 C = q.get_values(location='centroids', indices=[k]) 649 655 650 656 s = ' %s:\t %.4f,\t %.4f,\t %.4f,\t %.4f\n'\ 651 %(name, A[3*k], A[3*k+1], A[3*k+2], q.get_values(location='centroids')[k])657 %(name, V[0], V[1], V[2], C[0]) 652 658 653 659 msg += s … … 962 968 from anuga.config import min_timestep, max_timestep 963 969 970 971 972 # Protect against degenerate timesteps arising from isolated 973 # triangles 974 if self.protect_against_isolated_degenerate_timesteps is True and\ 975 self.max_speed > 10.0: 976 977 # Setup 10 bins for speed histogram 978 from anuga.utilities.numerical_tools import histogram, create_bins 979 980 bins = create_bins(self.max_speed, 10) 981 hist = histogram(self.max_speed, bins) 982 983 # Look for characteristic signature 984 if len(hist) > 1 and\ 985 hist[-1] > 0 and\ 986 hist[4] == hist[5] == hist[6] == hist[7] == hist[8] == 0: 987 # Danger of isolated degenerate triangles 988 # print self.timestepping_statistics(track_speeds=True) 989 990 # Find triangles in last bin 991 # FIXME - speed up using Numeric 992 d = 0 993 for i in range(self.number_of_full_triangles): 994 if self.max_speed[i] > bins[-1]: 995 msg = 'Time=%f: Ignoring isolated high speed triangle ' %self.time 996 msg += '#%d of %d with max speed=%f'\ 997 %(i, self.number_of_full_triangles, self.max_speed[i]) 998 #print msg 999 1000 # print 'Found offending triangle', i, self.max_speed[i] 1001 self.get_quantity('xmomentum').set_values(0.0, indices=[i]) 1002 self.get_quantity('ymomentum').set_values(0.0, indices=[i]) 1003 self.max_speed[i]=0.0 1004 d += 1 1005 1006 #print 'Adjusted %d triangles' %d 1007 #print self.timestepping_statistics(track_speeds=True) 1008 1009 1010 964 1011 # self.timestep is calculated from speed of characteristics 965 1012 # Apply CFL condition here … … 970 1017 self.min_timestep = min(timestep, self.min_timestep) 971 1018 1019 1020 972 1021 #Protect against degenerate time steps 973 1022 if timestep < min_timestep: … … 988 1037 989 1038 990 print self.timestepping_statistics(track_speeds=True)991 992 993 raise Exception 1039 #print self.timestepping_statistics(track_speeds=True) 1040 1041 1042 raise Exception, msg 994 1043 else: 995 1044 #Try to overcome situation by switching to 1 order
Note: See TracChangeset
for help on using the changeset viewer.