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

Add method to get toroidal models, add parastell tool, overhaul text wrapping, allow more generalized text in plot #13

Merged
merged 29 commits into from
Jul 18, 2024

Conversation

Edgar-21
Copy link
Contributor

@Edgar-21 Edgar-21 commented May 12, 2024

This is branched off the branch in #11 (superseding it), and includes the from_parastell_build() method. I was doing some things with toroidal geometries today and felt it would be a good time to wrap that tool into this.

Plotting
I renamed plot_radial_build.py to radial_build.py to reflect that the script now does more than just make the plots. The main class, radial_build() now only requires the 'build' dict to initialize. Relevant plotting parameters can be passed to the plot_radial_build() method, and are available throughout the class. These have a default value of None until the plotting function is used but I think that will be ok since I don't imagine these parameters getting used for anything aside from plotting.

Model Building
A method that returns a model with toroidal geometry that reflects the build dict was added. If it is desired to use this method the build dict must have a "material" corresponding to an openmc material. This is indicated in the docstring, and if it is not present the method should throw a helpful error. Also returned is a dictionary mapping the build keys (layer names) to corresponding cell instances, which is useful for defining filters later.

Examples
Updated the examples to use the new function calls, and added an example for using the toroidal model builder.

closes #10
closes #5

@gonuke
Copy link
Member

gonuke commented Jun 7, 2024

Let's remember to keep individual PRs small and focused :)

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

A few suggestions here, but this looks like a great topic for a software meeting

examples/.gitignore Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated
f'{layer["description"]}',
self.max_characters,
drop_whitespace=False
)
Copy link
Member

Choose a reason for hiding this comment

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

move rstrip() here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since either, both, or neither of the "composition" and "description" keys may be present the rstrip() works best in its current location, I think its the simplest, otherwise logic needs to be in place to check what combination of keys were specified.

radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated
name=layer,
fill=layer_def['material'])
materials.append(layer_def['material'])
except KeyError as e:
Copy link
Member

Choose a reason for hiding this comment

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

test input validity at beginning of function and then cleaner code with guaranteed valid input

Copy link
Contributor Author

Choose a reason for hiding this comment

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

splitting these into separate classes makes me happy to just not check input for now, I will defer to your judgement however

radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
radial_build.py Outdated Show resolved Hide resolved
@Edgar-21 Edgar-21 marked this pull request as draft June 8, 2024 00:01
@Edgar-21 Edgar-21 marked this pull request as ready for review June 9, 2024 17:51
@Edgar-21
Copy link
Contributor Author

Edgar-21 commented Jul 2, 2024

I made updates incorporating suggestions from the last round of reviews, adding the ability to specify a list of materials for each layer along with volume fractions and have them be mixed, into a new material, along with tweaking the command line interface so that yml files can be used for both toroidal models and radial build plots.

These changes are here, Edgar-21#1, I can just merge them to this branch if that is more convenient. I split it out for now so it is more obvious what changes have been made since the last review.

Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

A few more changes in a final(?) cleanup

radial_build_tools.py Outdated Show resolved Hide resolved
radial_build_tools.py Outdated Show resolved Hide resolved
radial_build_tools.py Show resolved Hide resolved
radial_build_tools.py Outdated Show resolved Hide resolved
radial_build_tools.py Show resolved Hide resolved
radial_build_tools.py Outdated Show resolved Hide resolved
radial_build_tools.py Outdated Show resolved Hide resolved
radial_build_tools.py Outdated Show resolved Hide resolved
Copy link
Member

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

One question in the example....

examples/make_toroidal_model_example.py Outdated Show resolved Hide resolved
@gonuke gonuke merged commit 798c65d into svalinn:main Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants