Fixed a bug in cell last update#3849
Conversation
paulromano
left a comment
There was a problem hiding this comment.
The cell_last change alters the physical meaning of volumetric tallies with CellFromFilter. Currently, using CellFromFilter for a volumetric tally in cell B answered: "How much of the score in B comes from particles that entered B from cell A?" To me, this is a physically meaningful decomposition of scores by source cell. With the PR, cell_last always equals the current cell, so CellFromFilter for volumetric tallies no longer provides "from where" information as far as I can tell. My opinion is that we should not change the current behavior.
That being said, the fix for material_last in event_cross_surface is a legitimate bug fix so I think we should trim the PR down to just that change.
|
Maybe I missed something but I think that if we only change cell last in surface crossing then when a particle cross from cell A to cell B cell last is cell A and everything is OK. Maybe I broke cell last but @paulromano do you at least agree that the current behavior of cell last is a bug? |
|
Actually I did break cell last so I've added another unit test and edited the code until it passes. |
|
Some notes: |
This reverts commit 7bd6f0c.
|
This PR will need some serious digging. |
|
I tried to make all the tests pass at the cost of always recalculating cross sections. I understand that the cost of always recalculating xs is too much. |
|
I have been working on this part of the code several months ago and I agree with @paulromano on what we expect for the @GuySten If I understand correctly, you expect |
|
@JoffreyDorville, you understood me correctly. |
|
If the meaning of cell last and material last really should be the last cell and material before entering the current cell this should at least be better documented. |
Description
Currently, cell_last is assigned only in surface crossing events.
This PR fix that and now this data is set also after collision.
EDIT:
This PR also fix material_last update to make CellFromFilter and MaterialFromFilter consistent.
@paulromano, can you look into this?
This is a subtle change and I am not 100 percent sure this fix the problem.
This issue does change regression tests.
Checklist
I have followed the style guidelines for Python source files (if applicable)I have made corresponding changes to the documentation (if applicable)I have added tests that prove my fix is effective or that my feature works (if applicable)