Skip to content

Commit 3a9a910

Browse files
authored
Merge pull request #754 from ukaea/develop_combine_neutronics
refractoring neutronics (again)
2 parents 28bd9f3 + 15f8cc0 commit 3a9a910

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2925
-1018
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
- run:
1919
name: run neutronics_utils tests
2020
command:
21-
pytest tests/test_neutronics_utils.py -v --cov=paramak --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
21+
pytest tests/test_neutronics_utils.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
2222

2323
- run:
2424
name: run neutronics_example tests
2525
command:
26-
pytest tests/test_example_neutronics_simulations.py -v --cov=paramak --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
26+
pytest tests/test_example_neutronics_simulations.py -v --cov=paramak --cov-append --cov-report term --cov-report xml --junitxml=test-reports/junit.xml
2727

2828
- run:
2929
name: run utils tests

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
9191

9292
# Clone and install Embree
9393
RUN if [ "$include_neutronics" = "true" ] ; \
94-
then git clone --single-branch --branch master https://github.com/embree/embree.git ; \
94+
then git clone --single-branch --branch v3.12.2 --depth 1 https://github.com/embree/embree.git ; \
9595
cd embree ; \
9696
mkdir build ; \
9797
cd build ; \
@@ -107,7 +107,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
107107
mkdir MOAB ; \
108108
cd MOAB ; \
109109
mkdir build ; \
110-
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab.git ; \
110+
git clone --single-branch --branch 5.2.1 --depth 1 https://bitbucket.org/fathomteam/moab.git ; \
111111
cd build ; \
112112
cmake ../moab -DENABLE_HDF5=ON \
113113
-DENABLE_NETCDF=ON \
@@ -148,7 +148,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
148148
RUN if [ "$include_neutronics" = "true" ] ; \
149149
then mkdir DAGMC ; \
150150
cd DAGMC ; \
151-
git clone --single-branch --branch develop https://github.com/svalinn/DAGMC.git ; \
151+
git clone --single-branch --branch 3.2.0 --depth 1 https://github.com/svalinn/DAGMC.git ; \
152152
mkdir build ; \
153153
cd build ; \
154154
cmake ../DAGMC -DBUILD_TALLY=ON \

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 UKAEA
3+
Copyright (c) 2020-2021 UKAEA and Paramak contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

docs/source/paramak.parametric_neutronics.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ with a suite of neutronics codes (MCNP, Fluka, Geant4, OpenMC).
1010
The automated simulations supported within the paramak are via OpenMC however
1111
one could also carry out simulations in other neutronics codes using the
1212
dagmc.h5m file created. Moab can be used to inspect the dagmc.h5 file and file
13-
the material tag names. mbsize -ll dagmc.h5m | grep 'mat:'
13+
the material tag names.
14+
15+
.. code-block:: bash
16+
17+
mbsize -ll dagmc.h5m | grep 'mat:'
1418
1519
The creation of the dagmc.h5m file can be carried out via three routes.
1620

examples/example_neutronics_simulations/ball_reactor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def make_model_and_simulate():
6666
)
6767

6868
# starts the neutronics simulation
69-
neutronics_model.simulate(method='trelis')
69+
neutronics_model.simulate()
7070

7171
# prints the results to screen
7272
print('TBR', neutronics_model.results['TBR'])

examples/example_neutronics_simulations/ball_reactor_minimal.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ def make_model_and_simulate():
4848
cell_tallies=['TBR', 'heating'],
4949
simulation_batches=5,
5050
simulation_particles_per_batch=1e4,
51+
method='trelis'
5152
)
5253

5354
# simulate the neutronics model
54-
neutronics_model.simulate(method='trelis')
55+
neutronics_model.simulate()
5556
print(neutronics_model.results)
5657

5758

examples/example_neutronics_simulations/center_column_study_reactor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ def make_model_and_simulate():
5959
cell_tallies=['heating'],
6060
simulation_batches=5,
6161
simulation_particles_per_batch=1e4,
62+
method='trelis',
6263
)
6364

6465
# starts the neutronics simulation
65-
neutronics_model.simulate(method='trelis')
66+
neutronics_model.simulate()
6667

6768
# converts the results to mega watts
6869
total_heat_in_MW = neutronics_model.results['firstwall_mat_heating']['Watts']['result'] / 1e6

examples/example_neutronics_simulations/center_column_study_reactor_minimal.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ def make_model_and_simulate():
4747
cell_tallies=['heating'],
4848
simulation_batches=5,
4949
simulation_particles_per_batch=1e4,
50+
method='trelis',
5051
)
5152

5253
# starts the neutronics simulation
53-
neutronics_model.simulate(method='trelis')
54+
neutronics_model.simulate()
5455

5556
# prints the results
5657
print(neutronics_model.results)

examples/example_neutronics_simulations/component_based_mesh_simulation.py

+32-54
Original file line numberDiff line numberDiff line change
@@ -7,63 +7,41 @@
77
import paramak
88

99

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',
5720
)
5821

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+
)
6341

64-
plt.savefig('heating_vs_thickness.svg')
65-
plt.show()
42+
# performs an openmc simulation on the model
43+
my_model.simulate()
6644

6745

6846
if __name__ == "__main__":
69-
make_model_and_simulate()
47+
main()

examples/example_neutronics_simulations/component_based_parameter_study.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import paramak
88

99

10-
def make_model_and_simulate():
10+
def main():
1111
simulation_values = []
1212
for mid_radius in [60, 70, 80]:
1313

@@ -17,7 +17,8 @@ def make_model_and_simulate():
1717
inner_radius=50,
1818
mid_radius=mid_radius,
1919
outer_radius=100,
20-
material_tag='center_column_shield_mat'
20+
material_tag='center_column_shield_mat',
21+
method='pymoab',
2122
)
2223

2324
my_shape.export_stp('my_shape' + str(mid_radius) + '.stp')
@@ -32,14 +33,16 @@ def make_model_and_simulate():
3233
my_model = paramak.NeutronicsModel(
3334
geometry=my_shape,
3435
source=source,
35-
materials={'center_column_shield_mat': 'eurofer'},
36+
materials={
37+
'center_column_shield_mat': 'WB'},
38+
# WB is tungsten boride
3639
cell_tallies=['heating'],
3740
simulation_batches=10, # should be increased for more accurate result
38-
simulation_particles_per_batch=10 # settings are low to reduce time required
41+
simulation_particles_per_batch=10, # settings are low to reduce time required
3942
)
4043

4144
# performs an openmc simulation on the model
42-
my_model.simulate(method='pymoab')
45+
my_model.simulate()
4346

4447
# extracts the heat from the results dictionary
4548
heat = my_model.results['center_column_shield_mat_heating']['Watts']['result']
@@ -64,4 +67,4 @@ def make_model_and_simulate():
6467

6568

6669
if __name__ == "__main__":
67-
make_model_and_simulate()
70+
main()

examples/example_neutronics_simulations/segmented_blanket_ball_reactor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,11 @@ def make_model_and_simulate():
235235
cell_tallies=['TBR'],
236236
simulation_batches=5,
237237
simulation_particles_per_batch=1e4,
238+
method='trelis',
238239
)
239240

240241
# starts the neutronics simulation
241-
neutronics_model.simulate(method='trelis')
242+
neutronics_model.simulate()
242243

243244
# prints the simulation results to screen
244245
print('TBR', neutronics_model.results['TBR'])

examples/example_neutronics_simulations/shape_with_gas_production.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def main():
1616
inner_radius=50,
1717
mid_radius=60,
1818
outer_radius=100,
19-
material_tag='center_column_shield_mat'
19+
material_tag='center_column_shield_mat',
20+
method='pymoab'
2021
)
2122

2223
# makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic
@@ -34,12 +35,12 @@ def main():
3435
cell_tallies=['(n,Xa)', '(n,Xt)', '(n,Xp)'],
3536
mesh_tally_3d=['(n,Xa)', '(n,Xt)', '(n,Xp)'],
3637
mesh_tally_2d=['(n,Xa)', '(n,Xt)', '(n,Xp)'],
37-
simulation_batches=10,
38-
simulation_particles_per_batch=200
38+
simulation_batches=2,
39+
simulation_particles_per_batch=10,
3940
)
4041

4142
# performs an openmc simulation on the model
42-
my_model.simulate(method='pymoab')
43+
my_model.simulate()
4344

4445
# this extracts the values from the results dictionary
4546
print(my_model.results)

0 commit comments

Comments
 (0)