Skip to content
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 material compositions #14

Merged
merged 91 commits into from
Jun 28, 2023
Merged

Update material compositions #14

merged 91 commits into from
Jun 28, 2023

Conversation

abachma2
Copy link
Collaborator

@abachma2 abachma2 commented Jun 6, 2023

This PR includes:

  • new functionality to update the material compositions in the assemblies of the OpenMC model based on the material in the core in the Cyclus simulation
  • pass the depleted compositions from the OpenMC results file to the archetype as a list of dictionaries.
  • moved the OpenMC model files to the examples/ directory so that all of the example/test files are in the same location.
  • Removed an unneeded file that got added to the repo for some reason (materials.xml)
  • Update README to include more detail about assumptions in the archetype.

The CI fails because of compatibility issues between Cyclus and OpenMC (see issue #12). CI will be cleaned up some in a future PR.

Need to figure out way to convert ZAIDs to nucnames (e.g.
U235). Also need to figure out a way to determine whether to use
atom fraction or weight fraction based on cyclus input definition.
The naming required is for the fuel-containing materials to be called
assembly_#. Th enew geometry is three spheres surrounded by water,
all contained in a larger sphere. Each smaller sphere is meant to
be a different assembly.
The dictionary of compositions provided by Cyclus is always
a weight fraction.
OpenMC needs a nucname (e.g., U235) for the nuclide names,
these additions convert the ZAID from Cyclus compositions to
the nucname for use in OpenMC
The file meant to be read into Cyclus is in the examples directory, not
in the test diestory with the OpenMC files. Should change this location
in a future commit.
Changed passing the prototype name as a class argument to
a method argument because something wasn't being passed correctly
when defined as a class argument
@abachma2
Copy link
Collaborator Author

@samgdotson I have updated the CI to have Cyclus and OpenMC. The integration tests are failing, as expected. It doesn't provide much of an error message as to why, so it doesn't help with information on the seg fault.
https://github.com/arfc/openmcyclus/actions/runs/5380553242/jobs/9763428258

@samgdotson
Copy link
Contributor

Good job updating the CI. Just to clarify, the integration tests pass locally but not on github, correct? The reason the tests show a "table not found" error is because cyclus doesn't run properly?

@abachma2
Copy link
Collaborator Author

I believe that's what's happening in the CI, yes. Directly running the tests, they don't pass locally, because the seg fault interrupts the testing before it can compare values. But comparing the output database to the expected values, they do match.

@abachma2
Copy link
Collaborator Author

Now that the CI is up to date, is this ready to be merged?

Copy link
Contributor

@samgdotson samgdotson left a comment

Choose a reason for hiding this comment

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

It's nearly ready. You should definitely review your code for consistency with numpydoc, overall. I added suggestions where possible. Some suggestions make look insignificant (var: type vs var : type) but it will affect proper formatting if you publish the docs. Also, the environment.yml and requirements.txt files are not the same, which could be problematic for maintenance.

@@ -3,6 +3,50 @@ channels:
- conda-forge
- defaults
dependencies:
- numpy
Copy link
Contributor

Choose a reason for hiding this comment

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

is numpy really not used in this package?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe not. I just always add numpy as a force of habit.

Cyclus.


Parameters:
Copy link
Contributor

Choose a reason for hiding this comment

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

Numpydoc does not have a : after a header. Just the underscores! See the numpydoc docs.

Suggested change
Parameters:
Parameters

path: str
path of directory holding the files for/from OpenMC

Returns:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Returns:
Returns

Comment on lines +72 to +76
comp_list: list of dicts
list of the fresh fuel compositions present in the core
at the calling of the transmute function.
path: str
path of directory holding the files for/from OpenMC
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
comp_list: list of dicts
list of the fresh fuel compositions present in the core
at the calling of the transmute function.
path: str
path of directory holding the files for/from OpenMC
comp_list : list of dicts
List of the fresh fuel compositions present in the core
at the calling of the transmute function.
path : str
Path to the directory holding the files for/from OpenMC

Comment on lines +80 to +81
material_ids: list of strs
material id numbers for the OpenMC model
Copy link
Contributor

Choose a reason for hiding this comment

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

Numpydoc style

Suggested change
material_ids: list of strs
material id numbers for the OpenMC model
material_ids : list of strs
Material identification numbers for the OpenMC model.

Comment on lines +140 to 146
path: str
path of directory holding the files for/from OpenMC

Outputs:
--------
depletion_results.h5: database
HDF5 data base with the results of the depletion simulation
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the function returns None I would simply leave out the second part of this and describe it in the main part of the docstring. E.g. "writes to an HDF5 database called depletion_results.h5 with the simulation results."

Suggested change
path: str
path of directory holding the files for/from OpenMC
Outputs:
--------
depletion_results.h5: database
HDF5 data base with the results of the depletion simulation
path : str
path of directory holding the files for/from OpenMC.

Comment on lines 171 to +176
Parameters:
-----------
material_id: list of strs
material ids for the assembly materials in the OpenMC model
path: str
path of directory holding the files for/from OpenMC
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Parameters:
-----------
material_id: list of strs
material ids for the assembly materials in the OpenMC model
path: str
path of directory holding the files for/from OpenMC
Parameters
-----------
material_id : list of str
Material ids for the assembly materials in the OpenMC model.
path : str
Path to the directory holding the files for/from OpenMC.


Outputs:
Returns:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Returns:
Returns

Comment on lines +180 to +181
spent_comps: list of dicts
list of the compositions from the OpenMC model
Copy link
Contributor

Choose a reason for hiding this comment

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

dicts isn't a python type, but dict is.

Suggested change
spent_comps: list of dicts
list of the compositions from the OpenMC model
spent_comps : list of dict
List of the compositions from the OpenMC model.

pytest
Copy link
Contributor

Choose a reason for hiding this comment

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

Numpy is in requirements.txt but NOT in environment.yml. Which one is correct? Do you need both files?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think numpy is needed, so it will be removed. I'm not sure if both files are needed right now. I have gotten the CI into a stable configuration, but definitely not the final one. Things to be done in the CI include installing Cyclus and Cycamore from branches off my forks to use the most updated versions, instead of an out-of-date docker image (or updating the docker image). One I update the builds to the most current versions, I will determine if both of these files are needed.

@abachma2
Copy link
Collaborator Author

Hi @samgdotson. Thanks for the review and the suggestions to make it easier to publish the docs. I currently have no intentions of publishing the documentation of this repo, especially since most of the methods in the archetype and Depletion classes won't be seen or used directly by users.

@abachma2 abachma2 requested a review from samgdotson June 27, 2023 18:42
Copy link
Contributor

@samgdotson samgdotson left a comment

Choose a reason for hiding this comment

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

I don't want to be difficult or obstructive, but I think you should reevaluate the practice of leaving your code littered with commented debug statements. If your code is still in development perhaps this should be merged into a "dev" branch and leave the main branch for the final clean versions.

If you really want this pushed through, then you can request my review again and I will merge it.

@abachma2
Copy link
Collaborator Author

If the only thing blocking you from merging right now is the print statements, I can remove them in this PR.

The switch to transmuting only some assemblies was madde in error
when resolving a conflict with the main branch
@abachma2 abachma2 requested a review from samgdotson June 28, 2023 13:25
@samgdotson samgdotson merged commit 23a466a into arfc:main Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Comp:Build This issue has to do with the build system of the code/doc (makefiles, cmake, install errors) Comp:Output This issue has to do with the output component of the code or document. (writing to databases, etc.) Difficulty:2-Challenging This issue may be complex or require specialized skills. Priority:2-Normal This work is important and should be completed ASAP. Status:5-In Review This issue has been handled, and the solution is being reviewed. (probably as a PR) Type:Feature New feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants