|
7 | 7 | import paramak
|
8 | 8 |
|
9 | 9 |
|
10 |
| -def make_model_and_simulate(): |
11 |
| - simulation_values = [] |
12 |
| - for mid_radius in [60, 70, 80]: |
13 |
| - |
14 |
| - # makes the component with a few different size mid radius values |
15 |
| - my_shape = paramak.CenterColumnShieldHyperbola( |
16 |
| - height=500, |
17 |
| - inner_radius=50, |
18 |
| - mid_radius=mid_radius, |
19 |
| - outer_radius=100, |
20 |
| - material_tag='center_column_shield_mat' |
21 |
| - ) |
22 |
| - |
23 |
| - my_shape.export_stp('my_shape' + str(mid_radius) + '.stp') |
24 |
| - |
25 |
| - # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic |
26 |
| - # diections |
27 |
| - source = openmc.Source() |
28 |
| - source.space = openmc.stats.Point((0, 0, 0)) |
29 |
| - source.angle = openmc.stats.Isotropic() |
30 |
| - |
31 |
| - # converts the geometry into a neutronics geometry |
32 |
| - my_model = paramak.NeutronicsModel( |
33 |
| - geometry=my_shape, |
34 |
| - source=source, |
35 |
| - materials={'center_column_shield_mat': 'eurofer'}, |
36 |
| - cell_tallies=['heating', 'TBR'], |
37 |
| - mesh_tally_2d=['heating'], |
38 |
| - mesh_tally_3d=['heating'], |
39 |
| - simulation_batches=10, # should be increased for more accurate result |
40 |
| - simulation_particles_per_batch=10 # settings are low to reduce time required |
41 |
| - ) |
42 |
| - |
43 |
| - # performs an openmc simulation on the model |
44 |
| - my_model.simulate(method='pymoab') |
45 |
| - |
46 |
| - # extracts the heat from the results dictionary |
47 |
| - heat = my_model.results['center_column_shield_mat_heating']['Watts']['result'] |
48 |
| - |
49 |
| - # adds the heat and the mid radius value to a list |
50 |
| - simulation_values.append((mid_radius, heat)) |
51 |
| - |
52 |
| - # plots the simualtion results vs the mid_radius used for the simulation |
53 |
| - plt.plot( |
54 |
| - [i[0] for i in simulation_values], |
55 |
| - [i[1] for i in simulation_values], |
56 |
| - '-p' |
| 10 | +def main(): |
| 11 | + |
| 12 | + # makes the component with a few different size mid radius values |
| 13 | + my_shape = paramak.CenterColumnShieldHyperbola( |
| 14 | + height=500, |
| 15 | + inner_radius=50, |
| 16 | + mid_radius=70, |
| 17 | + outer_radius=100, |
| 18 | + material_tag='center_column_shield_mat', |
| 19 | + method='pymoab', |
57 | 20 | )
|
58 | 21 |
|
59 |
| - # adds labels to the graph |
60 |
| - plt.title("heating vs thickness") |
61 |
| - plt.xlabel("thickness (cm)") |
62 |
| - plt.ylabel("heating (watts)") |
| 22 | + my_shape.export_stp('my_shape.stp') |
| 23 | + |
| 24 | + # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic |
| 25 | + # diections |
| 26 | + source = openmc.Source() |
| 27 | + source.space = openmc.stats.Point((0, 0, 0)) |
| 28 | + source.angle = openmc.stats.Isotropic() |
| 29 | + |
| 30 | + # converts the geometry into a neutronics geometry |
| 31 | + my_model = paramak.NeutronicsModel( |
| 32 | + geometry=my_shape, |
| 33 | + source=source, |
| 34 | + materials={'center_column_shield_mat': 'WB'}, # WB is tungsten boride |
| 35 | + cell_tallies=['heating', 'TBR'], |
| 36 | + mesh_tally_2d=['heating'], |
| 37 | + mesh_tally_3d=['heating'], |
| 38 | + simulation_batches=10, # should be increased for more accurate result |
| 39 | + simulation_particles_per_batch=10, # settings are low to reduce time required |
| 40 | + ) |
63 | 41 |
|
64 |
| - plt.savefig('heating_vs_thickness.svg') |
65 |
| - plt.show() |
| 42 | + # performs an openmc simulation on the model |
| 43 | + my_model.simulate() |
66 | 44 |
|
67 | 45 |
|
68 | 46 | if __name__ == "__main__":
|
69 |
| - make_model_and_simulate() |
| 47 | + main() |
0 commit comments