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

adding wedge shaped option to DAGMCUniverse.bounded_universe() #3236

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

shimwell
Copy link
Member

@shimwell shimwell commented Dec 20, 2024

Description

This PR adds and boundary_type=wedge to the universe.bounded_universe method.

This is useful for making sector models of fusion reactions and I sure other models as well where we typically require a couple of reflecting planes, cylinder outside and upper and lower planes

Here is a minimal example

import openmc
universe = openmc.DAGMCUniverse(filename="/
dagmc.h5m")
bounded_universe = universe.bounded_universe(bounded_type='wedge', wedge_angles=(0, 90))
geometry = openmc.Geometry(root=bounded_universe)
mat1=openmc.Material(name="mat1")
mat1.add_nuclide("H1",1.0)
mat1.set_density("g/cm3",0.01)
materials= openmc.Materials([mat1])
settings=openmc.Settings()
model = openmc.Model(geometry=geometry,materials=materials, settings=settings)
model.export_to_model_xml()
# then plot

Screenshot from 2024-12-20 23-44-47

Fixes # (issue)

Checklist

  • I have performed a self-review of my own code
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@shimwell shimwell requested a review from pshriwise as a code owner December 20, 2024 22:57
openmc/universe.py Outdated Show resolved Hide resolved
Comment on lines +1088 to +1094
radius_upper_right = np.linalg.norm(
np.array(bbox[0][0], bbox[0][1]) - np.array([0.0, 0.0])
)
radius_lower_left = np.linalg.norm(
np.array(bbox[1][0], bbox[1][1]) - np.array([0.0, 0.0])
)
radius = max(radius_upper_right, radius_lower_left)
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
radius_upper_right = np.linalg.norm(
np.array(bbox[0][0], bbox[0][1]) - np.array([0.0, 0.0])
)
radius_lower_left = np.linalg.norm(
np.array(bbox[1][0], bbox[1][1]) - np.array([0.0, 0.0])
)
radius = max(radius_upper_right, radius_lower_left)
radius = max(abs(bbox[0][0]), abs(bbox[0][1]), abs(bbox[1][0]), abs(bbox[1][1]))

I think this can be simplified in this cylindrical surface case

@shimwell
Copy link
Member Author

@shimwell conflicts have crept in to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant