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
72 stars 69 forks source link

Regarding a fix in Synchrotron emission #498

Closed samatadas1 closed 2 months ago

samatadas1 commented 3 months ago

Dear all, In SynchrotronRadiation.cpp file,

SynchrotronRadiation::SynchrotronRadiation(ref_ptr field, bool havePhotons, double thinning, int nSamples, double limit) { setField(field); setBrms(0); initSpectrum(); setHavePhotons(havePhotons); setLimit(limit); setSecondaryThreshold(1e6 * eV); setMaximumSamples(nSamples); }

SynchrotronRadiation::SynchrotronRadiation(double Brms, bool havePhotons, double thinning, int nSamples, double limit) { setBrms(Brms); initSpectrum(); setHavePhotons(havePhotons); setLimit(limit); setSecondaryThreshold(1e6 * eV); setMaximumSamples(nSamples); }

setThinning(thinning) is missing. It should be included in there.

rafaelab commented 3 months ago

Hi @samatadas1 Indeed, this seems to be a bug, since setThinning is not called in the constructor. The problem should affect only the cases in which havePhoton is set to true. If you really need this feature immediately, until it is fixed, you can declare the synchrotron module and then simply add sync.setThinning(thinning) manually.