Changeset 4553
 Timestamp:
 Jun 21, 2007, 11:57:19 AM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r4551 r4553 1105 1105 domain.set_quantities_to_be_stored(None) 1106 1106 domain.set_maximum_allowed_speed(100) # 1107 1108 1109 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 1107 1108 # FIXME (Ole): Need tests where this is commented out 1109 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 1110 1110 domain.H0 = 0 # Backwards compatibility (6/2/7) 1111 1111 domain.beta_h = 0.2 # Backwards compatibility (14/2/7) … … 1231 1231 domain.set_quantity('stage', stage) 1232 1232 1233 # Allow slope limiters to work (FIXME (Ole): Shouldn't this be automatic in ANUGA?) 1234 domain.distribute_to_vertices_and_edges() 1233 # Allow slope limiters to work (FIXME (Ole): Shouldn't this be automatic in ANUGA?) 1234 domain.distribute_to_vertices_and_edges() 1235 1235 1236 1236 initial_stage = copy.copy(domain.quantities['stage'].vertex_values) … … 2013 2013 L = domain.quantities['stage'].vertex_values 2014 2014 2015 2016 2017 2018 2019 assert allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 2020 2021 2022 2023 2024 2015 # Get reference values 2016 volumes = [] 2017 for i in range(len(L)): 2018 volumes.append(sum(L[i])/3) 2019 assert allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 2020 2021 2022 domain._order_ = 1 2023 2024 domain.limit2007 = 0 2025 2025 domain.distribute_to_vertices_and_edges() 2026 2026 assert allclose(L[1], [0.1, 20.1, 20.1]) 2027 2028 assert allclose(volumes[i], sum(L[i])/3) 2029 2030 2027 for i in range(len(L)): 2028 assert allclose(volumes[i], sum(L[i])/3) 2029 2030 domain.limit2007 = 1 # Allow triangle to be flatter (closer to bed) 2031 2031 domain.distribute_to_vertices_and_edges() 2032 2032 assert allclose(L[1], [0.298, 20.001, 20.001]) 2033 2034 assert allclose(volumes[i], sum(L[i])/3) 2033 for i in range(len(L)): 2034 assert allclose(volumes[i], sum(L[i])/3) 2035 2035 2036 2036 domain._order_ = 2 2037 2038 2037 2038 domain.limit2007 = 0 2039 2039 domain.distribute_to_vertices_and_edges() 2040 assert allclose(L[1], [0.1, 20.1, 20.1]) 2041 2042 assert allclose(volumes[i], sum(L[i])/3) 2043 2044 2040 assert allclose(L[1], [0.1, 20.1, 20.1]) 2041 for i in range(len(L)): 2042 assert allclose(volumes[i], sum(L[i])/3) 2043 2044 domain.limit2007 = 1 # Allow triangle to be flatter (closer to bed) 2045 2045 domain.distribute_to_vertices_and_edges() 2046 2046 assert allclose(L[1], [0.298, 20.001, 20.001]) 2047 2048 assert allclose(volumes[i], sum(L[i])/3) 2049 2047 for i in range(len(L)): 2048 assert allclose(volumes[i], sum(L[i])/3) 2049 2050 2050 2051 2051 … … 2084 2084 2085 2085 # Get reference values 2086 2087 2088 2089 assert allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 2090 2086 volumes = [] 2087 for i in range(len(L)): 2088 volumes.append(sum(L[i])/3) 2089 assert allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 2090 2091 2091 #print E 2092 2092 domain._order_ = 1 2093 2094 2093 2094 domain.limit2007 = 0 2095 2095 domain.distribute_to_vertices_and_edges() 2096 assert allclose(L[1], [4.1, 16.1, 20.1]) 2097 2096 assert allclose(L[1], [4.1, 16.1, 20.1]) 2097 for i in range(len(L)): 2098 2098 assert allclose(volumes[i], sum(L[i])/3) 2099 2100 2101 2099 2100 2101 domain.limit2007 = 1 # Allow triangle to be flatter (closer to bed) 2102 2102 domain.distribute_to_vertices_and_edges() 2103 2103 assert allclose(L[1], [4.2386, 16.0604, 20.001]) 2104 2105 assert allclose(volumes[i], sum(L[i])/3) 2106 2104 for i in range(len(L)): 2105 assert allclose(volumes[i], sum(L[i])/3) 2106 2107 2107 2108 2108 domain._order_ = 2 2109 2110 domain.limit2007 = 0 2109 2110 domain.limit2007 = 0 2111 2111 domain.distribute_to_vertices_and_edges() 2112 2112 assert allclose(L[1], [4.1, 16.1, 20.1]) 2113 2114 assert allclose(volumes[i], sum(L[i])/3) 2115 2116 2113 for i in range(len(L)): 2114 assert allclose(volumes[i], sum(L[i])/3) 2115 2116 domain.limit2007 = 1 # Allow triangle to be flatter (closer to bed) 2117 2117 domain.distribute_to_vertices_and_edges() 2118 2118 assert allclose(L[1], [4.23370103, 16.06529897, 20.001]) 2119 2119 for i in range(len(L)): 2120 2120 assert allclose(volumes[i], sum(L[i])/3) 2121 2121 … … 2170 2170 domain.beta_vh_dry = 0.9 2171 2171 domain.beta_h = 0.0 #Use first order in hlimiter 2172 2173 2174 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 2175 2176 2172 2173 # FIXME (Ole): Need tests where this is commented out 2174 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 2175 2176 2177 2177 domain.distribute_to_vertices_and_edges() 2178 2178 … … 2258 2258 2259 2259 #Also check that Python and C version produce the same 2260 2261 2260 # No longer applicable if limit2007 == 1 2261 #print stage.vertex_values 2262 2262 #assert allclose (stage.vertex_values, 2263 2263 # [[2,2,2], … … 3091 3091 3092 3092 # FIXME (Ole): Need some other assertion here! 3093 3093 #print domain.min_timestep, domain.max_timestep 3094 3094 #assert allclose(domain.min_timestep, 0.050010003001) 3095 3095 #assert allclose(domain.max_timestep, 0.050010003001) … … 3111 3111 domain.default_order = 1 3112 3112 domain.beta_h = 0.0 # Use first order in hlimiter 3113 3114 3113 3114 # FIXME (Ole): Need tests where these two are commented out 3115 3115 domain.H0 = 0 # Backwards compatibility (6/2/7) 3116 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3116 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3117 3117 3118 3118 #Bedslope and friction … … 3184 3184 domain.beta_vh_dry = 0.9 3185 3185 3186 3187 3188 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3189 3186 3187 # FIXME (Ole): Need tests where this is commented out 3188 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3189 3190 3190 #Bedslope and friction at vertices (and interpolated elsewhere) 3191 3191 def x_slope(x, y): … … 3280 3280 domain.beta_vh_dry = 0.9 3281 3281 domain.beta_h = 0.0 #Use first order in hlimiter 3282 3283 3284 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3282 3283 # FIXME (Ole): Need tests where this is commented out 3284 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3285 3285 domain.H0 = 0 # Backwards compatibility (6/2/7) 3286 3286 … … 3382 3382 domain.beta_vh_dry = 0.9 3383 3383 domain.beta_h = 0.0 #Use first order in hlimiter 3384 3385 3386 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3384 3385 # FIXME (Ole): Need tests where this is commented out 3386 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3387 3387 domain.H0 = 0 # Backwards compatibility (6/2/7) 3388 3388 … … 3480 3480 domain.beta_vh_dry = 0.9 3481 3481 domain.beta_h = 0.0 #Use first order in hlimiter 3482 3483 3484 3482 3483 3484 # FIXME (Ole): Need tests where these two are commented out 3485 3485 domain.H0 = 0 # Backwards compatibility (6/2/7) 3486 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3487 3488 3486 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3487 3488 3489 3489 3490 3490 #Bedslope and friction at vertices (and interpolated elsewhere) … … 3595 3595 3596 3596 Test shallow water finite volumes, using parameters from 3597 3597 feb 2007 rather than backward compatibility ad infinitum 3598 3598 3599 3599 """ … … 3616 3616 domain.beta_h = 0.0 #Use first order in hlimiter 3617 3617 domain.H0 = 0.001 3618 3618 domain.limit2007 = 1 3619 3619 3620 3620 #Bedslope and friction at vertices (and interpolated elsewhere) … … 3668 3668 3669 3669 3670 3670 3671 3671 assert allclose(domain.quantities['stage'].centroid_values, 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3672 [0.03348416, 0.01749303, 0.03299091, 0.01739241, 0.03246447, 0.01732016, 3673 0.03205390, 0.01717833, 0.03146383, 0.01699831, 0.03076577, 0.01671795, 3674 0.07952656, 0.06684763, 0.07721455, 0.06668388, 0.07632976, 0.06600113, 3675 0.07523678, 0.06546373, 0.07447040, 0.06508861, 0.07438723, 0.06359288, 3676 0.12526729, 0.11205668, 0.12179433, 0.11068104, 0.12048395, 0.10968948, 3677 0.11912023, 0.10862628, 0.11784090, 0.10803744, 0.11790629, 0.10742354, 3678 0.16859613, 0.15427413, 0.16664444, 0.15464452, 0.16570816, 0.15327556, 3679 0.16409162, 0.15204092, 0.16264608, 0.15102139, 0.16162736, 0.14969205, 3680 0.18736511, 0.19874036, 0.18811230, 0.19758289, 0.18590182, 0.19580301, 3681 0.18234588, 0.19423215, 0.18100376, 0.19380116, 0.18509710, 0.19501636, 3682 0.13982382, 0.14166819, 0.14132775, 0.14528694, 0.14096905, 0.14351126, 3683 0.13800356, 0.14027920, 0.13613538, 0.13936795, 0.13621902, 0.14204982]) 3684 3684 3685 3685 … … 3741 3741 domain.beta_vh_dry = 0.9 3742 3742 domain.beta_h = 0.0 #Use first order in hlimiter 3743 3744 3743 3744 # FIXME (Ole): Need tests where these two are commented out 3745 3745 domain.H0 = 0 # Backwards compatibility (6/2/7) 3746 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3746 domain.limit2007 = 0 # Backwards compatibility (14/4/7) 3747 3747 3748 3748 … … 4383 4383 4384 4384 4385 domain.distribute_to_vertices_and_edges() 4385 domain.distribute_to_vertices_and_edges() 4386 4386 4387 4387 … … 4400 4400 for t in domain.evolve(yieldstep = 0.1, finaltime = 0.3): 4401 4401 4402 4402 #domain.write_time(track_speeds=True) 4403 4403 stage = domain.quantities['stage'].vertex_values 4404 4404
Note: See TracChangeset
for help on using the changeset viewer.