develop: Fringe Fields Discussion

Issue #297 resolved
Eliott Ramoisiaux created an issue

A mismatch between BDSIM and the tracking code Manzoni (validated by MAD-X) has been observed since some commits relative to the fringe fields while before, BDSIM, Manzoni and experimental values matched.

A discussion has been opened. Some slides describing the situation are attached to this Issue.

Comments (7)

  1. Eliott Ramoisiaux reporter

    The error seems to come from the non-initialisation of the Boolean zeroStrength when its value was false in the file BDSIntegratorDipoleFringe.cc line 80.

    // check if field or scaling is finite, if not then set to be zero strength to later advance as a drift,
      // otherwise then calculate rho by undo-ing field scaling so rho is truly nominal for matching mad matrices
      if (!BDS::IsFinite((*strengthIn)["field"]) || !BDS::IsFinite((*strengthIn)["scaling"]))
        {zeroStrength = true;}
      else
        {
          zeroStrength = false;
          rho = (std::abs(brhoIn)/(*strengthIn)["field"]) * (*strengthIn)["scaling"];
        }
    

  2. Eustache Gnacadja

    I’ve tested the correction proposed above by Eliott and I can confirm that initializing the boolean zeroStrength to false in BDSIntegratorDipoleFringe.cc line 80 fixes the bug. See below a comparison between the default version of develop and the “corrected” one, recompiled with zeroStrength set to false in the “else” condition. Data in CYAN are from MANZONI.

  3. Laurie Nevay

    Hello,

    Thanks for the report and fix! Indeed, from analysis of the code, zeroStrength is never initialised but can in the case of a zero strength dipole or fringe be set to True. Therefore, the default behaviour will be that the value is just whatever that bit of memory was before and the fringe field will be effectively turned on or off.

    Can you commit this change in a branch please (e.g. issue297-dipole-fringe) and push. @William Shields could you check the fix please against one of our models?

    We likely see different behaviour due to different compilers / platforms, but ultimately with the fix should see the same results.

  4. Eliott Ramoisiaux reporter

    Hello,

    The branch “issue297-dipole-fringe” has been pushed.

    Thank you and have a nice day 🙂

  5. William Shields

    @Laurie Nevay , sure no problem. I’ll run it through the bdsim-testing code when the fix has been pushed.

  6. William Shields

    The optics all match well with the fix, there doesn’t appear to be any tracking issues that have been introduced.

  7. Log in to comment