Problem using fieldmap to import a magnetic field

26 views
Skip to first unread message

Paulo Phillipe Marques

unread,
Jan 5, 2025, 12:44:13 AMJan 5
to G4Beamline
Hello,

I'm having difficulty using the fieldmap command. I'm running the latest version of G4Bl on a windows 10 machine (all latest OS updates installed). The simulation involves an isotropic beam of 1 MeV electrons incident on a tungsten aperture placed in front of a magnetic spectrometer. Specifically, the problems I'm encountering are:

1) Size of magnetic field region

Once the field file (B.txt) has been successfully read and particles are tracked, the size of the field region appears to be about double what it should be in the z direction (fieldmapviz.png). A visualization using genericbend (genericbendviz.png) is included for reference. The actual field volume read by fieldmap is very close to the genericbend volume shown in blue (genericbendfieldvol.png).

When I ask G4Bl to tell me the field it's using in the sim. using printfield (printedB.txt), it tells me it's the same as the input file. However, in regions where it shows (correctly) that the field is zero, the particles are still shown to be deflected (fieldmapviz.png).

2) Incorrect matter interactions

1 MeV electrons should not be able to penetrate a 1.2 cm thick tungsten block but while using the fieldmap command they do. It appears that some particles go straight through and don't interact with the tungsten at all. I confirmed that this was not merely an issue with the visualization by taking a sample just after the tungsten block (aperture_sample.png).

When I first began running the fieldmap command, it appeared that all was working as it should. Then, the simulation suddenly began to display this erroneous behavior and I wasn't able to identify the cause. I attempted to uninstall and reinstall the program via Windows control panel but the issue persists. I did not manually remove any additional files after uninstalling.

Various visualizations, the G4Bl script I'm running (fieldmap.g4bl), a plot of the sampled electron positions, and the input and output fields are attached. If anyone has any idea about why it's behaving this way and how to fix it, I'd greatly appreciate it.

Thanks,
Paulo
printedB.txt
genericbendviz.png
genericbendfieldvol.png
B.txt
fieldmapviz.png
fieldmap.g4bl
aperture_sample.png
nofieldmapviz.png
Reply all
Reply to author
Forward
0 new messages