-
Steve Russell authored
FM1DElectroStatic, FM1DElectroStatic_fast, FM1DMagnetoStatic and FM1DMagnetoStatic_fast. The first bug had to do with field normalization. Although the 1D field profile derivatives were normalized properly, the actual field was not. Instead of looping through all of the field values, the loop was over the Fourier accuracy parameter. This typically had the effect that the on axis field was not normalized at all. For input fields that were already normalized to 1, this had no effect. However, if the input field was not then the field expansion was incorrect. The second had to do with the Fourier expansion used to calculate the derivatives of the on axis field. The code reflects the input field in order to ensure that it is periodic. For best accuracy, this reflection should be about the first point of the input data (z = 0). However, what was actually implemented was a reflection about -delta / 2, where delta is the 1D grid spacing. This caused an error that was small, and became smaller with decreasing delta, but significant. Using the new implementation, the reconstruction of the field file for the Envelope-Tracker-Phase-1 (FINSS-RGUN.dat) is about two orders of magnitude more accurate than when using the old Fourier expansion implementation. Even though this error was small, there was a noticeable difference in the beam envelope when running the Envelope-Tracker-Phase-1 and ExternalFieldTest regression tests. The reference files for both of the tests were updated using the new field classes. A quick glance shows that the Fourier expansion bug may also be present in the 1D Astra field classes, but I need to look more carefully to be sure. Finally, all six classes were cleaned up to conform to the new coding style.
058f85d9