Skip to content
  • Samuel Rowlinson's avatar
    Smarter handling of unstable cavities encountered during simulation scans · c755881d
    Samuel Rowlinson authored
    This is something that's been somewhat in limbo since I rewrote the beam tracing using
    TraceTrees and TraceForests. If some geometric parameter of a cavity is being swept
    then, during a simulation, the cavity can become unstable. This essentially invalidates
    the trace trees dependent upon this cavity for those data points where this is the case.
    Previously, this wasn't being handled in a very robust way --- the trace trees from such
    cavities were essentially skipped, leaving them in a state which was not necessarily
    consistent with the current parameter set (in turn meaning the modal bases of such trees
    could be outdated).
    
    In this commit this behaviour is changed to make it more robust, and well-defined. Now,
    if an unstable cavity region (of any number of changing unstable cavities) is hit then
    the simulation goes into a contingent trace forest mode. Put briefly, it builds a new
    TraceForest where the unstable cavities are not included, caches it for future data
    points (as they typically occur in blocks or strides of axes scans) and uses this
    contingent trace forest for performing beam traces whilst in the unstable region. Upon
    exiting the unstable regions, the tracing will switch back to using the standard
    simulation trace forest.
    c755881d