| Summary: | Magnetic Field Causing Strange Acceleration | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | ah12 |
| Component: | geometry/magneticfield | Assignee: | John Apostolakis <John.Apostolakis> |
| Status: | RESOLVED FIXED | ||
| Severity: | trivial | ||
| Priority: | P5 | ||
| Version: | 9.4 | ||
| Hardware: | All | ||
| OS: | All | ||
Thanks for the clear report. There is a key difference between the general equation of motion G4EqMagElectricField and the specific one for magnetic fields G4Mag_UsualEqRhs. When the equation for magnetic fields is used, a parameter is set which ensures that the energy is conserved exactly. If this parameter is not set, then the accuracy in integrating the equations of motions will drive how well the energy is conserved. Please check the documentation for the parameters guiding the accuracy of integration. Giving small values to the "Epsilon Integration" parameters (say 10^-4 to 10^-5) will ensure that the Energy is much better conserved. Hope this explains the situation. |
Similar to the problem reported by someone else under problem number 1111, when implementing a magnetic field I found that electrons acquired momentum in a direction parallel to the field. I also found that their primary momentum direction reversed, although I cannot now reproduce this effect and so I suspect that that was a result of this problem combined with overlapping geometries On further testing, I have found that the problem appears when I use the class "G4EqMagElectricField" for the field equations, but goes away when I instead use "G4Mag_UsualEqRhs". code snippit: fEMfield = new G4UniformMagField( G4ThreeVector(0.0,0.2*tesla,0.0)); fEquation = new G4EqMagElectricField(fEMfield); fStepper = new G4SimpleRunge(fEquation); localFieldMgr= new G4FieldManager(fEMfield); fIntgrDriver = new G4MagInt_Driver(fMinStep, fStepper, fStepper->GetNumberOfVariables() ); fChordFinder = new G4ChordFinder(fIntgrDriver); localFieldMgr->SetChordFinder(fChordFinder); fieldVol_log->SetFieldManager(localFieldMgr, true); displays the odd behavior. Replacing: fEquation = new G4Mag_UsualEqRhs(fEMfield); and fStepper = new G4HelixExplicitEuler(fEquation); and the field behaves as expected. Thank you for your time.