Changeset 8473
- Timestamp:
- Jul 21, 2012, 5:24:51 PM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/operators/kinematic_viscosity_operator.py
r8469 r8473 9 9 import anuga.utilities.log as log 10 10 11 from anuga.operators. elliptic_operator import Operator11 from anuga.operators.base_operator import Operator 12 12 13 13 -
trunk/anuga_core/source/anuga/operators/test_kinematic_viscosity_operator.py
r8472 r8473 10 10 11 11 class Test_kinematic_viscosity(unittest.TestCase): 12 12 13 def setUp(self): 13 14 pass … … 931 932 932 933 #print w.centroid_values - wc 933 934 934 935 assert num.allclose(w.centroid_values, wc, rtol=1.0e-3) 935 936 … … 960 961 # kill off the wave with viscosity 961 962 kv = Kinematic_viscosity_operator(domain, diffusivity = Q) 962 963 964 # let's make timestep large so that the final solution will look like965 #the solution of hte elliptic problem. In this case u -> 1, v -> 2.966 967 968 for t in domain.evolve(yieldstep = 1.0, finaltime = 10.0):969 #domain.write_time()970 #domain.print_operator_timestepping_statistics()971 pass972 973 #974 w = domain.quantities['stage']975 uh = domain.quantities['xmomentum']976 vh = domain.quantities['ymomentum']977 978 #print 'uh'979 #print uh.centroid_values980 #print uh.boundary_values981 982 #print 'w'983 #print w.centroid_values984 985 from pprint import pprint986 pprint(w.centroid_values)987 988 989 wc = num.array([array([ 0.71624029, 0.71622927, 0.71621675, 0.71623888, 0.71624236,990 0.71624536, 0.71625157, 0.71625028, 0.71625679, 0.71626609,991 0.71630233, 0.71627457, 0.71627721, 0.71628666, 0.71633484,992 0.71629002, 0.71628494, 0.716295 , 0.7163438 , 0.71629656,993 0.71628493, 0.71629656, 0.71634379, 0.71629497, 0.71627716,994 0.71628999, 0.71633481, 0.7162866 , 0.71625666, 0.71627448,995 0.71630224, 0.71626596, 0.71624212, 0.7162501 , 0.7162514 ,996 0.71624512, 0.71624 , 0.7162386 , 0.71621644, 0.71622896,997 0.71619869, 0.71615658, 0.71609423, 0.71619602, 0.71627164,998 0.71623926, 0.71625039, 0.71633719, 0.71638922, 0.71642539,999 0.71652642, 0.71649892, 0.71646671, 0.71653525, 0.71670614,1000 0.71661869, 0.71649067, 0.71663318, 0.71682302, 0.71665878,1001 0.71649066, 0.71665876, 0.71682295, 0.71663309, 0.71646665,1002 0.71661859, 0.71670596, 0.71653511, 0.71638911, 0.71649877,1003 0.71652622, 0.71642523, 0.71627151, 0.716337 , 0.71625001,1004 0.71623888, 0.7161983 , 0.71619554, 0.71609371, 0.71615611,1005 0.71587901, 0.71555375, 0.71521927, 0.71573946, 0.71615663,1006 0.71586493, 0.7156413 , 0.71615004, 0.71653474, 0.71632223,1007 0.71618825, 0.7165586 , 0.7168124 , 0.71668994, 0.71661036,1008 0.7168446 , 0.71694587, 0.71689337, 0.7167922 , 0.71693225,1009 0.71694582, 0.71693224, 0.71679212, 0.71689325, 0.71681216,1010 0.71684437, 0.71661004, 0.71668963, 0.71653449, 0.71655826,1011 0.71618788, 0.71632191, 0.71615622, 0.71614967, 0.71564092,1012 0.71586446, 0.7158785 , 0.71573897, 0.71521879, 0.71555323,1013 0.71415117, 0.71304803, 0.71200401, 0.71333356, 0.71459491,1014 0.71350761, 0.71272705, 0.7140006 , 0.71526042, 0.71418365,1015 0.71337479, 0.7146592 , 0.71582149, 0.71478585, 0.71378284,1016 0.7150456 , 0.71605221, 0.71509271, 0.71396254, 0.71516103,1017 0.71605211, 0.71516102, 0.71396249, 0.71509256, 0.71582115,1018 0.7150454 , 0.71378271, 0.71478555, 0.71526005, 0.71465889,1019 0.71337454, 0.71418329, 0.71459453, 0.71400022, 0.71272682,1020 0.71350725, 0.71415077, 0.71333321, 0.71200389, 0.71304774,1021 0.70944126, 0.70705883, 0.70442227, 0.70714215, 0.70999341,1022 0.70722667, 0.70436187, 0.70745337, 0.71044978, 0.70748596,1023 0.70427781, 0.70768146, 0.71082549, 0.70772906, 0.70426793,1024 0.70786303, 0.71099495, 0.70788365, 0.70424722, 0.70791928,1025 0.71099502, 0.70791937, 0.70424774, 0.70788396, 0.71082556,1026 0.70786332, 0.70426849, 0.70772935, 0.71044982, 0.70768178,1027 0.7042786 , 0.70748637, 0.70999356, 0.70745385, 0.70436311,1028 0.70722738, 0.70944169, 0.70714295, 0.70442389, 0.70705981,1029 0.69895933, 0.69463188, 0.68921358, 0.693824 , 0.698153 ,1030 0.69349963, 0.68725093, 0.69221842, 0.69728195, 0.69180649,1031 0.68463972, 0.69053046, 0.69673179, 0.69018397, 0.68236173,1032 0.68940762, 0.69650961, 0.68925397, 0.68125059, 0.68902719,1033 0.69651034, 0.68902736, 0.6812516 , 0.68925556, 0.69673305,1034 0.6894096 , 0.6823656 , 0.69018707, 0.69728407, 0.69053386,1035 0.68464522, 0.69181074, 0.69815588, 0.69222279, 0.68725717,1036 0.69350432, 0.69896255, 0.69382873, 0.68922015, 0.69463687,1037 0.68375896, 0.6882601 , 0.69595562, 0.68766298, 0.68105558,1038 0.68673658, 0.69502847, 0.68542815, 0.67770965, 0.68435344,1039 0.69409778, 0.68310537, 0.67491515, 0.68222458, 0.69337943,1040 0.68140117, 0.67356609, 0.68097711, 0.69301997, 0.68071631,1041 0.67356716, 0.68071666, 0.69302027, 0.68097852, 0.6749196 ,1042 0.68140363, 0.69338045, 0.68222808, 0.6777162 , 0.68310954,1043 0.69409929, 0.68435822, 0.68106317, 0.68543327, 0.69503026,1044 0.68674199, 0.68376697, 0.68766854, 0.69595754, 0.68826575,1045 0.71760631, 0.75094294, 0.78427898, 0.75094168, 0.71760193,1046 0.75093986, 0.78427453, 0.75093415, 0.71758272, 0.7509278 ,1047 0.78426295, 0.75091754, 0.7175572 , 0.75090919, 0.78424795,1048 0.75089856, 0.71753518, 0.75089163, 0.78423642, 0.75088684,1049 0.71753524, 0.75088686, 0.78423643, 0.75089171, 0.7175573 ,1050 0.75089864, 0.78424798, 0.75090931, 0.71758285, 0.75091768,1051 0.78426303, 0.75092799, 0.7176021 , 0.75093438, 0.78427472,1052 0.75094013, 0.71760652, 0.75094199, 0.78427929, 0.75094328,1053 0.81761649, 0.85095268, 0.88428788, 0.85095192, 0.81761311,1054 0.8509508 , 0.88428574, 0.85094833, 0.81760513, 0.8509458 ,1055 0.88428131, 0.85094197, 0.81759506, 0.85093883, 0.88427596,1056 0.85093514, 0.81758753, 0.85093282, 0.88427212, 0.85093123,1057 0.81758749, 0.8509312 , 0.88427198, 0.85093269, 0.81759494,1058 0.85093494, 0.8842756 , 0.85093857, 0.81760502, 0.8509417 ,1059 0.88428088, 0.85094557, 0.81761314, 0.85094816, 0.88428543,1060 0.85095073, 0.81761667, 0.85095193, 0.88428775, 0.85095275,1061 0.91762366, 0.95095836, 0.98429205, 0.95095804, 0.91762217,1062 0.95095754, 0.98429102, 0.95095658, 0.91761918, 0.95095558,1063 0.98428903, 0.95095416, 0.91761561, 0.95095297, 0.98428667,1064 0.95095164, 0.91761304, 0.95095078, 0.98428497, 0.95095015,1065 0.91761286, 0.95095007, 0.98428475, 0.95095045, 0.9176151 ,1066 0.95095115, 0.98428605, 0.95095231, 0.91761853, 0.95095342,1067 0.9842882 , 0.9509548 , 0.91762161, 0.95095583, 0.98429026,1068 0.95095688, 0.91762327, 0.95095746, 0.98429146, 0.95095784])1069 1070 1071 1072 #print w.centroid_values - wc1073 1074 assert num.allclose(w.centroid_values, wc, rtol=1.0e-3)1075 1076 1077 def test_kinematic_operator_number(self):1078 1079 from anuga import rectangular_cross_domain1080 from anuga import Reflective_boundary1081 1082 m1 = 101083 n1 = 101084 domain = rectangular_cross_domain(m1,n1)1085 1086 #domain.set_flow_algorithm('2_0')1087 1088 #1089 domain.set_quantity('elevation', expression='x')1090 domain.set_quantity('friction', 0.03)1091 domain.set_quantity('stage',expression='elevation + 2*(x-0.5)')1092 domain.set_quantity('xmomentum', expression='2*x+3*y')1093 domain.set_quantity('ymomentum', expression='5*x+7*y')1094 1095 B = Reflective_boundary(domain)1096 domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B})1097 1098 # kill off the wave with viscosity1099 kv = Kinematic_viscosity_operator(domain, diffusivity=2.0)1100 963 1101 964 … … 1207 1070 0.95095688, 0.91762327, 0.95095746, 0.98429146, 0.95095784]) 1208 1071 1209 1072 assert num.allclose(w.centroid_values, wc, rtol=1.0e-3) 1073 1074 def test_kinematic_operator_number(self): 1075 1076 from anuga import rectangular_cross_domain 1077 from anuga import Reflective_boundary 1078 1079 m1 = 10 1080 n1 = 10 1081 domain = rectangular_cross_domain(m1,n1) 1082 1083 #domain.set_flow_algorithm('2_0') 1084 1085 # 1086 domain.set_quantity('elevation', expression='x') 1087 domain.set_quantity('friction', 0.03) 1088 domain.set_quantity('stage',expression='elevation + 2*(x-0.5)') 1089 domain.set_quantity('xmomentum', expression='2*x+3*y') 1090 domain.set_quantity('ymomentum', expression='5*x+7*y') 1091 1092 B = Reflective_boundary(domain) 1093 domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B}) 1094 1095 # kill off the wave with viscosity 1096 kv = Kinematic_viscosity_operator(domain, diffusivity=2.0) 1097 1098 1099 # let's make timestep large so that the final solution will look like 1100 #the solution of hte elliptic problem. In this case u -> 1, v -> 2. 1101 1102 1103 for t in domain.evolve(yieldstep = 1.0, finaltime = 10.0): 1104 #domain.write_time() 1105 #domain.print_operator_timestepping_statistics() 1106 pass 1107 1108 # 1109 w = domain.quantities['stage'] 1110 uh = domain.quantities['xmomentum'] 1111 vh = domain.quantities['ymomentum'] 1112 1113 #print 'uh' 1114 #print uh.centroid_values 1115 #print uh.boundary_values 1116 1117 #print 'w' 1118 #print w.centroid_values 1119 1120 #from pprint import pprint 1121 #pprint(w.centroid_values) 1122 1123 1124 wc = num.array([ 1125 0.71624029, 0.71622927, 0.71621675, 0.71623888, 0.71624236, 1126 0.71624536, 0.71625157, 0.71625028, 0.71625679, 0.71626609, 1127 0.71630233, 0.71627457, 0.71627721, 0.71628666, 0.71633484, 1128 0.71629002, 0.71628494, 0.716295 , 0.7163438 , 0.71629656, 1129 0.71628493, 0.71629656, 0.71634379, 0.71629497, 0.71627716, 1130 0.71628999, 0.71633481, 0.7162866 , 0.71625666, 0.71627448, 1131 0.71630224, 0.71626596, 0.71624212, 0.7162501 , 0.7162514 , 1132 0.71624512, 0.71624 , 0.7162386 , 0.71621644, 0.71622896, 1133 0.71619869, 0.71615658, 0.71609423, 0.71619602, 0.71627164, 1134 0.71623926, 0.71625039, 0.71633719, 0.71638922, 0.71642539, 1135 0.71652642, 0.71649892, 0.71646671, 0.71653525, 0.71670614, 1136 0.71661869, 0.71649067, 0.71663318, 0.71682302, 0.71665878, 1137 0.71649066, 0.71665876, 0.71682295, 0.71663309, 0.71646665, 1138 0.71661859, 0.71670596, 0.71653511, 0.71638911, 0.71649877, 1139 0.71652622, 0.71642523, 0.71627151, 0.716337 , 0.71625001, 1140 0.71623888, 0.7161983 , 0.71619554, 0.71609371, 0.71615611, 1141 0.71587901, 0.71555375, 0.71521927, 0.71573946, 0.71615663, 1142 0.71586493, 0.7156413 , 0.71615004, 0.71653474, 0.71632223, 1143 0.71618825, 0.7165586 , 0.7168124 , 0.71668994, 0.71661036, 1144 0.7168446 , 0.71694587, 0.71689337, 0.7167922 , 0.71693225, 1145 0.71694582, 0.71693224, 0.71679212, 0.71689325, 0.71681216, 1146 0.71684437, 0.71661004, 0.71668963, 0.71653449, 0.71655826, 1147 0.71618788, 0.71632191, 0.71615622, 0.71614967, 0.71564092, 1148 0.71586446, 0.7158785 , 0.71573897, 0.71521879, 0.71555323, 1149 0.71415117, 0.71304803, 0.71200401, 0.71333356, 0.71459491, 1150 0.71350761, 0.71272705, 0.7140006 , 0.71526042, 0.71418365, 1151 0.71337479, 0.7146592 , 0.71582149, 0.71478585, 0.71378284, 1152 0.7150456 , 0.71605221, 0.71509271, 0.71396254, 0.71516103, 1153 0.71605211, 0.71516102, 0.71396249, 0.71509256, 0.71582115, 1154 0.7150454 , 0.71378271, 0.71478555, 0.71526005, 0.71465889, 1155 0.71337454, 0.71418329, 0.71459453, 0.71400022, 0.71272682, 1156 0.71350725, 0.71415077, 0.71333321, 0.71200389, 0.71304774, 1157 0.70944126, 0.70705883, 0.70442227, 0.70714215, 0.70999341, 1158 0.70722667, 0.70436187, 0.70745337, 0.71044978, 0.70748596, 1159 0.70427781, 0.70768146, 0.71082549, 0.70772906, 0.70426793, 1160 0.70786303, 0.71099495, 0.70788365, 0.70424722, 0.70791928, 1161 0.71099502, 0.70791937, 0.70424774, 0.70788396, 0.71082556, 1162 0.70786332, 0.70426849, 0.70772935, 0.71044982, 0.70768178, 1163 0.7042786 , 0.70748637, 0.70999356, 0.70745385, 0.70436311, 1164 0.70722738, 0.70944169, 0.70714295, 0.70442389, 0.70705981, 1165 0.69895933, 0.69463188, 0.68921358, 0.693824 , 0.698153 , 1166 0.69349963, 0.68725093, 0.69221842, 0.69728195, 0.69180649, 1167 0.68463972, 0.69053046, 0.69673179, 0.69018397, 0.68236173, 1168 0.68940762, 0.69650961, 0.68925397, 0.68125059, 0.68902719, 1169 0.69651034, 0.68902736, 0.6812516 , 0.68925556, 0.69673305, 1170 0.6894096 , 0.6823656 , 0.69018707, 0.69728407, 0.69053386, 1171 0.68464522, 0.69181074, 0.69815588, 0.69222279, 0.68725717, 1172 0.69350432, 0.69896255, 0.69382873, 0.68922015, 0.69463687, 1173 0.68375896, 0.6882601 , 0.69595562, 0.68766298, 0.68105558, 1174 0.68673658, 0.69502847, 0.68542815, 0.67770965, 0.68435344, 1175 0.69409778, 0.68310537, 0.67491515, 0.68222458, 0.69337943, 1176 0.68140117, 0.67356609, 0.68097711, 0.69301997, 0.68071631, 1177 0.67356716, 0.68071666, 0.69302027, 0.68097852, 0.6749196 , 1178 0.68140363, 0.69338045, 0.68222808, 0.6777162 , 0.68310954, 1179 0.69409929, 0.68435822, 0.68106317, 0.68543327, 0.69503026, 1180 0.68674199, 0.68376697, 0.68766854, 0.69595754, 0.68826575, 1181 0.71760631, 0.75094294, 0.78427898, 0.75094168, 0.71760193, 1182 0.75093986, 0.78427453, 0.75093415, 0.71758272, 0.7509278 , 1183 0.78426295, 0.75091754, 0.7175572 , 0.75090919, 0.78424795, 1184 0.75089856, 0.71753518, 0.75089163, 0.78423642, 0.75088684, 1185 0.71753524, 0.75088686, 0.78423643, 0.75089171, 0.7175573 , 1186 0.75089864, 0.78424798, 0.75090931, 0.71758285, 0.75091768, 1187 0.78426303, 0.75092799, 0.7176021 , 0.75093438, 0.78427472, 1188 0.75094013, 0.71760652, 0.75094199, 0.78427929, 0.75094328, 1189 0.81761649, 0.85095268, 0.88428788, 0.85095192, 0.81761311, 1190 0.8509508 , 0.88428574, 0.85094833, 0.81760513, 0.8509458 , 1191 0.88428131, 0.85094197, 0.81759506, 0.85093883, 0.88427596, 1192 0.85093514, 0.81758753, 0.85093282, 0.88427212, 0.85093123, 1193 0.81758749, 0.8509312 , 0.88427198, 0.85093269, 0.81759494, 1194 0.85093494, 0.8842756 , 0.85093857, 0.81760502, 0.8509417 , 1195 0.88428088, 0.85094557, 0.81761314, 0.85094816, 0.88428543, 1196 0.85095073, 0.81761667, 0.85095193, 0.88428775, 0.85095275, 1197 0.91762366, 0.95095836, 0.98429205, 0.95095804, 0.91762217, 1198 0.95095754, 0.98429102, 0.95095658, 0.91761918, 0.95095558, 1199 0.98428903, 0.95095416, 0.91761561, 0.95095297, 0.98428667, 1200 0.95095164, 0.91761304, 0.95095078, 0.98428497, 0.95095015, 1201 0.91761286, 0.95095007, 0.98428475, 0.95095045, 0.9176151 , 1202 0.95095115, 0.98428605, 0.95095231, 0.91761853, 0.95095342, 1203 0.9842882 , 0.9509548 , 0.91762161, 0.95095583, 0.98429026, 1204 0.95095688, 0.91762327, 0.95095746, 0.98429146, 0.95095784]) 1205 1206 1210 1207 1211 1208 -
trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r8472 r8473 833 833 # Calc pressure terms using Simpson rule in flux 834 834 # computations. Then they match up exactly with 835 # standard gravity term 835 # standard gravity term - g h grad(z) 836 836 from shallow_water_ext import compute_fluxes_ext_wb 837 837 from shallow_water_ext import gravity as gravity_c
Note: See TracChangeset
for help on using the changeset viewer.