Skip to content

Removing Legendre filter in diffusion coefficient results - #1909

Merged
nelsonag merged 1 commit into
openmc-dev:developfrom
mkreher13:dif-coef-fix
Nov 22, 2021
Merged

nelsonag merged 1 commit into
openmc-dev:developfrom
mkreher13:dif-coef-fix

Conversation

@mkreher13

@mkreher13 mkreher13 commented Nov 16, 2021 •

Copy link
Copy Markdown
Contributor

@nelsonag based on our conversation, here is my solution:

Fixed issue where both P0 and P1 moments were displayed in the diffusion coefficient results. With this fix, the Legendre filter is successfully sliced so all results display only the P1 results. My fix involves modeling the code more closely after the TransportXS class.

I deleted the method for get_condensed_xs in the DiffuionCoefficient class since it wasn't working. Somehow, I failed to notice that the results from get_condensed_xs weren't condensed! Upon further investigation, I noted that the function just didn't work.

Since the MGXS get_condensed_xs method condenses the tallies before calculating the cross section, that is compatible with diffusion coefficient condensation. The most important thing is that the diffusion coefficient not be condensed, and instead have the transport cross section condensed, and then the diffusion coefficient calculated based on that condensed transport cross section. By condensing the tallies involved in the diffusion coefficient calculation, that is exactly what happens. Therefore, using the original get_condensed_xs method in the MGXS class instead makes sense and is accurate. I tested this on a simple example by making a mgxs_library that had 'transport' and 'diffusion-coefficient' specified. After running, I loaded the data and ensured that the condensed value of the diffusion coefficient was equal to 1/(3* condensed transport).

I also tested my changes in my personal branch of transient code that leverages the diffusion-coefficient. After my changes, the results were identical and my transient tests passed.

All mgxs_library test results have been updated.

…ion coefficient results. With this fix, the Legendre filter is successfully sliced. Also, there was previously concern that get_condensed_xs needed to be specially catered toward DiffusionCoefficient. However, since the MGXS get_condensed_xs method condenses the tallies before calculating the cross section, that should work great for DiffusionCoefficient as well. Tests updated.
@gridley

gridley commented Nov 16, 2021

Copy link
Copy Markdown
Contributor

"The most important thing is that the diffusion coefficient not be condensed, and instead have the transport cross section condensed, and then the diffusion coefficient calculated based on that condensed transport cross section."

are you sure about that? I could have sworn that despite it being counterintuitive, condensing 1/(3sigma_tr) preserves leakage better.

@bforget

bforget commented Nov 16, 2021 via email

Copy link
Copy Markdown

@mkreher13

mkreher13 commented Nov 16, 2021 •

Copy link
Copy Markdown
Contributor Author

You're totally right (The rule is "don't condense transport cross sections" which I always mis-remember as diffusion coefficients!!). Anyway, here, it's all the tallies that are condensed. That includes total and scatter-1 which are then used in the transport cross section. Consequently, the transport correction is re-calculated every time you condense. This seems good to me since it's as if you tallied everything with the coarser group structure.

@nelsonag

Copy link
Copy Markdown
Contributor

@mkreher13 I took a quick look now and it looks good. I compared diffusion/nu-diffusion and the transport/nu-transport results from the tests and showed they are related as we expect. In all cases that I could test, including the condensation test, this was true.

What I couldn't look at from here is the mgxs_library_nuclides test because that result is quite large and so our test reference is a hash. Could you (locally) convert that test to ASCII and check a sampling of values to ensure diffusion=1/(3*tr) and report back?
No need to change the test to an ASCII result in the repository, just looking for confirmation that those values are correct.

@mkreher13

Copy link
Copy Markdown
Contributor Author

Thanks @nelsonag! I ran the mgxs_library_nuclides test with hashing turned off. I compared the values, and I can confirm that diffusion is 1/(3*tr).

@nelsonag

Copy link
Copy Markdown
Contributor

Great @mkreher13, that sounds good to me. I've reviewed the code and it looks good to me as-is.

One last thing though any idea why test_tally_aggregation is failing?

@mkreher13

Copy link
Copy Markdown
Contributor Author

It's the 8th decimal place on a single result that's off. This has been happening to me recently, sometimes it fails, sometimes it doesn't. I can't explain it.

@nelsonag nelsonag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @mkreher13

@nelsonag
nelsonag merged commit e61db57 into openmc-dev:develop Nov 22, 2021
@nelsonag

Copy link
Copy Markdown
Contributor

Since this PR should have no impact on that particular test behavior, I will go ahead and make the merge. Thanks again @mkreher13

@mkreher13
mkreher13 deleted the dif-coef-fix branch November 22, 2021 21:31
apingegno pushed a commit to apingegno/openmc that referenced this pull request May 7, 2026
Removing Legendre filter in diffusion coefficient results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants