Hi everyone,
I’m working through the OpenMC 0.14.0 BWR pin cell modeling tutorial and noticed an issue with the ur_opposite_water_cell definition: this cell never appears in my geometry plots, even when my plotting code is configured correctly. After a detailed geometric analysis, I suspect the cell’s region is actually an empty set, and I’d like to verify this with the community.
My Analysis & Calculations
All values are strictly extracted from the tutorial’s code, with no additional assumptions.
1. Key Parameters Extracted from Tutorial Code
Parameter: pitch (RectangularPrism width/height) → Quantified Value (cm): 1.6256
Parameter: margin (Geometric tolerance) → Quantified Value (cm): 1e-8 (≈0)
Parameter: sleave_inner_radius (0.9652 + margin) → Quantified Value (cm): ≈0.9652
Parameter: sleave_hor_bound (XPlane, x0 = pitch/2 - sleave_inner_radius - margin) → Quantified Value (cm): -0.1524
Parameter: sleave_ver_bound (YPlane, y0 = pitch/2 - sleave_inner_radius + margin) → Quantified Value (cm): -0.1524
Parameter: pin_cell_box (-RectangularPrism(width=pitch, height=pitch)) → Quantified Value (cm): x ∈ [-0.8128, 0.8128], y ∈ [-0.8128, 0.8128]
2. Region Definition of ur_opposite_water_cell
The tutorial defines the cell’s region as:
ur_opposite_water_cell.region = pin_cell_box & -ur_sleave_hor_bound & -ur_sleave_ver_bound & +ur_sleave_ir
Translating to geometric conditions:
-
pin_cell_box: x is between -0.8128 and 0.8128, and y is between -0.8128 and 0.8128
-
-ur_sleave_hor_bound: Negative side of XPlane → x < -0.1524
-
-ur_sleave_ver_bound: Negative side of YPlane → y < -0.1524
-
+ur_sleave_ir: Positive side of ZCylinder → Distance from point to sleeve center (-0.1524, -0.1524) > 0.9652
3. Critical Intersection Check
To check if any point satisfies all conditions, I evaluated the farthest point in the x < -0.1524 and y < -0.1524 sub-region of pin_cell_box:
-
Farthest point: (-0.8128, -0.8128) (bottom-left corner of pin_cell_box)
-
Distance to sleeve center:
d = sqrt((-0.8128 + 0.1524)^2 + (-0.8128 + 0.1524)^2) = sqrt((-0.6604)^2 + (-0.6604)^2) ≈ 0.9339
Since 0.9339 < 0.9652 (sleeve inner radius), no point in this sub-region can satisfy the cylinder positive side condition.
Conclusion
The four geometric conditions for ur_opposite_water_cell have no overlapping points, so the cell’s region is an empty set. This explains why it never appears in plots—it is a geometric definition issue, not a bug in my plotting code.
Request
Could other users or developers verify this analysis? Am I interpreting the region logic correctly, or is there a detail I missed in the tutorial’s setup?
Here is the relevant tutorial code snippet for reference:
ur_opposite_water_cell = openmc.Cell(name=‘ur opposite water’)
ur_opposite_water_cell.region = pin_cell_box & -ur_sleave_hor_bound & -ur_sleave_ver_bound & +ur_sleave_ir
ur_opposite_water_cell.fill = water
And my plotting code:
ur_corner_plot = openmc.Plot()
ur_corner_plot.filename = ‘ur_corner_pin_plot’
ur_corner_plot.width = (2, 2)
ur_corner_plot.pixels = (400, 400)
ur_corner_plot.color_by = ‘cell’
ur_corner_plot.colors = {uo2: ‘orange’, water: ‘blue’, zircaloy: ‘grey’}
ur_corner_plot.universe = ur_corner_pin_universe
ur_corner_plot.basis = ‘xy’
ur_corner_plot.origin = (3.5pitch, 3.5pitch, 0)
Thanks in advance for your help!
