-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollision_matrices.py
175 lines (162 loc) · 7.97 KB
/
collision_matrices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# -*- coding: utf-8 -*-
import numpy as np
# Document this
RR = np.array([[0.532839975353552, 0.62499315719733, 0.65179628685374,
0.66096951787414, 0.664384063112055, 0.665723193992758,
0.66626759328314, 0.66649482166090, 0.666591603828188,
0.66663349278917, 0.66665186145102], [0.62499315719733,
1.38570619769669, 1.56319945639811, 1.62480243604524,
1.64887581337509, 1.65887002999963, 1.66317658717432,
1.66507987027955, 1.66593657963013, 1.66632758450110,
1.66650798357844], [0.65179628685374, 1.56319945639811,
2.48424468507179, 2.73913363421279, 2.83827425510812,
2.880742042502548, 2.89982473100151, 2.908649065257968,
2.91280795188664, 2.91479441895510,
2.91575260488695], [0.66096951787414, 1.62480243604524,
2.73913363421279, 3.78904076955720, 4.11492761114593,
4.25241122806595, 4.315464290817569, 4.34556787668262,
4.36028081306715, 4.36758037751799,
4.37123894704449], [0.664384063112055, 1.64887581337509,
2.83827425510812, 4.11492761114593, 5.27492275065399,
5.66670777845717, 5.842515578215192, 5.92755729234118,
5.97016857799636, 5.99194964803402,
6.00322149509043], [0.665723193992758, 1.65887002999963,
2.880742042502548, 4.25241122806595, 5.66670777845717,
6.924082807453010, 7.37761869449192, 7.59135279259971,
7.69928960274143, 7.75555929263538,
7.78541339018287], [0.66626759328314, 1.66317658717432,
2.89982473100151, 4.315464290817569, 5.842515578215192,
7.37761869449192, 8.72308365945216, 9.23492369241605,
9.48600863166513, 9.61742127955158,
9.68824621951301], [0.66649482166090, 1.66507987027955,
2.908649065257968, 4.34556787668262, 5.92755729234118,
7.59135279259971, 9.23492369241605, 10.66132668990492,
11.22855143524221, 11.51633292221986,
11.67158195717535], [0.666591603828188, 1.66593657963013,
2.91280795188664, 4.36028081306715, 5.97016857799636,
7.69928960274143, 9.48600863166513, 11.22855143524221,
12.730177951804689, 13.35027463459110,
13.674070462681899], [0.66663349278917, 1.66632758450110,
2.91479441895510, 4.36758037751799, 5.99194964803402,
7.75555929263538, 9.61742127955158, 11.51633292221986,
13.35027463459110, 14.92242901005526,
15.59320556161332], [0.66665186145102, 1.66650798357844,
2.91575260488695, 4.37123894704449, 6.00322149509043,
7.78541339018287, 9.68824621951301, 11.67158195717535,
13.674070462681899, 15.59320556161332, 17.23194416142677]])
KKee = np.array([[0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0.], [0.,
1.41421356237310, 1.06066017177982, 0.662912607362388,
0.38669902096139, 0.217518199290784, 0.11963500960993,
0.06480229687205, 0.03471551618145, 0.01844261797140,
0.00973360392935], [0., 1.06066017177982, 3.977475644174330,
3.41399992791630, 2.44449023964881, 1.61325997807331,
1.01417860419328, 0.61686801830121, 0.36624869571433,
0.21344618152190, 0.12256656526824], [0., 0.662912607362388,
3.41399992791630, 7.81270129135215, 7.02583783709231,
5.37936749109157, 3.80675730547004, 2.56276373746444,
1.66499287439692, 1.05278645032334, 0.65147813443416], [0.,
0.38669902096139, 2.44449023964881, 7.02583783709231,
12.925846359363319, 11.89350347498621, 9.48722862581920,
7.03050989954344, 4.96377752197238, 3.38209488081448,
2.241137113758683], [0., 0.217518199290784, 1.61325997807331,
5.37936749109157, 11.89350347498621, 19.31751270520458,
18.01797928463678, 14.78212988122789, 11.324030391259802,
8.28341918825775, 5.85284303404879], [0., 0.11963500960993,
1.01417860419328, 3.80675730547004, 9.48722862581920,
18.01797928463678, 26.987442326942771, 25.40076033856707,
21.274720682630621, 16.71493392949320,
12.56892261779070], [0., 0.06480229687205, 0.61686801830121,
2.56276373746444, 7.03050989954344, 14.78212988122789,
25.40076033856707, 35.93522684828687, 34.04327125697389,
28.97334742905104, 23.22385258806331], [0., 0.03471551618145,
0.36624869571433, 1.66499287439692, 4.96377752197238,
11.324030391259802, 21.274720682630621, 34.04327125697389,
46.160464187746448, 43.94675811819964,
37.88472005586695], [0., 0.01844261797140, 0.21344618152190,
1.05278645032334, 3.38209488081448, 8.28341918825775,
16.71493392949320, 28.97334742905104, 43.94675811819964,
57.66279418909174, 55.11228856481140], [0., 0.00973360392935,
0.12256656526824, 0.65147813443416, 2.241137113758683,
5.85284303404879, 12.56892261779070, 23.22385258806331,
37.88472005586695, 55.11228856481140, 70.44190270440203]])
KKei = np.array([[1.00000000000000, 1.50000000000000, 1.87500000000000,
2.18750000000000, 2.46093750000000, 2.707031250000000,
2.93261718750000, 3.14208984375000, 3.33847045898438,
3.52394104003906, 3.70013809204102], [1.50000000000000,
3.25000000000000, 4.31250000000000, 5.15625000000000,
5.878906250000000, 6.521484375000000, 7.105957031250000,
7.64575195312500, 8.14979553222656, 8.62438201904297,
9.07414817810059], [1.87500000000000, 4.31250000000000,
6.76562500000000, 8.41406250000000, 9.77050781250000,
10.95458984375000, 12.02014160156250, 12.997375488281250,
13.90538406372070, 14.757184982299805,
15.56214094161987], [2.18750000000000, 5.15625000000000,
8.41406250000000, 11.55078125000000, 13.797363281250000,
15.69213867187500, 17.36968994140625, 18.89346313476563,
20.30027961730957, 21.61400508880615,
22.85123705863953], [2.46093750000000, 5.878906250000000,
9.77050781250000, 13.797363281250000, 17.60699462890625,
20.459197998046875, 22.90912628173828, 25.10217666625977,
27.10923027992249, 28.972478270530701,
30.71981367468834], [2.707031250000000, 6.521484375000000,
10.95458984375000, 15.69213867187500, 20.459197998046875,
24.93501281738281, 28.39788436889648, 31.41486167907715,
34.139520525932312, 36.648648798465729,
38.98886771500111], [2.93261718750000, 7.105957031250000,
12.02014160156250, 17.36968994140625, 22.90912628173828,
28.39788436889648, 33.53525638580322, 37.612431049346924,
41.205317527055740, 44.473890587687492,
47.49973736330867], [3.14208984375000, 7.64575195312500,
12.997375488281250, 18.89346313476563, 25.10217666625977,
31.41486167907715, 37.612431049346924, 43.40798497200012,
48.10220517218113, 52.27785687893629,
56.10005690716207], [3.33847045898438, 8.14979553222656,
13.90538406372070, 20.30027961730957, 27.10923027992249,
34.139520525932312, 41.205317527055740, 48.10220517218113,
54.553369977511466, 59.86677823355421,
64.63065859337803], [3.52394104003906, 8.62438201904297,
14.757184982299805, 21.61400508880615, 28.972478270530701,
36.648648798465729, 44.473890587687492, 52.27785687893629,
59.86677823355421, 66.971530431183055,
72.90584670990938], [3.70013809204102, 9.07414817810059,
15.56214094161987, 22.85123705863953, 30.71981367468834,
38.98886771500111, 47.49973736330867, 56.10005690716207,
64.63065859337803, 72.90584670990938, 80.662552331355982]])
arhs = np.array([-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.])
crhs = np.array([-1.,2.5,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.])
#document test here
#l = 3
#print(RR[:l,:l])
#print(KKee[:l,:l])
#print(KKei[:l,:l])
def arhs_vector(l):
return arhs[:l]
def crhs_vector(l):
return crhs[:l]
# Return RR matrix
# l is number of Sonine polynomials
def RR_matrix(l):
return RR[:l,:l]
# Return KKee matrix
# l is number of Sonine polynomials
def KKee_matrix(l):
return KKee[:l,:l]
# Return KKei matrix
# l is number of Sonine polynomials
def KKei_matrix(l):
return KKei[:l,:l]
# Return KKe matrix
# l is number of Sonine polynomials
# Zi is ion charge
def KKe_matrix(l,Zi):
KKe = KKee[:l,:l] + Zi*KKei[:l,:l]
return KKe
# Return QQe matrix
# l is number of Sonine polynomials
# Zi is ion charge
# fc_eff = fc * < (B/Bref)^2> with
# fc the fraction of circulating particles
def QQe_matrix(l,Zi,fc_eff):
QQe = ( 1. - fc_eff )*RR[:l,:l] + fc_eff*KKee[:l,:l] + Zi*KKei[:l,:l]
return QQe