Beispiel #1
0
 def advance(self,delta):
     """
     Advance the tracer position and the relevant momentum for a given duration.
     
     The trajectory is initialized at the latest state of the current tracer
     and integrated for an additional `delta` seconds. Uses the settings
     specific to the current tracer.
     
     This method can be called many times.
     
     Parameters
     ----------
     delta : float
         The number of seconds to advance the trajectory.
     """
     t = 0
     current = self.trajlist[-1]
     assert current.check_adiabaticity == True
     while t < delta:
         try:
             current.advance(delta-t)
         except NonAdiabatic:
             p = Particle()
             p.init(current)
             p.check_adiabaticity = True
             self.trajlist.append(p)
             current = self.trajlist[-1]
             print("Switched to particle mode at time", current.tcur,flush=True)
         except Adiabatic:
             g = GuidingCenter()
             g.init(current)
             g.check_adiabaticity = True
             self.trajlist.append(g)
             current = self.trajlist[-1]
             print("Switched to guiding center mode at time", current.tcur,flush=True)
         t = current.tcur