Changeset 9221
- Timestamp:
- Jun 26, 2014, 10:58:41 PM (10 years ago)
- Location:
- trunk/anuga_core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r9218 r9221 558 558 559 559 def set_DE2_defaults(self): 560 """Set up the defaults for running the flow_algorithm "DE 1"560 """Set up the defaults for running the flow_algorithm "DE2" 561 561 A 'discontinuous elevation' method 562 562 """ 563 self.set_CFL( 0.95)563 self.set_CFL(1.0) 564 564 self.set_use_kinematic_viscosity(False) 565 565 #self.timestepping_method='rk2'#'rk3'#'euler'#'rk2' … … 625 625 626 626 627 def set_DE3_defaults(self): 628 """Set up the defaults for running the flow_algorithm "DE3" 629 A 'discontinuous elevation' method 630 """ 631 self.set_CFL(0.9) 632 self.set_use_kinematic_viscosity(False) 633 #self.timestepping_method='rk2'#'rk3'#'euler'#'rk2' 634 self.set_timestepping_method(1) 635 636 self.set_using_discontinuous_elevation(True) 637 self.set_compute_fluxes_method('DE') 638 self.set_distribute_to_vertices_and_edges_method('DE') 639 640 # Don't place any restriction on the minimum storable height 641 self.minimum_storable_height=-99999999999.0 642 self.minimum_allowed_height=1.0e-12 643 644 self.use_edge_limiter=True 645 self.set_default_order(2) 646 self.set_extrapolate_velocity() 647 648 self.beta_w=0.7 649 self.beta_w_dry=0.1 650 self.beta_uh=0.7 651 self.beta_uh_dry=0.1 652 self.beta_vh=0.7 653 self.beta_vh_dry=0.1 654 655 656 #self.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 657 # 'ymomentum': 2, 'elevation': 2, 'height':2}) 658 #self.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 659 # 'ymomentum': 2, 'elevation': 1}) 660 self.set_store_centroids(True) 661 662 self.optimise_dry_cells=False 663 664 # We need the edge_coordinates for the extrapolation 665 self.edge_coordinates=self.get_edge_midpoint_coordinates() 666 667 # By default vertex values are NOT stored uniquely 668 # for storage efficiency. We may override this (but not so important since 669 # centroids are stored anyway 670 # self.set_store_vertices_smoothly(False) 671 672 self.maximum_allowed_speed=0.0 673 674 ## FIXME: Should implement tracking of boundary fluxes 675 ## Keep track of the fluxes through the boundaries 676 self.boundary_flux_integral=num.ndarray(1) 677 self.boundary_flux_integral[0]=0. 678 self.boundary_flux_sum=num.ndarray(1) 679 self.boundary_flux_sum[0]=0. 680 681 self.call=1 # Integer counting how many times we call compute_fluxes_central 682 683 if self.processor == 0 and self.verbose: 684 print '##########################################################################' 685 print '#' 686 print '# Using discontinuous elevation solver DE3' 687 print '#' 688 print '# A slightly less diffusive version than DE0, uses euler timestepping' 689 print '#' 690 print '# Make sure you use centroid values when reporting on important output quantities' 691 print '#' 692 print '##########################################################################' 693 694 627 695 628 696 def update_special_conditions(self): … … 780 848 DE1 781 849 DE2 850 DE3 782 851 """ 783 852 … … 787 856 flag = str(float(str(flag))).replace(".","_") 788 857 789 flow_algorithms = ['1_0', '1_5', '1_75', '2_0', '2_0_limited', '2_5', 'tsunami', 'yusuke', 'DE0', 'DE1', 'DE2'] 858 flow_algorithms = ['1_0', '1_5', '1_75', '2_0', '2_0_limited', '2_5', \ 859 'tsunami', 'yusuke', 'DE0', 'DE1', 'DE2', 'DE3'] 790 860 791 861 if flag in flow_algorithms: … … 903 973 if self.flow_algorithm == 'DE2': 904 974 self.set_DE2_defaults() 975 976 if self.flow_algorithm == 'DE3': 977 self.set_DE3_defaults() 905 978 906 979 def get_flow_algorithm(self): … … 908 981 909 982 Currently 910 1_0, 1_5, 1_75 2_0, 2_5, tsunami, DE0, DE1, DE2 983 1_0, 1_5, 1_75 2_0, 2_5, tsunami, DE0, DE1, DE2, DE3 911 984 """ 912 985 … … 1220 1293 return self.get_quantity('elevation').\ 1221 1294 get_maximum_location(indices=wet_elements) 1295 1296 1297 def get_total_volume(self): 1298 1299 from anuga import myid, numprocs, send, receive, barrier 1300 1301 if self.get_using_discontinuous_elevation(): 1302 Height = self.quantities['height'] 1303 volume = Height.get_integral() 1304 else: 1305 Stage = self.quantities['stage'] 1306 Elev = self.quantities['elevation'] 1307 Height = Stage-Elev 1308 volume = Height.get_integral() 1309 1310 if myid == 0: 1311 total_volume = volume 1312 for i in range(1,numprocs): 1313 remote_volume = receive(i) 1314 total_volume = total_volume + remote_volume 1315 else: 1316 send(volume,0) 1317 1318 barrier() 1319 1320 if myid == 0: 1321 for i in range(1,numprocs): 1322 send(total_volume,i) 1323 else: 1324 total_volume = receive(0) 1325 1326 return total_volume 1222 1327 1223 1328 … … 1729 1834 print 'Cumulative mass protection: '+str(mass_error)+' m^3 ' 1730 1835 1731 elif self.flow_algorithm == 'DE1' or self.flow_algorithm == 'DE0':1836 elif self.flow_algorithm.startswith('DE'): 1732 1837 1733 1838 from swDE1_domain_ext import protect … … 1831 1936 1832 1937 if len(negative_ids)>0: 1833 #print 'NEGATIVE INDICES' 1938 import warnings 1939 warnings.warn('Negative cells being set to zero depth, possible loss of conservation') 1834 1940 Stage.centroid_values[negative_ids] = Elev.centroid_values[negative_ids] 1835 1941 Xmom.centroid_values[negative_ids] = 0.0 -
trunk/anuga_core/validation_tests/analytical_exact/rundown_mild_slope_coarse/plot_results.py
r9174 r9221 43 43 44 44 #-------------------- 45 # Make plot animation45 # Make plots 46 46 #-------------------- 47 47 # Find an y value close to y==50 … … 67 67 #pyplot.ylim([0.0,0.05]) 68 68 pyplot.xlabel('Xposition m') 69 pyplot.ylabel(' Depth m')70 pyplot.title(' Velocity down the slope (along y=50.)')69 pyplot.ylabel('Velocity m/s') 70 pyplot.title('X Velocity down the slope (along y=50.)') 71 71 pyplot.legend(loc='best') 72 72 pyplot.savefig('xvelocity_x.png') … … 98 98 pyplot.ylim([0.0,0.35]) 99 99 pyplot.xlabel('Yposition along the line x=50') 100 pyplot.ylabel(' Xvelocity m/s')101 pyplot.title(' Final Xvelocity around the line x=50.')100 pyplot.ylabel('Velocity m/s') 101 pyplot.title('X Velocity around the line x=50.') 102 102 pyplot.legend(loc='best') 103 103 pyplot.savefig('x_velocity.png') … … 108 108 #pyplot.ylim([0.0,0.3]) 109 109 pyplot.xlabel('Yposition along the line x=50') 110 pyplot.ylabel(' Yvelocity')111 pyplot.title(' Final Yvelocity around the line x=50.')110 pyplot.ylabel('Velocity m/s') 111 pyplot.title('Y Velocity around the line x=50.') 112 112 pyplot.legend(loc='best') 113 113 pyplot.savefig('y_velocity.png') -
trunk/anuga_core/validation_tests/analytical_exact/rundown_mild_slope_coarse/results.tex
r9038 r9221 41 41 \begin{figure} 42 42 \begin{center} 43 \includegraphics[width=0.8\textwidth]{ final_depth.png}43 \includegraphics[width=0.8\textwidth]{depth_x.png} 44 44 \caption{Depth in the downstream direction} 45 45 \label{fig:depthdownchan} 46 \end{center} 47 \end{figure} 48 49 \begin{figure} 50 \begin{center} 51 \includegraphics[width=0.8\textwidth]{xvelocity_x.png} 52 \caption{X velocity in the downstream direction} 53 \label{fig:xveldownchan} 54 \end{center} 55 \end{figure} 56 57 \begin{figure} 58 \begin{center} 59 \includegraphics[width=0.8\textwidth]{depth_y.png} 60 \caption{Depth in the downstream direction} 61 \label{fig:depthacrosschan} 46 62 \end{center} 47 63 \end{figure} -
trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/numerical_channel_floodplain.py
r9217 r9221 10 10 import anuga 11 11 import numpy 12 from anuga import myid, finalize, distribute 12 from anuga import myid, finalize, distribute, numprocs, receive, send 13 13 14 14 #------------------------------------------------------------------------------ … … 28 28 man_n, l0 29 29 30 #l0 = 2.030 l0 = 2.0 31 31 32 32 assert chan_width < floodplain_width, \ … … 54 54 # do not overlap. 55 55 channel_polygon = [ [floodplain_width/2. - chan_width/2., +l0], 56 [floodplain_width/2. - chan_width/2., floodplain_length -l0],57 [floodplain_width/2. + chan_width/2., floodplain_length -l0],56 [floodplain_width/2. - chan_width/2., floodplain_length - l0], 57 [floodplain_width/2. + chan_width/2., floodplain_length - l0], 58 58 [floodplain_width/2. + chan_width/2., +l0] 59 59 ] … … 127 127 # Define inlet operator 128 128 #--------------------------------------------------------------------- 129 flow_in_yval= 0.0129 flow_in_yval=5.0 130 130 line1 = [ [floodplain_width/2. - chan_width/2., flow_in_yval],\ 131 131 [floodplain_width/2. + chan_width/2., flow_in_yval] ] … … 173 173 parameter_file.close() 174 174 175 176 177 175 178 #------------------------------------------------------------------------------ 176 179 # Evolve system through time … … 178 181 for t in domain.evolve(yieldstep=10.0, finaltime=1000.0): 179 182 if myid == 0 and verbose: print domain.timestepping_statistics() 183 184 # if numpy.allclose(t,0.0): 185 # exact_volume = domain.get_total_volume() 186 # else: 187 # exact_volume = exact_volume + Qin*10.0 188 # 189 # total_volume= domain.get_total_volume() 190 191 192 #if myid == 0 and verbose: print anuga.indent,'total volume - exact_volume ', total_volume - exact_volume 180 193 181 194 domain.sww_merge(delete_old=True) -
trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/plot_results.py
r9216 r9221 14 14 print numpy.any(v) 15 15 # Numerical results along a central channel 'slice' 16 index= p.stage.shape[0]-116 index= -1 17 17 V1 = p.stage[index,v] - p.elev[v] 18 18 V2 = p.yvel[index,v] … … 49 49 dc_analytical = scipy.optimize.fmin(minme, x0=1.0)[0] 50 50 51 51 print 'dc_analytic ',dc_analytical 52 52 53 53 ################################## -
trunk/anuga_core/validation_tests/analytical_exact/trapezoidal_channel/results.tex
r9216 r9221 28 28 29 29 Figure~\ref{fig:hydrographs} show the hydrographs through various cross sections showing the flows limiting to the 30 expected inflow $Q$. 30 expected inflow $Q$ (For coarser grids there is a discrepency between the expected and calculated limiting 31 hydrograph due to the error in calculating the hydrograph). It is also noted that the transient flow is quite different 32 for different grid sizes. We theorize that the coarser grids produce a rougher bed which slows down the flow. 31 33 32 34 \begin{figure}
Note: See TracChangeset
for help on using the changeset viewer.