Changeset 5731 for anuga_work/development/anuga_1d/test_shallow_water.py
- Timestamp:
- Sep 4, 2008, 8:28:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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-(x-5.0)*(x-5.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-(x-5.0)*(x-5.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.