@@ -12,10 +12,10 @@ class verlet(sweeper):
1212 Second-order sweeper using velocity-Verlet as base integrator
1313
1414 Attributes:
15- S: node -to-node collocation matrix (first order)
16- SQ: node -to-node collocation matrix (second order)
17- ST: node -to-node trapezoidal matrix
18- Sx: node-to-node Euler half-step for position update
15+ QQ: 0 -to-node collocation matrix (second order)
16+ QT: 0 -to-node trapezoidal matrix
17+ Qx: 0 -to-node Euler half-step for position update
18+ qQ: update rule for final value (if needed)
1919 """
2020
2121 def __init__ (self , params ):
@@ -26,17 +26,15 @@ def __init__(self, params):
2626 params: parameters for the sweeper
2727 """
2828
29- # call parent's initialization routine
30-
3129 if 'QI' not in params :
3230 params ['QI' ] = 'IE'
3331 if 'QE' not in params :
3432 params ['QE' ] = 'EE'
3533
34+ # call parent's initialization routine
3635 super (verlet , self ).__init__ (params )
3736
38- # S- and SQ-matrices (derived from Q) and Sx- and ST-matrices for the integrator
39- # [self.S, self.ST, self.SQ, self.Sx, self.QQ] = self.__get_Qd()
37+ # Trapezoidal rule, Qx and Double-Q as in the Boris-paper
4038 [self .QT , self .Qx , self .QQ ] = self .__get_Qd ()
4139
4240 self .qQ = np .dot (self .coll .weights , self .coll .Qmat [1 :, 1 :])
@@ -55,8 +53,6 @@ def __get_Qd(self):
5553 # set implicit and explicit Euler matrices
5654 QI = self .get_Qdelta_implicit (self .coll , self .params .QI )
5755 QE = self .get_Qdelta_explicit (self .coll , self .params .QE )
58- # QI = np.zeros(self.coll.Qmat.shape)
59- # QE = np.zeros(self.coll.Qmat.shape)
6056
6157 # trapezoidal rule
6258 QT = 0.5 * (QI + QE )
@@ -66,6 +62,8 @@ def __get_Qd(self):
6662
6763 QQ = np .zeros (np .shape (self .coll .Qmat ))
6864
65+ # if we have Gauss-Lobatto nodes, we can do a magic trick from the Book
66+ # this takes Gauss-Lobatto IIIB and create IIIA out of this
6967 if isinstance (self .coll , CollGaussLobatto ):
7068
7169 for m in range (self .coll .num_nodes ):
@@ -74,6 +72,7 @@ def __get_Qd(self):
7472 self .coll .weights [m ])
7573 QQ = np .dot (self .coll .Qmat , QQ )
7674
75+ # if we do not have Gauss-Lobatto, just multiply Q (will not get a symplectic method, they say)
7776 else :
7877
7978 QQ = np .dot (self .coll .Qmat , self .coll .Qmat )
@@ -154,6 +153,7 @@ def integrate(self):
154153 for j in range (1 , self .coll .num_nodes + 1 ):
155154 p [- 1 ].pos += L .dt * (L .dt * self .QQ [m , j ] * L .f [j ]) + L .dt * self .coll .Qmat [m , j ] * L .u [0 ].vel
156155 p [- 1 ].vel += L .dt * self .coll .Qmat [m , j ] * L .f [j ]
156+ # we need to set mass and charge here, too, since the code uses the integral to create new particles
157157 p [- 1 ].m = L .u [0 ].m
158158 p [- 1 ].q = L .u [0 ].q
159159
@@ -182,6 +182,7 @@ def compute_end_point(self):
182182 for m in range (self .coll .num_nodes ):
183183 L .uend .pos += L .dt * (L .dt * self .qQ [m ] * L .f [m + 1 ]) + L .dt * self .coll .weights [m ] * L .u [0 ].vel
184184 L .uend .vel += L .dt * self .coll .weights [m ] * L .f [m + 1 ]
185+ # remember to set mass and charge here, too
185186 L .uend .m = L .u [0 ].m
186187 L .uend .q = L .u [0 ].q
187188 # add up tau correction of the full interval (last entry)
0 commit comments