-
Notifications
You must be signed in to change notification settings - Fork 72
Separate photon sampling from SOPHIA #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate photon sampling from SOPHIA #260
Conversation
… to simuation so far
minor re-labeling
- minor format changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work - there are still some readability issues that I noted. Also, please try to make the review not harder than necessary by changing lines without reason. This is in particular true for the old fortran code, where you changed several thousands of lines, and a lot are e.g. changes of capitalizations of print to PRINT. This does not help in understanding what happened.
Thanks lot @TobiasWinchen for the fast reply! I have implemented your feedback on all your points up to my best understanding. Regarding the changes in SOPHIA: Sorry, I should have elaborated more on what actually changed.
What you were seeing here was the maximal solution and I totally see how this is confusing at first glance. For the sake of a more efficient review, I will change sophia_interface.f to the minimal solution to ease this step of iteration while hoping to get to the maximal solution later on. |
- out-comment all methods involving photon sampling - change interface signature of sophiaevent(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my comments. There is IMO one major issue left with the gauss integration I missed before.
@TobiasWinchen I confirm this. The idea is to clear the SOPHIA code as much as possible from unneeded parts, so that we can focus on what really matters and proceed with fixing and improving PPP. The current implementation of PPP with SOPHIA is not only slow (cannot be parallelized beyond 8+ threads) and unmaintainable (totally unreadable), but also lacking the sampling on other photon fields which some users consider as a bug (because it was not explicitly stated). Thus, Mario's work here is more like a bug fix, not a new feature implementation. Therefore, keeping the old state of the code in parallel in this case is not reasonable. After this commit, or how Mario calls it, the zeroth step, we can proceed with new contributions which can be checked systematically against the old one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tobias covered all needed changes that I can think of already. My only suggestion is that we start to use more strict types in interfaces (such as the enum class) across the code to make the code more readable, and to try catching as many bugs as we can during the compile time, not run time.
On Tuesday 7 January 2020 10:53:08 CET Andrej Dundovic wrote:
> * @adundovi and me concluded that, since we are modifying SOPHIA
> anyways, we should aim for the maximal amount of code reduction we
> are able to achieve given the change of the CRPropa/SOPHIA interface.
@TobiasWinchen I confirm this. The idea is to clear the SOPHIA code as much
as possible from unneeded parts, so that we can focus on what really
matters and proceed with fixing and improving PPP. The current
implementation of PPP with SOPHIA is not only slow (cannot be parallelized
beyond 8+ threads) and unmaintainable (totally unreadable), but also
lacking the sampling on other photon fields which some users consider as a
bug (because it was not explicitly stated). Thus, Mario's work here is more
like a bug fix, not a new feature implementation. Therefore, keeping the
old state of the code in parallel in this case is not reasonable. After
this commit, or how Mario calls it, the zeroth step, we can proceed with
new contributions which can be checked systematically against the old one.
I agree that we should remove unused code, but changing e.g. capitalizations
from print to PRINT at the same time just blows up the commit and makes the
review harder.
|
Oh, sorry, I, of course, agree with that. |
Thanks all again for your useful comments. I am happy to resolve the integration part and consider enums for sophia particles. May I also emphasise that, based on your comments, the current version of the suggested SOPHIA code refrains from any cosmetics and only out-comments code which is not used as it is related to internal photon sampling (i.e. to be deleted later or now). The interface itself in |
@Froehliche-Kernschmelze I have just tried to write you more code snippets for the special SophiaParticle type and realized that with the current state of the implementation where sophiaEvent() and performInteraction() methods are separated while doing the same PID conversion, it makes little sense to do what I suggested. So please, skip the suggestion for the moment. We'll do it later when we merge sophiaEvent() into performInteraction(). |
- enable variable function use in Gauss integration - this is a buggy commit, a problem has to be resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this PR now. Some parts will obviously be reworked once sampling on other field models are introduced, but as an intermediate step, these changes are fine.
Thanks again to you two. Before we merge,
|
Are those the same tests you already presented in the last CRPropa call? If yes, this is OK, we don't need to go through these checks again.
Yes, please. Just don't change "print" to "PRINT" or similar things that are complicating the review process.
Is this the old sampling part? If yes, remove them too as we agreed. If this is something else, keep it for the next PR. |
The test scripts above are identical to the tests I had presented, however, on a wider selection of parameters. The proposed tests conduct tests on all combinations of:
and compare the results of this PR to the master branch via KS tests.
All right, I will delete the sampling-related parts in this case. Everything else will be subject to another PR. |
… re-implemented in C++
@TobiasWinchen shell we merge it now? |
Dear all,
this PR extracts the internal SOPHIA photon sampling methods and re-implements them in CRPropa.
This is a necessary preparatory step towards the implementation of variable photon fields as discussed in #220 (sometimes referred to as "step zero" in the agreed road map). The changes are:
This PR comes with scripts which
To make a review easier:
Important remarks:
Please do get in touch at any given point!