Changeset 5731
 Timestamp:
 Sep 4, 2008, 8:28:49 PM (15 years ago)
 Location:
 anuga_work/development/anuga_1d
 Files:

 4 edited
Legend:
 Unmodified
 Added
 Removed

anuga_work/development/anuga_1d/dam_h_elevation.py
r5728 r5731 1 1 import os 2 2 from math import sqrt, sin, cos, pi, exp 3 from shallow_water_domain _newimport *3 from shallow_water_domain import * 4 4 from Numeric import zeros, Float 5 5 #from analytic_dam_sudi import AnalyticDam … … 41 41 domain=Domain(points) 42 42 43 domain.default_order = 243 domain.default_order = 1 44 44 domain.default_time_order = 2 45 45 domain.cfl = 1.0 … … 140 140 from pylab import clf,plot,title,xlabel,ylabel,legend,savefig,show,hold,subplot,ion 141 141 #print 'Test1' 142 #hold(False)143 clf()142 hold(False) 143 #clf() 144 144 #print 'test 2' 145 145 plot1 = subplot(211) 146 146 #print 'test 3' 147 147 148 149 #print 'Test4' 150 148 151 plot(X,ElevationQ,X,HeightQ) 149 #print 'Test4'150 152 plot1.set_ylim([1,12]) 151 153 xlabel('Position') … … 159 161 plot2 = subplot(212) 160 162 plot(X,MomentumQ) 161 #plot2.set_ylim([5,35]) 163 plot2.set_ylim([1,1]) 164 162 165 #legend( ('Numerical Solution', 'for momentum'), 163 166 # 'upper right', shadow=False) 
anuga_work/development/anuga_1d/shallow_water_domain.py
r5727 r5731 91 91 self.quantities_to_be_stored = ['stage','xmomentum'] 92 92 93 93 self.__doc__ = 'shallow_water_domain' 94 94 95 95 
anuga_work/development/anuga_1d/shallow_water_domain_new.py
r5727 r5731 88 88 self.quantities_to_be_stored = ['stage', 'xmomentum', 'elevation'] 89 89 90 90 self.__doc__ = 'shallow_water_domain_new' 91 91 92 92 
anuga_work/development/anuga_1d/test_shallow_water.py
r5728 r5731 5 5 6 6 7 from shallow_water_domain _newimport *8 from shallow_water_domain _newimport flux_function as domain_flux_function9 10 from Numeric import allclose, array, ones, Float, maximum 7 from shallow_water_domain import * 8 from shallow_water_domain import flux_function as domain_flux_function 9 10 from Numeric import allclose, array, ones, Float, maximum, zeros 11 11 12 12 … … 119 119 120 120 121 def test_evolve (self):122 """ 123 Compare s hallow_water_domain gravity calculation121 def test_evolve_first_order(self): 122 """ 123 Compare still lake solution for various versions of shallow_water_domain 124 124 """ 125 125 … … 132 132 domain.set_boundary({'exterior' : Reflective_boundary(domain)}) 133 133 134 domain.default_order = 1 135 domain.default_time_order = 1 134 136 yieldstep=10.0 135 137 finaltime=10.0 136 138 137 139 for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime): 138 domain.write_time() 139 140 print domain.quantities['stage'].vertex_values 141 print domain.quantities['elevation'].vertex_values 142 print domain.quantities['xmomentum'].vertex_values 143 144 145 print domain.quantities['stage'].centroid_values 146 print domain.quantities['elevation'].centroid_values 147 print domain.quantities['xmomentum'].centroid_values 148 149 #assert allclose( array([34.3, 24.5, 14.7], Float), domain.quantities['xmomentum'].explicit_update ) 140 pass 141 142 ## print domain.quantities['stage'].vertex_values 143 ## print domain.quantities['elevation'].vertex_values 144 ## print domain.quantities['xmomentum'].vertex_values 145 ## 146 ## 147 ## print domain.quantities['stage'].centroid_values 148 ## print domain.quantities['elevation'].centroid_values 149 ## print domain.quantities['xmomentum'].centroid_values 150 151 assert allclose( 10.0*ones(10), domain.quantities['stage'].centroid_values ) 152 assert allclose( zeros(10), domain.quantities['xmomentum'].centroid_values ) 153 154 155 def test_evolve_euler_second_order_space(self): 156 """ 157 Compare still lake solution for various versions of shallow_water_domain 158 """ 159 160 def slope_square(x): 161 return maximum(4.0(x5.0)*(x5.0), 0.0) 162 163 domain = Domain(self.points2) 164 domain.set_quantity('stage',10.0) 165 domain.set_quantity('elevation',slope_square) 166 domain.set_boundary({'exterior' : Reflective_boundary(domain)}) 167 168 domain.default_order = 2 169 domain.default_time_order = 1 170 yieldstep=10.0 171 finaltime=10.0 172 173 for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime): 174 pass 175 176 assert allclose( 10.0*ones(10), domain.quantities['stage'].centroid_values ) 177 assert allclose( zeros(10), domain.quantities['xmomentum'].centroid_values ) 178 179 def test_evolve_euler_second_order_space_time(self): 180 """ 181 Compare still lake solution for various versions of shallow_water_domain 182 """ 183 184 def slope_square(x): 185 return maximum(4.0(x5.0)*(x5.0), 0.0) 186 187 domain = Domain(self.points2) 188 domain.set_quantity('stage',10.0) 189 domain.set_quantity('elevation',slope_square) 190 domain.set_boundary({'exterior' : Reflective_boundary(domain)}) 191 192 domain.default_order = 2 193 domain.default_time_order = 2 194 yieldstep=10.0 195 finaltime=10.0 196 197 for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime): 198 pass 199 200 assert allclose( 10.0*ones(10), domain.quantities['stage'].centroid_values ) 201 assert allclose( zeros(10), domain.quantities['xmomentum'].centroid_values ) 202 150 203 151 204
Note: See TracChangeset
for help on using the changeset viewer.