Changeset 8472
- Timestamp:
- Jul 20, 2012, 7:49:44 PM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/operators/run_set_stage.py
r8455 r8472 41 41 # Setup initial conditions 42 42 #------------------------------------------------------------------------------ 43 h0 = 100 .043 h0 = 1000.0 44 44 45 45 domain.set_quantity('elevation',0.0) -
trunk/anuga_core/source/anuga/operators/test_kinematic_viscosity_operator.py
r8471 r8472 806 806 domain = rectangular_cross_domain(m1,n1) 807 807 808 domain.set_flow_algorithm('2_0')808 #domain.set_flow_algorithm('2_0') 809 809 810 810 # … … 818 818 domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B}) 819 819 820 # kill off the wave with viscosity 820 821 kv = Kinematic_viscosity_operator(domain) 821 822 … … 826 827 827 828 for t in domain.evolve(yieldstep = 1.0, finaltime = 10.0): 828 domain.write_time() 829 domain.print_operator_timestepping_statistics() 830 831 # dt = 1000.0 832 # kv.dt = dt 833 # n = kv.n 834 # nt = kv.tot_len 829 #domain.write_time() 830 #domain.print_operator_timestepping_statistics() 831 pass 832 835 833 # 836 # kv.update_elliptic_matrix(h) 834 w = domain.quantities['stage'] 835 uh = domain.quantities['xmomentum'] 836 vh = domain.quantities['ymomentum'] 837 838 #print 'uh' 839 #print uh.centroid_values 840 #print uh.boundary_values 841 842 #print 'w' 843 #print w.centroid_values 844 845 #from pprint import pprint 846 #pprint(w.centroid_values) 847 848 849 wc = num.array([ 850 0.70714365, 0.70714416, 0.70714295, 0.70714222, 0.70714486, 851 0.70714507, 0.70714374, 0.70714601, 0.70714492, 0.70714425, 852 0.70714595, 0.70714437, 0.70714797, 0.70714691, 0.70714697, 853 0.70714845, 0.70714793, 0.70714793, 0.70715033, 0.70714852, 854 0.70715244, 0.70715018, 0.70715176, 0.70715224, 0.70715211, 855 0.70715265, 0.70715351, 0.7071531 , 0.70715433, 0.70715309, 856 0.70715351, 0.70715472, 0.70715429, 0.70715433, 0.70715487, 857 0.70715523, 0.7071545 , 0.70715446, 0.70715317, 0.70715564, 858 0.70714142, 0.70714198, 0.70714079, 0.70714299, 0.70714482, 859 0.70714378, 0.70714344, 0.70714377, 0.7071443 , 0.70714533, 860 0.70714579, 0.70714574, 0.70714906, 0.70714717, 0.70714819, 861 0.70714822, 0.70714976, 0.70714952, 0.70715093, 0.70715077, 862 0.70715217, 0.70715094, 0.70715291, 0.70715188, 0.70715352, 863 0.70715278, 0.707154 , 0.70715429, 0.70715376, 0.70715309, 864 0.70715446, 0.70715422, 0.70715366, 0.70715453, 0.70715413, 865 0.70715539, 0.70715385, 0.70715412, 0.70715154, 0.70715306, 866 0.70714038, 0.70713905, 0.7071358 , 0.70713972, 0.70714303, 867 0.7071419 , 0.70714066, 0.70714219, 0.7071459 , 0.70714505, 868 0.70714639, 0.70714648, 0.70714833, 0.70714827, 0.70715147, 869 0.70715013, 0.70715194, 0.70715133, 0.70715542, 0.70715345, 870 0.70715296, 0.70715417, 0.70715676, 0.70715521, 0.70715526, 871 0.7071548 , 0.70715717, 0.70715512, 0.70715381, 0.70715523, 872 0.70715556, 0.70715486, 0.70715482, 0.70715338, 0.70715307, 873 0.70715381, 0.70715132, 0.70715182, 0.70714789, 0.70715086, 874 0.70713443, 0.70713559, 0.70713539, 0.70713615, 0.70714057, 875 0.70713978, 0.70714091, 0.70714102, 0.70714618, 0.70714338, 876 0.70714803, 0.70714858, 0.7071519 , 0.70715029, 0.70715343, 877 0.70715461, 0.70715589, 0.70715519, 0.7071565 , 0.70715796, 878 0.70715738, 0.70715845, 0.7071601 , 0.70715829, 0.70715711, 879 0.70715903, 0.70716011, 0.70715714, 0.7071565 , 0.70715756, 880 0.70715885, 0.7071556 , 0.70715386, 0.70715406, 0.70715653, 881 0.70715532, 0.70714813, 0.7071515 , 0.70715242, 0.70715269, 882 0.70713191, 0.70712961, 0.70712505, 0.70712841, 0.70714097, 883 0.70713808, 0.70713862, 0.7071431 , 0.70714966, 0.7071463 , 884 0.70715775, 0.70715666, 0.70715566, 0.7071554 , 0.7071632 , 885 0.70716353, 0.70715928, 0.70716244, 0.70716736, 0.70716495, 886 0.70716301, 0.70716635, 0.70717088, 0.70716792, 0.70716369, 887 0.70717007, 0.7071741 , 0.70716769, 0.70716166, 0.70716991, 888 0.70717294, 0.70716167, 0.70715775, 0.70716057, 0.70715687, 889 0.70715535, 0.70715014, 0.70714766, 0.70714559, 0.70714992, 890 0.7071149 , 0.70708741, 0.706984 , 0.70711096, 0.70714367, 891 0.70714831, 0.70713519, 0.7071811 , 0.70716622, 0.70716603, 892 0.70714155, 0.7071748 , 0.70716885, 0.70716897, 0.70713548, 893 0.70716966, 0.70716924, 0.70716978, 0.70713561, 0.7071717 , 894 0.70717389, 0.7071726 , 0.70713926, 0.70717593, 0.70718002, 895 0.70717761, 0.70714428, 0.70718053, 0.70718062, 0.70718719, 896 0.70715731, 0.70718271, 0.70716238, 0.7071992 , 0.70715496, 897 0.70716834, 0.70713531, 0.70713099, 0.70700665, 0.7071098 , 898 0.70634397, 0.70524618, 0.70297607, 0.70514658, 0.70658259, 899 0.70506628, 0.70244401, 0.70497884, 0.70657086, 0.70498266, 900 0.70239779, 0.70496243, 0.7065572 , 0.7049646 , 0.70239608, 901 0.70496008, 0.70655538, 0.70496125, 0.70239685, 0.70496177, 902 0.70655883, 0.70496295, 0.70239957, 0.70496624, 0.70656625, 903 0.70496724, 0.70240482, 0.7049756 , 0.70658803, 0.70497608, 904 0.70241139, 0.70500006, 0.70660425, 0.70499778, 0.70246225, 905 0.70508764, 0.70636798, 0.70516922, 0.70299639, 0.70526838, 906 0.71780931, 0.7506157 , 0.78399529, 0.75061024, 0.71769206, 907 0.75059929, 0.78398287, 0.75059279, 0.71768281, 0.75059112, 908 0.78397863, 0.75059025, 0.71768261, 0.75058996, 0.78397777, 909 0.75058981, 0.71768268, 0.75058969, 0.78397749, 0.75058967, 910 0.7176832 , 0.75058972, 0.78397772, 0.75058986, 0.71768421, 911 0.7505901 , 0.78397859, 0.75059043, 0.71768534, 0.7505909 , 912 0.78398028, 0.750592 , 0.71769545, 0.75059388, 0.78398545, 913 0.75060056, 0.71781337, 0.75061163, 0.78399848, 0.75061714, 914 0.81739069, 0.85076296, 0.8841241 , 0.85076174, 0.81738381, 915 0.85075988, 0.88412183, 0.85075808, 0.81738087, 0.85075718, 916 0.88412031, 0.85075635, 0.81737996, 0.85075599, 0.88411952, 917 0.85075563, 0.81737963, 0.85075548, 0.88411919, 0.8507555 , 918 0.81738003, 0.85075569, 0.88411972, 0.85075629, 0.81738134, 919 0.85075692, 0.88412133, 0.85075812, 0.81738361, 0.85075914, 920 0.88412387, 0.85076103, 0.81738807, 0.85076269, 0.88412739, 921 0.85076547, 0.81739598, 0.85076786, 0.88413107, 0.85076949, 922 0.91748914, 0.95083916, 0.98417801, 0.95083906, 0.91748809, 923 0.95083882, 0.98417779, 0.95083863, 0.91748731, 0.95083843, 924 0.98417752, 0.9508382 , 0.91748674, 0.950838 , 0.9841771 , 925 0.95083776, 0.91748646, 0.95083764, 0.98417686, 0.95083771, 926 0.91748702, 0.95083794, 0.98417744, 0.95083859, 0.91748864, 927 0.95083927, 0.98417906, 0.95084046, 0.91749107, 0.95084145, 928 0.98418138, 0.95084291, 0.91749397, 0.95084401, 0.98418384, 929 0.95084538, 0.91749653, 0.95084626, 0.98418563, 0.95084686]) 930 931 932 #print w.centroid_values - wc 933 934 assert num.allclose(w.centroid_values, wc, rtol=1.0e-3) 935 936 def test_kinematic_operator_quantity(self): 937 938 from anuga import rectangular_cross_domain 939 from anuga import Reflective_boundary 940 941 m1 = 10 942 n1 = 10 943 domain = rectangular_cross_domain(m1,n1) 944 945 #domain.set_flow_algorithm('2_0') 946 947 # 948 domain.set_quantity('elevation', expression='x') 949 domain.set_quantity('friction', 0.03) 950 domain.set_quantity('stage',expression='elevation + 2*(x-0.5)') 951 domain.set_quantity('xmomentum', expression='2*x+3*y') 952 domain.set_quantity('ymomentum', expression='5*x+7*y') 953 954 B = Reflective_boundary(domain) 955 domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B}) 956 957 958 Q = Quantity(domain) 959 Q = 2.0 960 # kill off the wave with viscosity 961 kv = Kinematic_viscosity_operator(domain, diffusivity = Q) 962 963 964 # let's make timestep large so that the final solution will look like 965 #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 pass 972 837 973 # 838 # kv.parabolic_solve(u, u, h, u_out=u, update_matrix=False, iprint=1) 974 w = domain.quantities['stage'] 975 uh = domain.quantities['xmomentum'] 976 vh = domain.quantities['ymomentum'] 977 978 #print 'uh' 979 #print uh.centroid_values 980 #print uh.boundary_values 981 982 #print 'w' 983 #print w.centroid_values 984 985 from pprint import pprint 986 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 - wc 1073 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_domain 1080 from anuga import Reflective_boundary 1081 1082 m1 = 10 1083 n1 = 10 1084 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 viscosity 1099 kv = Kinematic_viscosity_operator(domain, diffusivity=2.0) 1100 1101 1102 # let's make timestep large so that the final solution will look like 1103 #the solution of hte elliptic problem. In this case u -> 1, v -> 2. 1104 1105 1106 for t in domain.evolve(yieldstep = 1.0, finaltime = 10.0): 1107 #domain.write_time() 1108 #domain.print_operator_timestepping_statistics() 1109 pass 1110 839 1111 # 840 # kv.parabolic_solve(v, v, h, u_out=v, update_matrix=False, iprint=1) 1112 w = domain.quantities['stage'] 1113 uh = domain.quantities['xmomentum'] 1114 vh = domain.quantities['ymomentum'] 1115 1116 #print 'uh' 1117 #print uh.centroid_values 1118 #print uh.boundary_values 1119 1120 #print 'w' 1121 #print w.centroid_values 1122 1123 #from pprint import pprint 1124 #pprint(w.centroid_values) 1125 1126 1127 wc = num.array([ 1128 0.71624029, 0.71622927, 0.71621675, 0.71623888, 0.71624236, 1129 0.71624536, 0.71625157, 0.71625028, 0.71625679, 0.71626609, 1130 0.71630233, 0.71627457, 0.71627721, 0.71628666, 0.71633484, 1131 0.71629002, 0.71628494, 0.716295 , 0.7163438 , 0.71629656, 1132 0.71628493, 0.71629656, 0.71634379, 0.71629497, 0.71627716, 1133 0.71628999, 0.71633481, 0.7162866 , 0.71625666, 0.71627448, 1134 0.71630224, 0.71626596, 0.71624212, 0.7162501 , 0.7162514 , 1135 0.71624512, 0.71624 , 0.7162386 , 0.71621644, 0.71622896, 1136 0.71619869, 0.71615658, 0.71609423, 0.71619602, 0.71627164, 1137 0.71623926, 0.71625039, 0.71633719, 0.71638922, 0.71642539, 1138 0.71652642, 0.71649892, 0.71646671, 0.71653525, 0.71670614, 1139 0.71661869, 0.71649067, 0.71663318, 0.71682302, 0.71665878, 1140 0.71649066, 0.71665876, 0.71682295, 0.71663309, 0.71646665, 1141 0.71661859, 0.71670596, 0.71653511, 0.71638911, 0.71649877, 1142 0.71652622, 0.71642523, 0.71627151, 0.716337 , 0.71625001, 1143 0.71623888, 0.7161983 , 0.71619554, 0.71609371, 0.71615611, 1144 0.71587901, 0.71555375, 0.71521927, 0.71573946, 0.71615663, 1145 0.71586493, 0.7156413 , 0.71615004, 0.71653474, 0.71632223, 1146 0.71618825, 0.7165586 , 0.7168124 , 0.71668994, 0.71661036, 1147 0.7168446 , 0.71694587, 0.71689337, 0.7167922 , 0.71693225, 1148 0.71694582, 0.71693224, 0.71679212, 0.71689325, 0.71681216, 1149 0.71684437, 0.71661004, 0.71668963, 0.71653449, 0.71655826, 1150 0.71618788, 0.71632191, 0.71615622, 0.71614967, 0.71564092, 1151 0.71586446, 0.7158785 , 0.71573897, 0.71521879, 0.71555323, 1152 0.71415117, 0.71304803, 0.71200401, 0.71333356, 0.71459491, 1153 0.71350761, 0.71272705, 0.7140006 , 0.71526042, 0.71418365, 1154 0.71337479, 0.7146592 , 0.71582149, 0.71478585, 0.71378284, 1155 0.7150456 , 0.71605221, 0.71509271, 0.71396254, 0.71516103, 1156 0.71605211, 0.71516102, 0.71396249, 0.71509256, 0.71582115, 1157 0.7150454 , 0.71378271, 0.71478555, 0.71526005, 0.71465889, 1158 0.71337454, 0.71418329, 0.71459453, 0.71400022, 0.71272682, 1159 0.71350725, 0.71415077, 0.71333321, 0.71200389, 0.71304774, 1160 0.70944126, 0.70705883, 0.70442227, 0.70714215, 0.70999341, 1161 0.70722667, 0.70436187, 0.70745337, 0.71044978, 0.70748596, 1162 0.70427781, 0.70768146, 0.71082549, 0.70772906, 0.70426793, 1163 0.70786303, 0.71099495, 0.70788365, 0.70424722, 0.70791928, 1164 0.71099502, 0.70791937, 0.70424774, 0.70788396, 0.71082556, 1165 0.70786332, 0.70426849, 0.70772935, 0.71044982, 0.70768178, 1166 0.7042786 , 0.70748637, 0.70999356, 0.70745385, 0.70436311, 1167 0.70722738, 0.70944169, 0.70714295, 0.70442389, 0.70705981, 1168 0.69895933, 0.69463188, 0.68921358, 0.693824 , 0.698153 , 1169 0.69349963, 0.68725093, 0.69221842, 0.69728195, 0.69180649, 1170 0.68463972, 0.69053046, 0.69673179, 0.69018397, 0.68236173, 1171 0.68940762, 0.69650961, 0.68925397, 0.68125059, 0.68902719, 1172 0.69651034, 0.68902736, 0.6812516 , 0.68925556, 0.69673305, 1173 0.6894096 , 0.6823656 , 0.69018707, 0.69728407, 0.69053386, 1174 0.68464522, 0.69181074, 0.69815588, 0.69222279, 0.68725717, 1175 0.69350432, 0.69896255, 0.69382873, 0.68922015, 0.69463687, 1176 0.68375896, 0.6882601 , 0.69595562, 0.68766298, 0.68105558, 1177 0.68673658, 0.69502847, 0.68542815, 0.67770965, 0.68435344, 1178 0.69409778, 0.68310537, 0.67491515, 0.68222458, 0.69337943, 1179 0.68140117, 0.67356609, 0.68097711, 0.69301997, 0.68071631, 1180 0.67356716, 0.68071666, 0.69302027, 0.68097852, 0.6749196 , 1181 0.68140363, 0.69338045, 0.68222808, 0.6777162 , 0.68310954, 1182 0.69409929, 0.68435822, 0.68106317, 0.68543327, 0.69503026, 1183 0.68674199, 0.68376697, 0.68766854, 0.69595754, 0.68826575, 1184 0.71760631, 0.75094294, 0.78427898, 0.75094168, 0.71760193, 1185 0.75093986, 0.78427453, 0.75093415, 0.71758272, 0.7509278 , 1186 0.78426295, 0.75091754, 0.7175572 , 0.75090919, 0.78424795, 1187 0.75089856, 0.71753518, 0.75089163, 0.78423642, 0.75088684, 1188 0.71753524, 0.75088686, 0.78423643, 0.75089171, 0.7175573 , 1189 0.75089864, 0.78424798, 0.75090931, 0.71758285, 0.75091768, 1190 0.78426303, 0.75092799, 0.7176021 , 0.75093438, 0.78427472, 1191 0.75094013, 0.71760652, 0.75094199, 0.78427929, 0.75094328, 1192 0.81761649, 0.85095268, 0.88428788, 0.85095192, 0.81761311, 1193 0.8509508 , 0.88428574, 0.85094833, 0.81760513, 0.8509458 , 1194 0.88428131, 0.85094197, 0.81759506, 0.85093883, 0.88427596, 1195 0.85093514, 0.81758753, 0.85093282, 0.88427212, 0.85093123, 1196 0.81758749, 0.8509312 , 0.88427198, 0.85093269, 0.81759494, 1197 0.85093494, 0.8842756 , 0.85093857, 0.81760502, 0.8509417 , 1198 0.88428088, 0.85094557, 0.81761314, 0.85094816, 0.88428543, 1199 0.85095073, 0.81761667, 0.85095193, 0.88428775, 0.85095275, 1200 0.91762366, 0.95095836, 0.98429205, 0.95095804, 0.91762217, 1201 0.95095754, 0.98429102, 0.95095658, 0.91761918, 0.95095558, 1202 0.98428903, 0.95095416, 0.91761561, 0.95095297, 0.98428667, 1203 0.95095164, 0.91761304, 0.95095078, 0.98428497, 0.95095015, 1204 0.91761286, 0.95095007, 0.98428475, 0.95095045, 0.9176151 , 1205 0.95095115, 0.98428605, 0.95095231, 0.91761853, 0.95095342, 1206 0.9842882 , 0.9509548 , 0.91762161, 0.95095583, 0.98429026, 1207 0.95095688, 0.91762327, 0.95095746, 0.98429146, 0.95095784]) 1208 1209 1210 1211 1212 #print w.centroid_values - wc 1213 1214 assert num.allclose(w.centroid_values, wc, rtol=1.0e-3) 1215 1216 1217 1218 1219 def test_kinematic_operator_string(self): 1220 1221 from anuga import rectangular_cross_domain 1222 from anuga import Reflective_boundary 1223 1224 m1 = 10 1225 n1 = 10 1226 domain = rectangular_cross_domain(m1,n1) 1227 1228 #domain.set_flow_algorithm('2_0') 1229 1230 # 1231 domain.set_quantity('elevation', expression='x') 1232 domain.set_quantity('friction', 0.03) 1233 domain.set_quantity('stage',expression='elevation + 2*(x-0.5)') 1234 domain.set_quantity('xmomentum', expression='2*x+3*y') 1235 domain.set_quantity('ymomentum', expression='5*x+7*y') 1236 1237 B = Reflective_boundary(domain) 1238 domain.set_boundary( {'left': B, 'right': B, 'top': B, 'bottom': B}) 1239 1240 # kill off the wave with viscosity 1241 kv = Kinematic_viscosity_operator(domain, diffusivity = 'height') 1242 1243 1244 # let's make timestep large so that the final solution will look like 1245 #the solution of hte elliptic problem. In this case u -> 1, v -> 2. 1246 1247 1248 for t in domain.evolve(yieldstep = 1.0, finaltime = 10.0): 1249 #domain.write_time() 1250 #domain.print_operator_timestepping_statistics() 1251 pass 1252 841 1253 # 842 # 843 # #print 'u' 844 # #print u.centroid_values 845 # #print u.boundary_values 846 # 847 # #print num.where(h.centroid_values > 0.0, 1.0, 0.0) 848 # 849 # assert num.allclose(u.centroid_values, num.where(h.centroid_values > 0.0, 1.0, 0.0), rtol=1.0e-1) 850 # assert num.allclose(u.boundary_values, num.ones_like(u.boundary_values)) 851 # 852 # assert num.allclose(v.centroid_values, num.where(h.centroid_values > 0.0, 2.0, 0.0), rtol=1.0e-1) 853 # assert num.allclose(v.boundary_values, 2.0*num.ones_like(v.boundary_values)) 854 # 855 # 856 # domain.update_centroids_of_momentum_from_velocity() 857 # 858 # domain.distribute_to_vertices_and_edges() 859 # 860 # uh = domain.quantities['xmomentum'] 861 # vh = domain.quantities['ymomentum'] 862 # 863 # #print 'uh' 864 # #print uh.centroid_values 865 # #print uh.boundary_values 866 # 867 # assert num.allclose(uh.centroid_values, u.centroid_values*h.centroid_values ) 868 # assert num.allclose(vh.centroid_values, v.centroid_values*h.centroid_values ) 1254 w = domain.quantities['stage'] 1255 uh = domain.quantities['xmomentum'] 1256 vh = domain.quantities['ymomentum'] 1257 1258 #print 'uh' 1259 #print uh.centroid_values 1260 #print uh.boundary_values 1261 1262 #print 'w' 1263 #print w.centroid_values 1264 1265 #from pprint import pprint 1266 #pprint(w.centroid_values) 1267 1268 1269 wc = num.array([ 1270 0.70714365, 0.70714416, 0.70714295, 0.70714222, 0.70714486, 1271 0.70714507, 0.70714374, 0.70714601, 0.70714492, 0.70714425, 1272 0.70714595, 0.70714437, 0.70714797, 0.70714691, 0.70714697, 1273 0.70714845, 0.70714793, 0.70714793, 0.70715033, 0.70714852, 1274 0.70715244, 0.70715018, 0.70715176, 0.70715224, 0.70715211, 1275 0.70715265, 0.70715351, 0.7071531 , 0.70715433, 0.70715309, 1276 0.70715351, 0.70715472, 0.70715429, 0.70715433, 0.70715487, 1277 0.70715523, 0.7071545 , 0.70715446, 0.70715317, 0.70715564, 1278 0.70714142, 0.70714198, 0.70714079, 0.70714299, 0.70714482, 1279 0.70714378, 0.70714344, 0.70714377, 0.7071443 , 0.70714533, 1280 0.70714579, 0.70714574, 0.70714906, 0.70714717, 0.70714819, 1281 0.70714822, 0.70714976, 0.70714952, 0.70715093, 0.70715077, 1282 0.70715217, 0.70715094, 0.70715291, 0.70715188, 0.70715352, 1283 0.70715278, 0.707154 , 0.70715429, 0.70715376, 0.70715309, 1284 0.70715446, 0.70715422, 0.70715366, 0.70715453, 0.70715413, 1285 0.70715539, 0.70715385, 0.70715412, 0.70715154, 0.70715306, 1286 0.70714038, 0.70713905, 0.7071358 , 0.70713972, 0.70714303, 1287 0.7071419 , 0.70714066, 0.70714219, 0.7071459 , 0.70714505, 1288 0.70714639, 0.70714648, 0.70714833, 0.70714827, 0.70715147, 1289 0.70715013, 0.70715194, 0.70715133, 0.70715542, 0.70715345, 1290 0.70715296, 0.70715417, 0.70715676, 0.70715521, 0.70715526, 1291 0.7071548 , 0.70715717, 0.70715512, 0.70715381, 0.70715523, 1292 0.70715556, 0.70715486, 0.70715482, 0.70715338, 0.70715307, 1293 0.70715381, 0.70715132, 0.70715182, 0.70714789, 0.70715086, 1294 0.70713443, 0.70713559, 0.70713539, 0.70713615, 0.70714057, 1295 0.70713978, 0.70714091, 0.70714102, 0.70714618, 0.70714338, 1296 0.70714803, 0.70714858, 0.7071519 , 0.70715029, 0.70715343, 1297 0.70715461, 0.70715589, 0.70715519, 0.7071565 , 0.70715796, 1298 0.70715738, 0.70715845, 0.7071601 , 0.70715829, 0.70715711, 1299 0.70715903, 0.70716011, 0.70715714, 0.7071565 , 0.70715756, 1300 0.70715885, 0.7071556 , 0.70715386, 0.70715406, 0.70715653, 1301 0.70715532, 0.70714813, 0.7071515 , 0.70715242, 0.70715269, 1302 0.70713191, 0.70712961, 0.70712505, 0.70712841, 0.70714097, 1303 0.70713808, 0.70713862, 0.7071431 , 0.70714966, 0.7071463 , 1304 0.70715775, 0.70715666, 0.70715566, 0.7071554 , 0.7071632 , 1305 0.70716353, 0.70715928, 0.70716244, 0.70716736, 0.70716495, 1306 0.70716301, 0.70716635, 0.70717088, 0.70716792, 0.70716369, 1307 0.70717007, 0.7071741 , 0.70716769, 0.70716166, 0.70716991, 1308 0.70717294, 0.70716167, 0.70715775, 0.70716057, 0.70715687, 1309 0.70715535, 0.70715014, 0.70714766, 0.70714559, 0.70714992, 1310 0.7071149 , 0.70708741, 0.706984 , 0.70711096, 0.70714367, 1311 0.70714831, 0.70713519, 0.7071811 , 0.70716622, 0.70716603, 1312 0.70714155, 0.7071748 , 0.70716885, 0.70716897, 0.70713548, 1313 0.70716966, 0.70716924, 0.70716978, 0.70713561, 0.7071717 , 1314 0.70717389, 0.7071726 , 0.70713926, 0.70717593, 0.70718002, 1315 0.70717761, 0.70714428, 0.70718053, 0.70718062, 0.70718719, 1316 0.70715731, 0.70718271, 0.70716238, 0.7071992 , 0.70715496, 1317 0.70716834, 0.70713531, 0.70713099, 0.70700665, 0.7071098 , 1318 0.70634397, 0.70524618, 0.70297607, 0.70514658, 0.70658259, 1319 0.70506628, 0.70244401, 0.70497884, 0.70657086, 0.70498266, 1320 0.70239779, 0.70496243, 0.7065572 , 0.7049646 , 0.70239608, 1321 0.70496008, 0.70655538, 0.70496125, 0.70239685, 0.70496177, 1322 0.70655883, 0.70496295, 0.70239957, 0.70496624, 0.70656625, 1323 0.70496724, 0.70240482, 0.7049756 , 0.70658803, 0.70497608, 1324 0.70241139, 0.70500006, 0.70660425, 0.70499778, 0.70246225, 1325 0.70508764, 0.70636798, 0.70516922, 0.70299639, 0.70526838, 1326 0.71780931, 0.7506157 , 0.78399529, 0.75061024, 0.71769206, 1327 0.75059929, 0.78398287, 0.75059279, 0.71768281, 0.75059112, 1328 0.78397863, 0.75059025, 0.71768261, 0.75058996, 0.78397777, 1329 0.75058981, 0.71768268, 0.75058969, 0.78397749, 0.75058967, 1330 0.7176832 , 0.75058972, 0.78397772, 0.75058986, 0.71768421, 1331 0.7505901 , 0.78397859, 0.75059043, 0.71768534, 0.7505909 , 1332 0.78398028, 0.750592 , 0.71769545, 0.75059388, 0.78398545, 1333 0.75060056, 0.71781337, 0.75061163, 0.78399848, 0.75061714, 1334 0.81739069, 0.85076296, 0.8841241 , 0.85076174, 0.81738381, 1335 0.85075988, 0.88412183, 0.85075808, 0.81738087, 0.85075718, 1336 0.88412031, 0.85075635, 0.81737996, 0.85075599, 0.88411952, 1337 0.85075563, 0.81737963, 0.85075548, 0.88411919, 0.8507555 , 1338 0.81738003, 0.85075569, 0.88411972, 0.85075629, 0.81738134, 1339 0.85075692, 0.88412133, 0.85075812, 0.81738361, 0.85075914, 1340 0.88412387, 0.85076103, 0.81738807, 0.85076269, 0.88412739, 1341 0.85076547, 0.81739598, 0.85076786, 0.88413107, 0.85076949, 1342 0.91748914, 0.95083916, 0.98417801, 0.95083906, 0.91748809, 1343 0.95083882, 0.98417779, 0.95083863, 0.91748731, 0.95083843, 1344 0.98417752, 0.9508382 , 0.91748674, 0.950838 , 0.9841771 , 1345 0.95083776, 0.91748646, 0.95083764, 0.98417686, 0.95083771, 1346 0.91748702, 0.95083794, 0.98417744, 0.95083859, 0.91748864, 1347 0.95083927, 0.98417906, 0.95084046, 0.91749107, 0.95084145, 1348 0.98418138, 0.95084291, 0.91749397, 0.95084401, 0.98418384, 1349 0.95084538, 0.91749653, 0.95084626, 0.98418563, 0.95084686]) 1350 1351 1352 #print w.centroid_values - wc 1353 1354 assert num.allclose(w.centroid_values, wc, rtol=1.0e-3) 869 1355 870 1356 -
trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r8471 r8472 796 796 797 797 def extrapolate_second_order_sw(self): 798 """Call correct module function 799 (either from this module or C-extension)""" 800 extrapolate_second_order_sw(self) 798 """Fast version of extrapolation from centroids to edges""" 799 800 from shallow_water_ext import extrapolate_second_order_sw as extrapol2 801 extrapol2(self) 802 801 803 802 804 def compute_fluxes(self): … … 1470 1472 1471 1473 1472 def extrapolate_second_order_sw(domain):1473 """Wrapper calling C version of extrapolate_second_order_sw.1474 1475 domain the domain to operate on1476 1477 Note MH090605: The following method belongs to the shallow_water domain1478 class, see comments in the corresponding method in shallow_water_ext.c1479 """1480 1481 from shallow_water_ext import extrapolate_second_order_sw as extrapol21482 extrapol2(domain)1474 #def extrapolate_second_order_sw(domain): 1475 # """Wrapper calling C version of extrapolate_second_order_sw. 1476 # 1477 # domain the domain to operate on 1478 # 1479 # Note MH090605: The following method belongs to the shallow_water domain 1480 # class, see comments in the corresponding method in shallow_water_ext.c 1481 # """ 1482 # 1483 # from shallow_water_ext import extrapolate_second_order_sw as extrapol2 1484 # extrapol2(domain) 1483 1485 1484 1486 -
trunk/anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r8457 r8472 3895 3895 3896 3896 3897 from anuga.shallow_water.shallow_water_ domainimport extrapolate_second_order_sw3897 from anuga.shallow_water.shallow_water_ext import extrapolate_second_order_sw 3898 3898 3899 3899 extrapolate_second_order_sw(domain)
Note: See TracChangeset
for help on using the changeset viewer.