Adding atomic mass management in C++ API
Description
This adds a simple API to read store and access, atomic masses. This is merrily a transposition of the existing version in the Python API. see data.py
This should be a step toward resolving of #2756.
I still have few questions:
- shall we bind this to the Python solution (to avoid duplicates) ?
- I have added reading and storing of the binding energy and mass excess. As there is no use now for those, shall we skip reading them and storing them ?
- Where else could this be useful and leveraged ? For the plotter when no cross section are provided ?
- do you have any advice on formatting and naming ?
- any obvious place where this should be documented ?
- any things I may have forgotten ?
Checklist
- [x] I have performed a self-review of my own code
- [x] I have run clang-format (version 15) on any C++ source files (if applicable)
- [ ] I have made corresponding changes to the documentation (if applicable)
- [x] I have added tests that prove my fix is effective or that my feature works (if applicable)
This work is sponsored by First Light Fusion.
I understand this is not yet ready. I am looking for feedback to make this mergeable.
I have tested this locally, it seems to be working.
The only thing I didn't figure out is how to point to mass_1.mas20.txt proper path.
right now it is located in openmc/data/ because it is used in the Python API. Not sure how to get that path from the cpp API, and/or if I should...
thx for the review @gridley, much appreciated.
I think I have addressed most/all you comments :)
now it is failing where I expect it to,
I need access to the mass_1.mas20.txt, and I don't know where to put it to guaranty it, to where to access it from
mass_1.mas20.txt
Not sure either but perhaps the values from the txt file can just be in the same cpp file that needs the data?
the file exist in the Python API, I am wondering if there is a place where it can live and both API could access it
The problem is mass_1.mas20.txt is already present in the Python source, and installed in the Python package.
I don't know what is best:
- include all the mass data in a include file as done in
constant.h - find a way to link to the file somehow.
if we decide to do an include file, shall we add a script to generate it ? generate it on build ?
@paulromano @pshriwise do you have any opinion about this ?
Hi Baptiste, I was having some issues with with Abundances (different values in the Python API compared to what is used in MCNP) https://github.com/openmc-dev/openmc/issues/2423 https://github.com/openmc-dev/openmc/pull/2586 https://github.com/openmc-dev/openmc/pull/2585
I think it would be ideal for both of these files, atomic masses and atomic abundances to be in external files that are linked in. So there are defaults, but the user can select to read-in a user selected database. It would be best if the Python API and C++ API could do this.
The need for this PR and following PR #2105 appear again in my new job. It would be great to have a materials collection like PNNL in openmc as it appears to be a common need across a few different organisation that I've seen using using openmc