CRPropa / CRPropa3

CRPropa is a public astrophysical simulation framework for propagating extraterrestrial ultra-high energy particles. https://crpropa.github.io/CRPropa3/
https://crpropa.desy.de
GNU General Public License v3.0
65 stars 66 forks source link

How can I read and change disk, toroidal halo and polodial halo field parameters which have been used in class JF12Field() in CRPropa 3? #450

Closed KyleIm closed 7 months ago

KyleIm commented 7 months ago

Hello. I am looking for the uncertainty of JF12 model for given location & Energy, For this goal, I was planning to run a Monte Carlo simulation by adjusting disk, toroidal and polodial halo field parameters of JF12Field.

https://crpropa.github.io/CRPropa3/api/classcrpropa_1_1JF12Field.html

I was starting from the Library API page to figure out what I should do. According to the webpage, it says that "The regular field components (disk, toroidal halo and polodial halo field) may be turned on and off individually." However, I could not figure out how could I do that from the tutorial of the wiki page. (Maybe it is beyond the purpose of the wiki page?). Currently I want to see what values CRPropa3 is using for the 3 parameters which I mentioned and I also want to see what happens if I slightly change this values. Is this possible in CRPropa3? If possible, could you also let me know how I can do it?

ps : Sorry my knowledge in C++ is less than the basic level because I have used python for most of time. It was quite difficult to understand just reading at the manual.

JulienDoerner commented 7 months ago

hey @KyleIm,

To turn the components on or off you can use the setUse... functions. Here a short example:

  from crpropa import * 
  field = JF12Field()
  field.setUseDiskField(False) # turn off the disk field

The implemented values for the parameters can be found in the C++ file (https://github.com/CRPropa/CRPropa3/blob/master/src/magneticField/JF12Field.cpp)

If you do some changes here you have to re-compile your code. It is not possible to change these parameters from python.

lukasmerten commented 7 months ago

I guess we can close this issue. @KyleIm, please re-open the issue if anything is unclear.