Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • S src
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 60
    • Issues 60
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OPAL
  • src
  • Issues
  • #544

Closed
Open
Created May 22, 2020 by snuverink_j@snuverink_jDeveloper

Charge per macroparticle wrong for multicharged particles?

Summary

The charge per macroparticle seems wrongly calculated in case of OPAL-T.

This was discovered by Finn O'Shea, and posted to the OPAL mailing list.

Steps to reproduce

BEAM1: BEAM, PARTICLE=PROTON, PC=P0, NPART=1000, BCURRENT=2.0e-03, BFREQ=50, CHARGE=1;
BEAM2: BEAM, PARTICLE=ALPHA,  PC=P0, NPART=1000, BCURRENT=2.0e-03, BFREQ=50, CHARGE=2, MASS=3.7274;

What is the current bug behavior?

BEAM1:

OPAL> * ************** B U N C H ********************************************************* 
OPAL> * NP              = 1000
OPAL> * Qtot            =       39.500 [pC]         Qi    =       39.500 [fC]

BEAM2:

OPAL> * ************** B U N C H ********************************************************* 
OPAL> * NP              = 1000
OPAL> * Qtot            =       79.000 [pC]         Qi    =       79.000 [fC]

What is the expected correct behavior?

These two beams are expected to have the same charge per bunch and macroparticle (since BCURRENT and FREQ are constant).

Relevant logs and/or screenshots

In TrackRun::setDistributionParallelT():


    // Return charge per macroparticle.
    return beam->getCharge() * beam->getCurrent() / (beam->getFrequency()*1.0e6) / numberOfParticles;

Possible fixes

The factor beam->getCharge() should not be present in the formula. This is correctly calculated for OPAL-Cycl. Ideally the formula should be refactored to a separate function to reduce code duplication.

Edited May 25, 2020 by snuverink_j
Assignee
Assign to
Time tracking