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

Any idea on how to implement a uniform distribution energy spectrum without using weights? #395

Closed DarKnight48 closed 2 years ago

DarKnight48 commented 2 years ago

I want to run a toy simulation using a uniform distribution for the energy spectrum to have enough statistical data for the high-energy part. Currently, I can't do this within a reasonable amount of computing time with the built-in Power-law spectrum. I know it can be done using weights, but this is not what I need because I want to reduce the computation time.

It would be great if the possible solution can extend to any kind of distribution of the energy spectrum. Thanks in advance

lukasmerten commented 2 years ago

I am not exactly sure what you are asking for.

There are only two option to model a certain injected spectrum dN/dE \propto E^\alpha: a) Use the build-in power law spectrum of the source class with the correct power law index \alpha b) Use the build-in power law spectrum with a different power law index \beta and apply a reweighting based on the energy at source E_0 and the power law indices \alpha and \beta in your post-processing.

I have no idea how changing the injection of particles could save computation time on a basis of individual simulation runs. So I suggest to like at the time consuming parts of your simulation and try to optimize them.

However, we cannot give any support in this direction.