ARTICLE Monte Carlo calculation of the neutron and gamma ...
Neutron and gamma beam simulation using OpenMC and Python ...
Transcript of Neutron and gamma beam simulation using OpenMC and Python ...
Neutron and gamma beam simulation using OpenMCand Python’s libraries for Machine Learning
M.Eng. Norberto Sebastian Schmidt
Neutron Physics Department - Bariloche Atomic Center
Comision Nacional de Energıa Atomica (CNEA) - Argentina
3rd Workshop of Spanish Users on Nuclear Data on“Machine Learning in Nuclear Science and Technology Applications”
May 27, 2021
M.Eng. Norberto S. Schmidt May 27, 2021 1 / 15
Acknowledgments
Acknowledgments
• To my Master of Nuclear Engineering thesis directors: Ph.D. Jose Ignacio MarquezDamian (ESS) and Ph.D. Javier Dawidowski (CNEA).
• To M.Eng. Ariel Marquez (CNEA), Ph.D. Jose Robledo (CONICET) and B.Eng.Mauricio Debarbora (INVAP), for their helping knowledge.
• To B.Eng. Zoe Prieto (IB) and B.Eng. Inti Abbate (IB), for continuing thedevelopment of this method.
M.Eng. Norberto S. Schmidt May 27, 2021 2 / 15
Summary
Summary
1 Motivation
2 OpenMC
3 Kernel density estimation
4 Results
5 Conclusions
M.Eng. Norberto S. Schmidt May 27, 2021 3 / 15
Motivation
Motivation
Reactor block
Water
Reactor pool
Shutter
Reactor core
Neutron beamextraction tube
Collimator
BNCT filter
ShieldingsDisk chopper
Concrete walls
Beam catcherHe3 detectors
Surrounding box
RA-6 Research Reactor - Time-of-flight spectrometry experimental facility
Beam duct no 5 • Design of a time-of-flight spectrometryfacility in the RA-6 Research Reactor.
• Necessity to estimate the neutroncurrent at the exit of the duct.
M.Eng. Norberto S. Schmidt May 27, 2021 4 / 15
OpenMC OpenMC transport code description
OpenMC transport code description
BNCT
Reactorcore Reactor
pool
Reactorblock
Neutron beamextraction tube
Beam duct no5
Collimator
Shutter
Tracks surface
RA-6 Research Reactor - OpenMC model
• Open-source (https://openmc.org/).
• Modeling the RA-6 Research Reactorfrom IEU-COMP-THERM-014 NEABenchmark.
• Modification to write the particles thatcross a given surface.
• Possibility to transform track files to.mcpl format.
• Use the same track files to simulate theparticles in different codes (McStas,PHITS, etc.).
M.Eng. Norberto S. Schmidt May 27, 2021 5 / 15
OpenMC RA-6 Research Reactor radiation simulation
RA-6 Research Reactor radiation simulation
−200 −100 0 100 200x [cm]
−300
−200
−100
0
100
y[c
m]
J+n = (3.86± 0.04)× 109 [n /(cm2 s)]
Nn = 11622
RA-6 Research Reactor - Neutron flux
109
109
10 10
1011
10 12
10 13
108
109
1010
1011
1012
1013
1014
φ(x,y
)[n
/(cm
²s)
]−200 −100 0 100 200
x [cm]
−300
−200
−100
0
100
y[c
m]
J+γ = (3.09± 0.01)× 1010 [γ/(cm2 s)]
Nγ = 64441
RA-6 Research Reactor - Photon flux
10
9
109
109
10 9
10 9
109
10
9
109
10
9
10 9
10 9
109
1010
1011
10
12
1013
108
109
1010
1011
1012
1013
1014
φ(x,y
)[γ
/(cm
²s)
]
Source particles: 1× 109 n, time elapsed: 3.6× 105 s = 4.2 d, CPU: i7 8700 with 12 threads.
M.Eng. Norberto S. Schmidt May 27, 2021 6 / 15
How to generate more particles?
Example of scikit-learn kernel density estimation.
https://scikit-learn.org/stable/auto_examples/neighbors/plot_digits_kde_sampling.htm
M.Eng. Norberto S. Schmidt May 27, 2021 7 / 15
How to generate more particles?
M.Eng. Norberto S. Schmidt May 27, 2021 7 / 15
Kernel density estimation Univariate kernel density estimation
Univariate kernel density estimation
−1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00u
0.0
0.5
1.0
1.5
2.0
2.5
p(u
)
Probability of u direction component
KDE (h = 0.01)
KDE (h = 0.06)
KDE (h = 0.28)
Histogram (101 bins)
Bayesian blocks
f(x, h) =1
N · hN∑i=1
K
(x−Xi
h
)
Gaussian univariate kernel function:
K(z) =e−(z2/2)
√2π
⇒ h = σ
M.Eng. Norberto S. Schmidt May 27, 2021 8 / 15
Kernel density estimation Multivariate kernel density estimation
Multivariate kernel density estimation
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
Histogram (51× 51 bins)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
KDE (hx = hu = 0.09)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
KDE (hx = hu = 0.46)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
KDE (hx = 0.46, hu = 0.09)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
Probability of x position coordinate and u direction component
f(x,H) =1
N · det (H)
N∑i=1
K(H−1(x−Xi)
)Gaussian multivariate kernel function:
K(z) =e−(zT z/2)
(2π)(dim(z)/2)
If H is diagonal:
f(x,H) =1
N
N∑i=1
dim(x)∏j=1
1
hjK
(xj −Xj,i
hj
)
M.Eng. Norberto S. Schmidt May 27, 2021 9 / 15
Kernel density estimation Best bandwidth selection
Best bandwidth selection
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
Histogram (51× 51 bins)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
KDE, Silverman (hx = hu = 0.46)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
KDE, scikit-learn (hx = hu = 0.09)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
−5.0 −2.5 0.0 2.5 5.0x [cm]
−1.00
−0.75
−0.50
−0.25
0.00
0.25
0.50
0.75
1.00
u
KDE, statsmodels (hx = 0.27, hu = 0.03)
0.00
0.05
0.10
0.15
0.20
0.25
0.30
p(x,u
)
Probability of x position coordinate and u direction component
Python’s libraries for KDE:
1 scipy: Scott’s and Silverman’s rules(depends only on dim(x) and N).
2 scikit-learn: grid searchcross-validation (same h for eachvariable).
3 statsmodels: operator cross-validation(different h for each variable).
M.Eng. Norberto S. Schmidt May 27, 2021 10 / 15
Results Sampling particles with KDE
Sampling particles with KDE
1 Run a OpenMC eigenvalue core calculation.
2 Write the variables r,Ω, E,wgt of the particlesthat cross certain surface in a file.
r = ~r = (x, y, z = z0) = (R, θ, z = z0)
Ω = Ω = (u, v, w) = (ρ = 1, ϕ, ϑ)
3 Compute the multivariate KDE usingstatsmodels CV bandwidth selection for eachvariable.
4 Write the sampled particles in a .h5 format file.
5 Run a OpenMC fixed source calculation.
x
y
z
r
Ω
u
v
w
Rθ
ϑ
φ
Coordinates ilustration.
M.Eng. Norberto S. Schmidt May 27, 2021 11 / 15
Results Sampling particles with KDE
Sampling particles with KDE
−6 −4 −2 0 2 4 6x [cm]
0.00
0.02
0.04
0.06
0.08
0.10
p(x
)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
−6 −4 −2 0 2 4 6y [cm]
0.00
0.02
0.04
0.06
0.08
0.10
0.12
p(y)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
2 4 6 8 10ξ = log (E0/E)
0.0
0.2
0.4
0.6
0.8
1.0
p(ξ)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
−1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00u
0.0
0.5
1.0
1.5
2.0
2.5
p(u
)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
−1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00v
0.0
0.5
1.0
1.5
2.0
2.5
p(v)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0wgt
0
2
4
6
8
10
p(w
gt)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
Best bandwidth comparison for neutron variables (in original coordinates).
M.Eng. Norberto S. Schmidt May 27, 2021 11 / 15
Results Sampling particles with KDE
Sampling particles with KDE
−6 −4 −2 0 2 4 6x [cm]
0.00
0.02
0.04
0.06
0.08
0.10
p(x
)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
−6 −4 −2 0 2 4 6y [cm]
0.00
0.02
0.04
0.06
0.08
0.10
p(y)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
2 4 6 8 10E [MeV]
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
p(E
)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
−1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00u
0.0
0.2
0.4
0.6
0.8
1.0
1.2
1.4
1.6
p(u
)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
−1.00 −0.75 −0.50 −0.25 0.00 0.25 0.50 0.75 1.00v
0.00
0.25
0.50
0.75
1.00
1.25
1.50
1.75
p(v)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0wgt
0
2
4
6
8
10
p(w
gt)
CV 1-D statsmodels
CV N-D statsmodels
CV 1-D scikit-learn
Histogram (51 bins)
Bayesian blocks
Best bandwidth comparison for photon variables (in original coordinates).
M.Eng. Norberto S. Schmidt May 27, 2021 11 / 15
Results Calculation of current distributions
Calculation of current distributions
0 2 4 6 8 10 12ξ = log (E0/E)
105
106
107
108
109
J(ξ
)[n
/(cm
2s)
]
Original
Sampled
Neutron current lethargy distribution J(ξ).
10−4 10−2 100 102 104 106
E [eV]
100
102
104
106
108
1010
J(E
)[n
/(cm
2s
eV)]
Original
Sampled
Neutron current energy distribution J(E).
M.Eng. Norberto S. Schmidt May 27, 2021 12 / 15
Results Calculation of current distributions
Calculation of current distributions
Total 0 eV - 0.5 eV 0.5 eV - 1 MeV 1 MeV - 20 MeV
Ori
gina
lSa
mpl
edC
ompa
riso
n
Neutron current spatial distribution J(x, y)
M.Eng. Norberto S. Schmidt May 27, 2021 12 / 15
Results Calculation of current distributions
Calculation of current distributions
−6 −4 −2 0 2 4 6x [cm]
−6
−4
−2
0
2
4
6
y[c
m]
~rC
~rU
~rD
~rL ~rR
0 45 90 135 180 225 270 315 360ϕ []
0.0
0.5
1.0
1.5
2.0
2.5
3.0
j(~r U,ϑ
0,ϕ
)[n
/(cm
2s)
]
×106
Original: Total
Sampled: Total
Original: 0 eV - 0.5 eV
Sampled: 0 eV - 0.5 eV
Original: 0.5 eV - 1 MeV
Sampled: 0.5 eV - 1 MeV
Original: 1 MeV - 20 MeV
Sampled: 1 MeV - 20 MeV
0 45 90 135 180 225 270 315 360ϕ []
0.0
0.5
1.0
1.5
2.0
2.5
3.0j(~r L,ϑ
0,ϕ
)[n
/(cm
2s)
]
×106
0 45 90 135 180 225 270 315 360ϕ []
0.0
0.5
1.0
1.5
2.0
2.5
3.0
j(~r C,ϑ
0,ϕ
)[n
/(cm
2s)
]
×106
0 45 90 135 180 225 270 315 360ϕ []
0.0
0.5
1.0
1.5
2.0
2.5
3.0
j(~r R,ϑ
0,ϕ
)[n
/(cm
2s)
]
×106
0 45 90 135 180 225 270 315 360ϕ []
0.0
0.5
1.0
1.5
2.0
2.5
3.0
j(~r D,ϑ
0,ϕ
)[n
/(cm
2s)
]
×106
Neutron current angular distribution j(ϕ)
Ω
u
v
w
ϑ
φ
M.Eng. Norberto S. Schmidt May 27, 2021 12 / 15
Results Comparison with the original tracks results
Comparison with the original tracks results
−100 −75 −50 −25 0 25 50 75 100x [cm]
−325
−300
−275
−250
−225
−200
−175
−150
−125
y[c
m]
Neutron flux with original particles10
9
10 10
104
105
106
107
108
109
1010
φ(x,y
)[n
/(cm
²s)
]−100 −75 −50 −25 0 25 50 75 100
x [cm]
−325
−300
−275
−250
−225
−200
−175
−150
−125
y[c
m]
Neutron flux with KDE sampled particles
10
6
10
6
10
6
106
10
7
10
7
10
810
9
104
105
106
107
108
109
1010
φ(x,y
)[n
/(cm
²s)
]
M.Eng. Norberto S. Schmidt May 27, 2021 13 / 15
Results Comparison with the original tracks results
Comparison with the original tracks results
−100 −75 −50 −25 0 25 50 75 100x [cm]
−325
−300
−275
−250
−225
−200
−175
−150
−125
y[c
m]
Photon flux with original particles
10
9
109
109
10 9
10 9
109
10
9
109
10
9
10 9
10 9
109
1010
104
105
106
107
108
109
1010
φ(x,y
)[γ
/(cm
²s)
]−100 −75 −50 −25 0 25 50 75 100
x [cm]
−325
−300
−275
−250
−225
−200
−175
−150
−125
y[c
m]
Photon flux with KDE sampled particles
10
6
10 6
10
6
107
10
8
10
9
104
105
106
107
108
109
1010
φ(x,y
)[γ
/(cm
²s)
]
M.Eng. Norberto S. Schmidt May 27, 2021 13 / 15
Conclusions
Conclusions
1 All this work was done using open source codes and free software tools.
2 A modification to write track files with OpenMC was generated.
3 New particles from these track files can be sampled using kernel density estimation.
4 Python has several libraries that estimate automatically the best bandwidth for theparticles’ variables.
5 Distributions of sampled particles with statsmodels resemble with originals.
M.Eng. Norberto S. Schmidt May 27, 2021 14 / 15
Thank you for your time.
Questions?
M.Eng. Norberto S. Schmidt May 27, 2021 15 / 15