-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeometry.py
More file actions
70 lines (57 loc) · 2.12 KB
/
Copy pathgeometry.py
File metadata and controls
70 lines (57 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import openmc
import matplotlib.pyplot as plt
fuel = openmc.Material(name='Uranium Fuel')
fuel.add_element('U', 1.0, enrichment=4.5)
fuel.add_element('O', 2.0)
fuel.set_density('g/cm3', 10.3)
cladding = openmc.Material(name='Zircaloy Cladding')
cladding.add_element('Zr', 1.0)
cladding.set_density('g/cm3', 6.55)
water = openmc.Material(name='Water Coolant')
water.add_element('H', 2.0)
water.add_element('O', 1.0)
water.set_density('g/cm3', 0.75) # I cant remember why I did this
control_rod_mat = openmc.Material(name='Control Rod Material')
control_rod_mat.add_element('B', 4.0)
control_rod_mat.add_element('C', 1.0)
control_rod_mat.set_density('g/cm3', 2.52)
materials = openmc.Materials([fuel, cladding, water, control_rod_mat])
materials.export_to_xml()
fuel_outer_radius = openmc.ZCylinder(r=0.39)
clad_outer_radius = openmc.ZCylinder(r=0.45)
fuel_region = -fuel_outer_radius
clad_region = +fuel_outer_radius & -clad_outer_radius
water_region = +clad_outer_radius
fuel_cell = openmc.Cell(fill=fuel, region=fuel_region)
clad_cell = openmc.Cell(fill=cladding, region=clad_region)
water_cell = openmc.Cell(fill=water, region=water_region)
fuel_pin_universe = openmc.Universe(cells=[fuel_cell, clad_cell, water_cell])
control_cell = openmc.Cell(fill=control_rod_mat, region=fuel_region)
cr_pin_universe = openmc.Universe(cells=[control_cell, clad_cell, water_cell])
lattice = openmc.RectLattice()
lattice.lower_left = (-1.5, -1.5)
lattice.pitch = (1.0, 1.0)
lattice.universes = [
[fuel_pin_universe, fuel_pin_universe, fuel_pin_universe],
[fuel_pin_universe, cr_pin_universe, fuel_pin_universe],
[fuel_pin_universe, fuel_pin_universe, fuel_pin_universe]
]
root_cell = openmc.Cell(fill=lattice)
root_universe = openmc.Universe(cells=[root_cell])
geometry = openmc.Geometry(root_universe)
geometry.export_to_xml()
plot = openmc.Plot()
plot.basis = 'xy'
plot.origin = (0.0, 0.0, 0.0)
plot.width = (3.5, 3.5)
plot.pixels = (800, 800)
plot.colors = {
fuel: 'orange',
cladding: 'grey',
water: 'blue',
control_rod_mat: 'red'
}
plot.color_by = 'material'
openmc.plot_inline(plot)
plt.title("Mini 3x3 SMR Core Module Layout")
plt.show()