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

Made new inputs for HALEU transition analysis #123

Merged
merged 44 commits into from
Feb 14, 2022
Merged

Conversation

abachma2
Copy link
Contributor

@abachma2 abachma2 commented Feb 11, 2022

I have made a series of new input files to run simulations with multiple advanced reactors. Some of the changes include moving each of the advanced reactors to separate xml files to be read in as needed in each scenario and separate xml files for the recipes corresponding to each advanced reactor. I also created cyclus inputs and xml files to model teh NuScale VOYGR reactor alongside the X-energy Xe-100 and the USNC MMR.

I also modified the existing xml files for the LWRs by adding their current license expiration dates to the database that is read in and created to generate all of the input files for the reactors. The deployment of the reactors was also changed to the DeployInst, based on a recently merged PR in Cycamore (cyclus/cycamore#529). These changes caused the changes to most of the files in this PR, and are very small changes. This PR is not actually as big as it may seem based on the number of files changed.

Finally, there is a small changed made to the scripts/transition_metrics.py file, because I began some of the analysis and was running into issues of duplicate entries by using df.pivot. The remainder of the analysis will be included in a separate PR.

@yardasol
Copy link
Contributor

yardasol commented Feb 14, 2022

There are 116 files to view here. How many of these are generated? If the majority of them are all manual, consider using @gwenchee's strategy of splitting up groups of changes for different reviewers.

EDIT: I reread the summary. Ignore this comment.

Copy link
Contributor

@yardasol yardasol left a comment

Choose a reason for hiding this comment

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

  • Read the PR description
  • Read through all the changes, considering the following questions.
    • Is there anything you can praise about this PR? Start with
      praise.
    • Are variable names brief but descriptive?
    • Are new/changed functions no longer than a paragraph?
    • Do all function parameters have default values where appropriate?
    • Is the code clear and clean? (see Robert C. Martin's
      Clean Code)
    • Is there enough documentation?
    • Does the programming style meet the requirements of the
      repository (PEP8 for python,
      google C++ style guide, etc.)
    • If a new feature has been added, or a bug fixed, has a test been
      added to confirm good behavior?
    • Does the test actually test the new/changed functionality?
    • Does the test successfully test edge cases?
    • Does the test successfully test corner cases?
    • If the repository has continuous integration: does the PR pass
      the tests?
    • If there is no continuous integration, check out the branch
      locally, build, and run the tests.
    • Do the tests pass on your machine?
    • Is the PR free of random cruft (built files, .swp files,
      etc.)?
    • Do all files in the PR belong in the repository?
    • If the PR deletes files, is this appropriate?
    • If the PR adds files or data, are these new files compatible
      with the repository license?
    • Make a review, leaving kind comments and suggesting changes
      where needed (to resolve the above).
    • Has the author resolved all of the comments and suggestions
      in your review?
  • When you approve of the PR, merge and close it.
  • Does this PR close an issue? If so, be sure to descriptively
    close this issue when the PR is merged
  • Thank the author for their contribution.

Hi @abachma2, thanks for your contribution. Really great work here. Adding the new reactors definitely makes our "database" of reactors more thorough. I also like the separation of concerns in the xml files. Just really great stuff.

In addiotin to my in-line comments and questions, I have a few clarifying questions:

  1. For each reactor in input/haleu/inputs/united_states/reactors/., did you manually enter each lifetime value, or did you autogenerate it based on the dates in database/reactors_pris_2020.csv?
  2. What program did you use to generate the new fuel recipes? What about the HALEU input xml files?
  3. I see that you added some test for several LWR scenarios. Have you added tests for the new reactors you're adding?

Here's a list of changes that should be addressed before merging. Go ahead and check them off as you address each one:

  • typos and case/number matching in input/haleu/README.rst
  • Add descriptions for input/haleu/analysis/df_to_csv.py and input/haleu/analysis/scenario_data_analysis.ipynb in input/haleu/README.rst

Here's a list of suggested changes that I think would help this PR. These are not required to change for merging, but I would recommend at least considering each suggested change.

  • Make function names in input/haleu/analysis/df_to_csv.py more descriptive
  • Add docstrings for the new test functions in scripts/tests/test_transition_metrics.py
  • Make the new test_... functions in scripts/tests/test_transition_metrics.py have more descriptive names.

database/reactors_pris_2020.csv Show resolved Hide resolved
input/haleu/README.rst Outdated Show resolved Hide resolved
input/haleu/README.rst Outdated Show resolved Hide resolved
input/haleu/README.rst Show resolved Hide resolved
input/haleu/analysis/df_to_csv.py Outdated Show resolved Hide resolved
@@ -0,0 +1,315 @@
mat fuel6 -11.0
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this fuel recipe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a file Zoe sent me with the composition of spent fuel from her model of a pebble bed HTGR. I then used this file to create the recipe for spent Xe-100 fuel. This file does not need to actually be a part of the repo, because it's contents are contained in input/haleu/inputs/united_states/recipes/xe100_fuel.xml.

input/haleu/inputs/mmr_1percent.xml Show resolved Hide resolved
input/haleu/inputs/mmr_nogrowth.xml Outdated Show resolved Hide resolved
input/haleu/inputs/xe100_1percent.xml Show resolved Hide resolved
input/haleu/inputs/xe100_nogrowth.xml Show resolved Hide resolved
@abachma2
Copy link
Contributor Author

abachma2 commented Feb 14, 2022

I think I have made all of the requested changes. I removed the LWR input files from the repo because they can be generated using the scripts available in the repo. This was something I had been debated if it was necessary, and I think it is to help keep PRs manageable. I also removed the input/haleu/analysis/scenario_data_analysis.ipynb because it has been renamed to initial_data_analysis.ipynb but git was still tracking it. I will have another PR later for my data analysis, which will include more changes to scripts/transition_metrics.py and scripts/tests/test_transition_metrics.py as needed.

To answer your questions:

  1. The LWR inputs are all generated using scripts/create_input.py, but I manually created the advanced reactor input files because there were not as many to create.
  2. I manually created the framework for the recipe .xml files. I added the scripts I used to help create the actual recipe definitions. input/haleu/inputs/united_states/recipes/depletion_txt.py uses the depleted fuel compositions from serpent and puts them into a text file. input/haleu/inputs/united_states/recipes/txt_xml.py then reads in the text file and saves the contents to an xml file with the required formatting. The contents of the outout file is then copied into the respective .xml file to be included in the recipes for that reactor.
  3. There are currently tests for the transactions to a specific prototype (i.e. the advanced reactors). This was for when my analysis was for transitioning to a single reactor type. These may be updated as needed when I perform analysis on the new scenarios.

Let me know if I missed something.

Copy link
Contributor

@yardasol yardasol left a comment

Choose a reason for hiding this comment

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

Hi @abachma2, thanks for the updates.

Thanks for addressing my changed. And good catch on the cruft files in the repo! I think since the reactor XML files can be generated, it makes things a lot cleaner to keep them out of the PR.

There is still one "typo" in input/haleu/README.rst, which I have given detail on in an in-line comment. This needs to be fixed before merging.

I also have a question about the docstrings you made for the test functions in an in-line comment.

Since everything that's left is a small fix, I'm going to go ahead and approve and then I'll merge once you make the fix.

input/haleu/README.rst Show resolved Hide resolved
input/haleu/analysis/df_to_csv.py Show resolved Hide resolved
input/haleu/analysis/df_to_csv.py Show resolved Hide resolved
scripts/tests/test_transition_metrics.py Show resolved Hide resolved
scripts/transition_metrics.py Show resolved Hide resolved
input/haleu/inputs/united_states/recipes/depletion_txt.py Outdated Show resolved Hide resolved
input/haleu/inputs/united_states/recipes/txt_xml.py Outdated Show resolved Hide resolved
scripts/tests/test_transition_metrics.py Show resolved Hide resolved
scripts/tests/test_transition_metrics.py Show resolved Hide resolved
@abachma2
Copy link
Contributor Author

I made the new requested changes, but I'm not sure what you are talking about that needs to be fixed in input/haleu/README.rst.

@yardasol
Copy link
Contributor

I made the new requested changes, but I'm not sure what you are talking about that needs to be fixed in input/haleu/README.rst.

Right now, there is a sentence in input/haleu/README.rst that reads:

Definitions for each advanced reactor and the corresponding recipes 
is in ``inputs/united_states/reactors/'' and ``inputs/united_states/recipes'',

The subject ("Definitions for each advanced reactor and the corresponding recipes") is plural but the verb ("is") is singular. The case of the subject and verb should match, so the verb should be "are":

Definitions for each advanced reactor and the corresponding recipes
are in ``inputs/united_states/reactors/'' and ``inputs/united_states/recipes'',

Additionally, I noticed that at the end of the file path specifications, you use two single commas ('') instead of the baccent character (``). I'll make the inline comments for ya to commit

input/haleu/README.rst Outdated Show resolved Hide resolved
input/haleu/README.rst Outdated Show resolved Hide resolved
input/haleu/README.rst Outdated Show resolved Hide resolved
@yardasol
Copy link
Contributor

Don't forget to address the style comments from @pep8speaks !

@abachma2
Copy link
Contributor Author

Made those revisions and made sure to make the pep8 fixes.

@yardasol
Copy link
Contributor

Great work. Thanks for sticking with me on my comments

@yardasol yardasol merged commit 9e91f7f into arfc:master Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants