Implement vector fitting to replace external vectfit package#3493
Implement vector fitting to replace external vectfit package#3493paulromano merged 23 commits intoopenmc-dev:developfrom
vectfit package#3493Conversation
|
This PR is currently a draft. The code is a copy-pasting of the suggestion by chatGPT provided by Paul. |
|
Hello guys, I've taken the time to re-implement the code using NumPy and SciPy. The unit tests are adapted from Jingang Liang’s implementation for consistency. To validate the results, I generated WMP data from ENDF/B-VII for both Na-23 and Fe-56, and ran both implementations on these datasets. I will soon share plots comparing the absolute error in absorption cross sections between the two codes but there almost 0. I also benchmarked the compute time, though I haven’t yet post-processed those results. In any case, I believe this additional performance data isn’t critical for this PR. |
vectfit package
paulromano
left a comment
There was a problem hiding this comment.
@azimgivron Thanks so much for going through this conversion! I made a few small updates on your branch but otherwise it looks pretty good. I do have one important question about a scaling below (wondering if this is affecting the results) below:
|
Hi, is this PR blocked because something is expected from me ? |
|
@azimgivron Any chance you can update the results you had shared above with the normalization correction? I'm curious how much of the relative error shown before may be due to that. |
|
This PR looks ready to be merge for me. |
|
A relative error of 3% in the Fe56 cross section seems unacceptable to me, especially with no specific explanation of why they are different. Another way of looking at this would be to ask how close the WMP-evaluated cross section is relative to the original tabular data that it is fitting. As far as I'm aware, it should do much better than 3%. Looking at this paper, vector fitting should be able to match cross sections within 0.1%. |
|
@paulromano, what do you think should be done? According to my testing the vector fitting that we already have more than 5% error and by using the python version it get reduced to around 3%. I think that the fact that the vector fitting is done currently using cpp code that without the docker image @azimgivron made I could not manage to install is a big barrier for users. So I would not be surprised that it has bugs no one noticed. EDIT: |
|
That's very interesting. I didn't realize that the original was that far off. @bforget do you have any ideas on why the original implementation that @liangjg put together would be off by that much? Regarding cross sections not going up to 20 MeV -- I believe that is by design as the vector fitting is only needed over the resolved resonance range. At fast energies it is assumed there is effectively no temperature dependence (which obviates the need for WMP data). In any case, given the data you've shared, I would be more amenable to getting this merged and tagging this as an issue to be looked into further as to why the comparison with ENDF data doesn't look great. I'll give the PR a final look as soon as I can. |
paulromano
left a comment
There was a problem hiding this comment.
I made a few small changes here and I think this is good to go now. I'll leave this open until tomorrow in case there are any final comments. Many thanks to you both @azimgivron and @GuySten!







Description
This pull request removes the dependency on the unmaintained external
vectfitpackage (https://github.com/liangjg/vectfit) used in OpenMC's windowed multipole (WMP) infrastructure. In its place, a vector fitting is introduced based on thevectorFitting.pymodule fromscikit-rfproject.The implementation will be made in several steps as suggested by Paul:
This change improves long-term maintainability and compatibility of OpenMC.
Fixes #3487
Checklist