Changeset 5728
- Timestamp:
- Sep 4, 2008, 7:12:44 AM (17 years ago)
- Location:
- anuga_work/development/anuga_1d
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anuga_1d/dam_h_elevation.py
r5727 r5728 1 1 import os 2 2 from math import sqrt, sin, cos, pi, exp 3 from shallow_water_domain import *3 from shallow_water_domain_new import * 4 4 from Numeric import zeros, Float 5 5 #from analytic_dam_sudi import AnalyticDam … … 138 138 #pass 139 139 140 from pylab import plot,title,xlabel,ylabel,legend,savefig,show,hold,subplot,ion140 from pylab import clf,plot,title,xlabel,ylabel,legend,savefig,show,hold,subplot,ion 141 141 #print 'Test1' 142 hold(False) 142 #hold(False) 143 clf() 143 144 #print 'test 2' 144 145 plot1 = subplot(211) … … 150 151 xlabel('Position') 151 152 ylabel('Stage') 152 legend( ('Bed Elevation', 'Numerical Solution'), 153 'upper right', shadow=False) 153 #legend( ('Bed Elevation', 'Numerical Solution'), 154 # 'upper right', shadow=False) 155 156 154 157 #legend(('Analytical Solution', 'Numerical Solution'), 155 158 # 'lower right', shadow=False) … … 157 160 plot(X,MomentumQ) 158 161 #plot2.set_ylim([-5,35]) 159 legend( ('Numerical Solution', 'for momentum'),160 'upper right', shadow=False)162 #legend( ('Numerical Solution', 'for momentum'), 163 # 'upper right', shadow=False) 161 164 162 165 xlabel('Position') … … 168 171 #savefig(file) 169 172 show() 170 173 171 174 print 'That took %.2f seconds'%(time.time()-t0) -
anuga_work/development/anuga_1d/test_shallow_water.py
r5727 r5728 5 5 6 6 7 from shallow_water_domain import *8 from shallow_water_domain import flux_function as domain_flux_function9 10 from Numeric import allclose, array, ones, Float 7 from shallow_water_domain_new import * 8 from shallow_water_domain_new import flux_function as domain_flux_function 9 10 from Numeric import allclose, array, ones, Float, maximum 11 11 12 12 … … 15 15 self.points = [0.0, 1.0, 2.0, 3.0] 16 16 self.vertex_values = [[1.0,2.0],[4.0,5.0],[-1.0,2.0]] 17 self.points2 = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] 17 18 18 19 def tearDown(self): … … 123 124 """ 124 125 125 def slope_ one(x):126 return x126 def slope_square(x): 127 return maximum(4.0-(x-5.0)*(x-5.0), 0.0) 127 128 128 domain = Domain(self.points )129 domain.set_quantity('stage', 4.0)130 domain.set_quantity('elevation',slope_ one)129 domain = Domain(self.points2) 130 domain.set_quantity('stage',10.0) 131 domain.set_quantity('elevation',slope_square) 131 132 domain.set_boundary({'exterior' : Reflective_boundary(domain)}) 132 133 133 yieldstep= 0.01134 finaltime= 0.01134 yieldstep=10.0 135 finaltime=10.0 135 136 136 137 for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime): … … 146 147 print domain.quantities['xmomentum'].centroid_values 147 148 148 assert allclose( array([-34.3, -24.5, -14.7], Float), domain.quantities['xmomentum'].explicit_update )149 #assert allclose( array([-34.3, -24.5, -14.7], Float), domain.quantities['xmomentum'].explicit_update ) 149 150 150 151
Note: See TracChangeset
for help on using the changeset viewer.