KATRIN-Experiment / Kassiopeia

Simulation of electric and magnetic fields and particle tracking
https://katrin-experiment.github.io/Kassiopeia/index.html
Other
47 stars 29 forks source link

Feature/integrating b solver #118

Closed pslocum closed 1 month ago

pslocum commented 2 months ago

Following a brief test with a single off-center finite wire segment defined by 2 points, I am noticing that the B-field is being calculated 3 times using Biot-Savart, and is being accumulated. This causes the output B fields to be too high by 3x. I am suggesting a possible workaround such that the accumulation is removed. However, there may be a better way to think about this. The config files that I am using are here. Thanks in advance for any thoughts. image

richeldichel commented 2 months ago

Hi @pslocum, thanks for your message. Unfortunately, we get a 404 error for your config that you provided via the link. It would be great if you could fix this so that we can have a look.

pslocum commented 2 months ago

Hi @Richard Salomon @.***>, apologies for the 404. The config files have now been placed here https://github.com/pslocum/configFiles.git.

On Tue, Oct 1, 2024 at 3:02 AM Richard S @.***> wrote:

Hi @pslocum https://github.com/pslocum, thanks for your message. Unfortunately, we get a 404 error for your config that you provided via the link. It would be great if you could fix this so that we can have a look.

— Reply to this email directly, view it on GitHub https://github.com/KATRIN-Experiment/Kassiopeia/pull/118#issuecomment-2384955789, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBROLKW5JHMDHZOQYUXZLZZJCI3AVCNFSM6AAAAABPEQZVW6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBUHE2TKNZYHE . You are receiving this because you were mentioned.Message ID: @.***>

richeldichel commented 1 month ago

Hi @pslocum, thanks for identifying this. It seems that the rod_space is added 3 times to the electromagnet container instead of just once. I am not sure at the moment, why that is the case, but your workaround is probably only applicable to the specific case where you have only one geometry element for the field calculation. I need to investigate further what happens when the container is created. Will keep you updated!

pslocum commented 1 month ago

Hi @richeldichel, thanks for the update. And please keep me posted with any additional steps or checks that would be useful.

richeldichel commented 1 month ago

I think I have found the culprit! In line 46 of your config Ioffe_V09_Activated.xml you define the following electromagnet:

<electromagnet name="electromagnet_solenoid" spaces="@ioffe_magnet_tag" current="[ioffe_current]"/>

Here you define the spaces to be used via spaces="@ioffe_magnet_tag". This definition is ambiguous in the sense that the magnet tag is contained in three (nested) spaces. Therefore, the electromagnet container contains the spaces of @ioffe_magnet_tag three times, which leads to the incorrect sum of the magnetic field. If you select e.g. spaces="project8_ioffe_assembly/@ioffe_magnet_tag", only the one space from this geometry path is included in the container and I get the correct sum.

To make this mistake more visible, I will create a PR that adds a warning when a tag is encountered in a place where a path is expected.

pslocum commented 1 month ago

Hi @richeldichel, thank you very much for identifying this. And yes, as you point out, it will be helpful to have a warning when the full geometry path is needed instead of just the tag. Thanks again!

richeldichel commented 1 month ago

Closing this in favor of #119