mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Fix 'boxes' example to have complement and union
This commit is contained in:
parent
4c2e0f5f82
commit
bb4608cf13
4 changed files with 29 additions and 4 deletions
|
|
@ -80,10 +80,11 @@ outer_box = openmc.Cell(cell_id=3, name='outer box')
|
|||
inner_cube = +x3 & -x4 & +y3 & -y4 & +z3 & -z4
|
||||
middle_cube = +x2 & -x5 & +y2 & -y5 & +z2 & -z5
|
||||
outer_cube = +x1 & -x6 & +y1 & -y6 & +z1 & -z6
|
||||
outside_inner_cube = -x3 | +x4 | -y3 | +y4 | -z3 | +z4
|
||||
|
||||
# Use surface half-spaces to define regions
|
||||
inner_box.region = inner_cube
|
||||
middle_box.region = middle_cube & ~inner_cube
|
||||
middle_box.region = middle_cube & outside_inner_cube
|
||||
outer_box.region = outer_cube & ~middle_cube
|
||||
|
||||
# Register Materials with Cells
|
||||
|
|
@ -116,3 +117,18 @@ settings_file.inactive = inactive
|
|||
settings_file.particles = particles
|
||||
settings_file.set_source_space('point', [0., 0., 0.])
|
||||
settings_file.export_to_xml()
|
||||
|
||||
###############################################################################
|
||||
# Exporting to OpenMC plots.xml File
|
||||
###############################################################################
|
||||
|
||||
plot = openmc.Plot(plot_id=1)
|
||||
plot.origin = [0, 0, 0]
|
||||
plot.width = [20, 20]
|
||||
plot.pixels = [200, 200]
|
||||
plot.color = 'cell'
|
||||
|
||||
# Instantiate a PlotsFile, add Plot, and export to XML
|
||||
plot_file = openmc.PlotsFile()
|
||||
plot_file.add_plot(plot)
|
||||
plot_file.export_to_xml()
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@
|
|||
<cell id="1" material="1" region="3 -4 13 -14 23 -24" />
|
||||
|
||||
<!-- Middle cubic shell -->
|
||||
<cell id="2" material="2" region="2 -5 12 -15 22 -25 ~(3 ^ -4 ^ 13 ^ -14 ^ 23 ^ -24)" />
|
||||
<cell id="2" material="2" region="2 -5 12 -15 22 -25 (-3 | 4 | -13 | 14 | -23 | 24)" />
|
||||
|
||||
<!-- Outermost cubic shell -->
|
||||
<cell id="3" material="3" region="1 -6 11 -16 21 -26 ~(1 ^ -5 ^ 12 ^ -15 ^ 22 ^ -25)" />
|
||||
<cell id="3" material="3" region="1 -6 11 -16 21 -26 ~(2 -5 12 -15 22 -25)" />
|
||||
|
||||
</geometry>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
<material id="3">
|
||||
<density value="1.0" units="g/cc" />
|
||||
<nuclide name="H-1" ao="2.0" />
|
||||
<nuclide name="O-16" ao="1.0" />
|
||||
<nuclide name="H-1" ao="2.0" />
|
||||
<sab name="HH2O" xs="71t" />
|
||||
</material>
|
||||
|
||||
|
|
|
|||
9
examples/xml/boxes/plots.xml
Normal file
9
examples/xml/boxes/plots.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
<plot id="1" type="slice">
|
||||
<color>cell</color>
|
||||
<origin>0. 0. 0.</origin>
|
||||
<width>20. 20.</width>
|
||||
<pixels>200 200</pixels>
|
||||
</plot>
|
||||
</plots>
|
||||
Loading…
Add table
Add a link
Reference in a new issue