-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update to use OpenMC v0.14.0, update documentation #19
Conversation
commented out to prevent running test that is known to fail
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.
Hi @abachma2,
I can tell you put a lot of work into this. Nice job. My comments are below.
.github/workflows/unit-test.yml
Outdated
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.
Consider bundling these changes into the existing test-openmcyclus
workflow.
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.
Are you referring to the build process? Or the tests themselves? I was planning on streamlining the build process in a different PR so this one didn't get too big.
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 do plan to have another PR later on for checking if the CHANGELOG is updated. I'm not sure if that's what you were referring to here.
README.rst
Outdated
~ $ conda install -y gxx_linux-64 gcc_linux-64 cmake make git glib libxml2 libxmlpp-4.0 liblapack pkg-config coincbc boost-cpp hdf5 sqlite pcre setuptools pytest pytables pandas jinja2 cython websockets pprintpp pip mamba | ||
|
||
~ $ mamba install -y openmc=0.14.0 scipy=1.11 | ||
|
||
~ $ git clone https://github.com/cyclus/cyclus.git | ||
|
||
~ $ cd cyclus | ||
|
||
~/cyclus $ python install.py |
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.
If people try to run these commands there will be errors. I get what you're going for, trying to emulate what the terminal would look like. Just something to consider.
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.
What do you mean? These are the commands I put into my terminal. Is it because of the ~ $
formatting? I'm trying to show some of the directory structure for being inside the cyclus directory to install it. Do you have any suggestions for how it might be clearer?
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.
Yes, I am referring to the ~ $
formatting. If your intention is more to show how these commands would be in a terminal rather than have users copy and paste them, then this is fine.
openmcyclus/depletion.py
Outdated
@@ -165,16 +162,15 @@ def get_spent_comps(self, material_ids, path): | |||
list of the compositions from the OpenMC model | |||
''' | |||
results = od.Results(path + "depletion_results.h5") | |||
nuclides = od.MicroXS.from_csv(path+"micro_xs.csv").nuclides |
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.
Why load in the MicroXS
object again? Why not just use self.micro_xs.nuclides
?
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.
Because I don't actually initialize that object with the class. That might be a cleaner way to do this though. I don't have strong feelings either way. I think initially I was thinking that you wouldn't always need that, but it also might be good to initialize the materials with the class as well.
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 giving this a shot (initializing the cross sections and materials with the class) see the changes in commit c1d7d2
and let me know what you think.
assert spent_comps[0][922350000] == 10.650004036820036 | ||
assert spent_comps[0][942390000] == 0.22663550016678385 |
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.
Might be more robust to have a reference_depletion_results.h5
that you load in and compare against the spent comps. Not sure if it's that simple with Cyclus.
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.
That's probably a cleaner way to do, and more regression style.
Initializing these objects with the class removes extra calls to the files, and removes the need for the methods to create the objects. Still need to test out with Cyclus integration, but unit tests pass
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.
Hi @abachma2,
Good work on these changes. My other comments are below. I think this is getting pretty close, so I'm going to tentatively approve.
openmcyclus/depletion.py
Outdated
def read_materials(self, path): | ||
''' | ||
Read in the materials file for OpenMC | ||
|
||
Parameters: | ||
----------- | ||
path: str | ||
path to the materials.xml file | ||
self.microxs = od.MicroXS.from_csv(str(path + "micro_xs.csv")) | ||
self.materials = openmc.Materials().from_xml(str(path + "/materials.xml")) | ||
|
||
Returns: | ||
--------- | ||
materials: openmc.Material object | ||
Materials for OpenMC | ||
''' | ||
materials = openmc.Materials() | ||
materials = materials.from_xml(str(path + "/materials.xml")) | ||
return materials |
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.
Good change. This was a lot for just two lines of code.
openmcyclus/depletion.py
Outdated
self.microxs = od.MicroXS.from_csv(str(path + "micro_xs.csv")) | ||
self.materials = openmc.Materials().from_xml(str(path + "/materials.xml")) |
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!
These objects are already initialized in the enter_notify method of the DepleteReactor, and initializing them in the Depletion class doesn't work when running the archetype. This method requires more Depletion class method inputs, but it all runs
So it turns out that initializing the |
THe new version of these codes (v1.6) is now live in conda, and it'll be easier to install them using this method.
Bumping this for review if anyone is available right now. |
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.
Hi @abachma2. Good job as always. I have a few more suggestions for you. Apologies for the long wait on this.
# ss = str(len(assemblies)) + " assemblies" | ||
# self.record("TRANSMUTE", ss) |
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.
Consider removing these if they are not going to be used.
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.
Any instances of the record method are intended to be there, but I need to dig into the cyclus python API for writing to the database some to make sure it all works as it should/does in the c++ api
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.
Can you explain the purpose of having this method present in the code but commented out? Is there still something you are debugging? Or does it need to be there commented out to work properly?
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.
The self.record
method writes information to the database, and in this case trying to record when different reactor-related events occur. When I was working on this archetype, I noticed that it this method wasn't working as expected, likely because of how the Cyclus python API implements it. So I commented it out to prevent it from hindering other development work on the archetype. I didn't remove it, because I do want this functionality in the code, but it's not crucial. I will make an issue about getting this working to make sure it doesn't get forgotten.
Thanks for the feedback @yardasol! It should all be addressed now. |
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.
Hi @abachma2,
Good work here. Just a couple more fixes and we should be g2g.
# ss = str(len(assemblies)) + " assemblies" | ||
# self.record("TRANSMUTE", ss) |
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.
Can you explain the purpose of having this method present in the code but commented out? Is there still something you are debugging? Or does it need to be there commented out to work properly?
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.
Great job @abachma2! Sorry this PR took so long to review.
Thanks for the approval @yardasol. Are we waiting on something else for this to be merged? |
This PR does some updates to the archetype library to be compatible with OpenMC v0.14.0. A full list of changes in this PR (it suffers from scope creep unfortunately):
DepleteReactor
archetype to now accept thermal power (instead of just using thepower_cap
parameter for depletion) and flux (required input for OpenMCIndependentOperator
Depletion
class to be compatible with OpenMC v0.14.0, and associated testsopenmcyclus.Depletion
class to CI (with help from @ceserz2)examples/micro_xs.csv
to format used in OpenMC v0.14.0examples
directory to include the new parameters added toDepleteReactor
comparison/materials.xml
andcomparison/chain_endfb71_pwr.xml
for better reproduction of running the benchmark directorycomparison/OpenMC.ipynb
for OpenMC v0.14.0