Setting up a D1SUNED study#
Introduction to the problem#
In this tutorial we will see how f4enix can help set up a d1suned study workflow from scratch. Let’s start with a simple input consisting of a sphere of steel and a 0-14 MeV point source added at his center. Our objective will be to compute the contact SDDR at the external surface of the sphere (tally 104) after 24h and 11.6 days.
from f4enix.input.MCNPinput import D1S_Input
inp = D1S_Input.from_input('sphere.i')
# Check input contents
with open('sphere.i', 'r') as f:
for line in f:
if line.strip():
print(line, end='')
/home/docs/checkouts/readthedocs.org/user_builds/f4enix/envs/stable/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
MCNP XS LEAK SPHERE TEST INPUT VRT
1 0 -1 IMP:N=1 IMP:P=1
2 1 -7.93 +1 -2 IMP:N=1 IMP:P=1
3 0 +2 -3 IMP:N=1 IMP:P=1
4 0 +3 IMP:N=0 IMP:P=0
1 S 0 0 0 5
2 S 0 0 0 50
3 S 0 0 0 55
4 S 0 0 0 60
M1
6012.32c 1.167430E-4 $ C-12 AB(%) 98.93
6013.32c 1.262660E-6 $ C-13 AB(%) 1.07
25055.32c 1.564670E-3 $ Mn-55 AB(%) 100.0
28058.32c 6.785300E-3 $ Ni-58 AB(%) 68.077
28060.32c 2.613690E-3 $ Ni-60 AB(%) 26.223
28061.32c 1.136150E-4 $ Ni-61 AB(%) 1.1399
28062.32c 3.622550E-4 $ Ni-62 AB(%) 3.6345
28064.32c 9.225560E-5 $ Ni-64 AB(%) 0.9256
24050.32c 6.983620E-4 $ Cr-50 AB(%) 4.345
24052.32c 1.346730E-2 $ Cr-52 AB(%) 83.789
24053.32c 1.527070E-3 $ Cr-53 AB(%) 9.5009
24054.32c 3.801180E-4 $ Cr-54 AB(%) 2.365
42092.32c 1.846880E-4 $ Mo-92 AB(%) 14.84
42094.32c 1.151190E-4 $ Mo-94 AB(%) 9.25
42095.32c 1.981290E-4 $ Mo-95 AB(%) 15.92
42096.32c 2.075870E-4 $ Mo-96 AB(%) 16.68
42097.32c 1.188520E-4 $ Mo-97 AB(%) 9.55
42098.32c 3.003040E-4 $ Mo-98 AB(%) 24.13
42100.32c 1.198480E-4 $ Mo-100 AB(%) 9.63
7014.32c 2.377840E-4 $ N-14 AB(%) 99.628
7015.32c 8.872280E-7 $ N-15 AB(%) 0.37174
15031.32c 3.854480E-5 $ P-31 AB(%) 100.0
16032.32c 1.414750E-5 $ S-32 AB(%) 94.99
16033.32c 1.117030E-7 $ S-33 AB(%) 0.75
16034.32c 6.329820E-7 $ S-34 AB(%) 4.25
16036.32c 1.489370E-9 $ S-36 AB(%) 0.01
14028.32c 7.841130E-4 $ Si-28 AB(%) 92.23
14029.32c 3.981490E-5 $ Si-29 AB(%) 4.6831
14030.32c 2.624610E-5 $ Si-30 AB(%) 3.0871
29063.32c 1.559470E-4 $ Cu-63 AB(%) 69.17
29065.32c 6.950780E-5 $ Cu-65 AB(%) 30.83
73181.32c 2.639180E-6 $ Ta-181 AB(%) 100.0
22046.32c 8.230830E-6 $ Ti-46 AB(%) 8.2525
22047.32c 7.422720E-6 $ Ti-47 AB(%) 7.4423
22048.32c 7.351800E-5 $ Ti-48 AB(%) 73.712
22049.32c 5.397430E-6 $ Ti-49 AB(%) 5.4117
22050.32c 5.167970E-6 $ Ti-50 AB(%) 5.1816
5010.32c 1.758090E-6 $ B-10 AB(%) 19.9
5011.32c 7.076530E-6 $ B-11 AB(%) 80.1
41093.32c 5.140190E-5 $ Nb-93 AB(%) 100.0
27059.32c 4.051670E-5 $ Co-59 AB(%) 100.0
26054.32c 3.236580E-3 $ Fe-54 AB(%) 5.845
26056.32c 5.080730E-2 $ Fe-56 AB(%) 91.754
26057.32c 1.173360E-3 $ Fe-57 AB(%) 2.119
26058.32c 1.561520E-4 $ Fe-58 AB(%) 0.282
C
SDEF POS 0 0 0 PAR=N ERG=d1 $ position, particle type, energy
SI1 H 1e-6 0.1 1 10 14 $ histogram boundaries
SP1 D 0 1 1 1 1 $ probabilities for each bin
C
C 24h 11.6d
ZA 86400 1e6
MODE N P
PHYS:P J 1
FILES 21 react 3J
22 irrad
F104:p 3
FC104 Shut-down dose rate [Sv/h]
DE104 LOG 1.000E-02 1.500E-02 2.000E-02 3.000E-02 4.000E-02 5.000E-02
6.000E-02 7.000E-02 8.000E-02 1.000E-01 1.500E-01 2.000E-01
3.000E-01 4.000E-01 5.000E-01 6.000E-01 8.000E-01 1.000E+00
2.000E+00 4.000E+00 6.000E+00 8.000E+00 1.000E+01 $ICRP74 g
DF104 LOG 0.0485 0.1254 0.205 0.2999 0.3381 0.3572 0.378 0.4066 0.4399
0.5172 0.7523 1.0041 1.5083 1.9958 2.4657 2.9082 3.7269 4.4834
7.4896 12.0153 15.9873 19.9191 23.76
FM104 7.2e10
T104 1 2
Irradiation scenario and identification of decay pathways#
First thing to do is to define the irradiation scenario(s) to be analyzed. This can be read from a fispact input or a d1stime legacy file if available or it can be directly created in F4Enix.
from f4enix.core.irradiation import IrradiationScenario, Pulse
from f4enix.core.constants import TIME_UNITS
# Dummy irradiation scenario: 2 cycles of 1 day ON, 1 day OFF, then 1 year OFF
# then again 2 cycles of 1 day ON, 1 day OFF
pulses = (
[Pulse(1, 1e10, TIME_UNITS.DAY), Pulse(2, 0, TIME_UNITS.DAY)]*2 +
[Pulse(1, 0, TIME_UNITS.YEAR)] +
[Pulse(1, 1e10, TIME_UNITS.DAY), Pulse(2, 0, TIME_UNITS.DAY)]*2
)
irr_scenario = IrradiationScenario(pulses)
Next, we need to identify which nuclides should be tracked during the d1suned mode 1 calculation. Usually, a previous activation code calculation must be run in order to identify what are the main decay pathways contributing to the SDDR in the problem at hands. In that case, simply a list of nuclides can be created and passed to f4enix to compute time correction factors.
For the sake of this tutorial we will assume that the flux at the external surface of the sphere is similar to the ones typically observed in a port interspace of ITER. We will also assume that the simple irradiation scenario defined here is similar to the DT2 that is available in the decay pathway library of F4Enix.
from f4enix.output.decay_pathways import PathwayLibrary, AVAIL_IRR_SCENARIO, AVAIL_SPECTRUM
from f4enix.core.material_library import SS316LNIG
plib = PathwayLibrary()
df = plib.get_pathways(
materials=[SS316LNIG], # the only material present in our example
cooling_times=['24 h', '11.6 d'],
spectrum=[AVAIL_SPECTRUM.PortCell500MW],
irradiation_scenario=[AVAIL_IRR_SCENARIO.DT2],
dose=95) # interested in getting 95% of the dose
df
| cooling time | isotope % dose | pathway % dose | |||
|---|---|---|---|---|---|
| element | isotope | pathway | |||
| Cr | 51 | Fe54 -(n,a)-> Cr51 | 24 h | 1.394800 | 0.063143 |
| Cr50 -(n,g)-> Cr51 | 24 h | 1.394800 | 0.883145 | ||
| Cr52 -(n,2n)-> Cr51 | 24 h | 1.394800 | 0.447494 | ||
| Mn | 54 | Mn55 -(n,2n)-> Mn54 | 24 h | 17.368878 | 3.965315 |
| Fe54 -(n,p)-> Mn54 | 24 h | 17.368878 | 13.388973 | ||
| Fe | 59 | Ni62 -(n,a)-> Fe59 | 24 h | 1.522523 | 0.089144 |
| Fe58 -(n,g)-> Fe59 | 24 h | 1.522523 | 1.393063 | ||
| Co59 -(n,p)-> Fe59 | 24 h | 1.522523 | 0.033587 | ||
| Co | 58 | Ni58 -(n,p)-> Co58 | 24 h | 63.083369 | 37.546590 |
| Ni58 -(n,p)-> Co58m -(IT)-> Co58 | 24 h | 63.083369 | 25.039051 | ||
| 60 | Ni60 -(n,p)-> Co60m -(IT)-> Co60 | 24 h | 11.949525 | 2.096544 | |
| Ni60 -(n,p)-> Co60 | 24 h | 11.949525 | 1.310863 | ||
| Co59 -(n,g)-> Co60m -(IT)-> Co60 | 24 h | 11.949525 | 5.287426 | ||
| Co59 -(n,g)-> Co60 | 24 h | 11.949525 | 3.185863 | ||
| Ni | 57 | Ni58 -(n,2n)-> Ni57 | 24 h | 1.589288 | 1.589288 |
| Ta | 182 | Ta181 -(n,g)-> Ta182 | 24 h | 3.656173 | 2.302621 |
| Ta181 -(n,g)-> Ta182m -(IT)-> Ta182 | 24 h | 3.656173 | 1.341304 |
Now that we know what are the interesting reactions we can firstly create the reaction and irradiation auxiliary files that are to be produced for a d1suned calculation.
Irradiation and Reaction files production#
IRRAD file#
First of all, let’s extract the daughter radioactive isotopes for which the time correction factors need to be computed.
daugthers = df.reset_index()[['element', 'isotope']].drop_duplicates()
daugthers
| element | isotope | |
|---|---|---|
| 0 | Cr | 51 |
| 3 | Mn | 54 |
| 5 | Fe | 59 |
| 8 | Co | 58 |
| 10 | Co | 60 |
| 14 | Ni | 57 |
| 15 | Ta | 182 |
and then the time correction factors can be computed and the irradiation file created
from f4enix.input.d1suned import IrradiationFile
from f4enix.core.irradiation import Nuclide
nuclides = []
for element, isotope in daugthers.values:
nuclides.append(Nuclide.from_formula(f"{element}{isotope}"))
irr_file = IrradiationFile.from_irradiation_schedules(
nuclides,
[irr_scenario],
norm = 1.0e10, # normalization factor
)
# irr_file.write(r'./') # Write the irradiation file in the current directory
# Check out what we produced
with open('irrad', 'r') as f:
for line in f:
if line.strip():
print(line, end='')
# *******************************
# Irradiation Scenarios
# *******************************
# norm: 10000000000.0
# Scenario: None
# - Pulse(time=1.0 TIME_UNITS.DAY, intensity=10000000000.0)
# - Pulse(time=2.0 TIME_UNITS.DAY, intensity=0)
# - Pulse(time=1.0 TIME_UNITS.DAY, intensity=10000000000.0)
# - Pulse(time=2.0 TIME_UNITS.DAY, intensity=0)
# - Pulse(time=1.0 TIME_UNITS.YEAR, intensity=0)
# - Pulse(time=1.0 TIME_UNITS.DAY, intensity=10000000000.0)
# - Pulse(time=2.0 TIME_UNITS.DAY, intensity=0)
# - Pulse(time=1.0 TIME_UNITS.DAY, intensity=10000000000.0)
# - Pulse(time=2.0 TIME_UNITS.DAY, intensity=0)
nsc 1
C Daught. lambda(1/s) time_fact_1 comments
25054 2.570e-08 6.331e-03 Mn54
27058 1.132e-07 1.932e-02 Co58
27060 4.167e-09 1.348e-03 Co60
28057 5.363e-06 1.834e-01 Ni57
73182 6.994e-08 1.305e-02 Ta182
last thing to do is to assign the irrad file to the input
inp.irrad_file = irr_file
REAC file#
The fastest way to produce a reac file at this point is to use the get_reaction_file() method of the D1S_Input class. Given a specific D1S library, the method will scan the materials present in the input and add to the reaction list any available reaction that from one parent isotope included in the material can lead to one of the daughter isotopes included in the irrad file.
from f4enix.input.libmanager import LibManager
lm = LibManager()
inp.get_reaction_file(lm, '99c')
inp.reac_file
Parent MT Daughter Comment
24050.99c 102 24051 Cr50.99c -> Cr51
24052.99c 16 24051 Cr52.99c -> Cr51
25055.99c 16 25054 Mn55.99c -> Mn54
26054.99c 103 25054 Fe54.99c -> Mn54
26054.99c 107 24051 Fe54.99c -> Cr51
26056.99c 105 25054 Fe56.99c -> Mn54
26058.99c 102 26059 Fe58.99c -> Fe59
27059.99c 102 27060 Co59.99c -> Co60
27059.99c 103 26059 Co59.99c -> Fe59
27059.99c 16 27058 Co59.99c -> Co58
28058.99c 103 27058 Ni58.99c -> Co58
28058.99c 112 25054 Ni58.99c -> Mn54
28058.99c 16 28057 Ni58.99c -> Ni57
28060.99c 103 27060 Ni60.99c -> Co60
28061.99c 104 27060 Ni61.99c -> Co60
28061.99c 28 27060 Ni61.99c -> Co60
28062.99c 107 26059 Ni62.99c -> Fe59
29063.99c 107 27060 Cu63.99c -> Co60
73181.99c 102 73182 Ta181.99c -> Ta182
It can be noticed though how this list is longer than the one extracted with the help of the decay pathways filter:
df
| cooling time | isotope % dose | pathway % dose | |||
|---|---|---|---|---|---|
| element | isotope | pathway | |||
| Cr | 51 | Fe54 -(n,a)-> Cr51 | 24 h | 1.394800 | 0.063143 |
| Cr50 -(n,g)-> Cr51 | 24 h | 1.394800 | 0.883145 | ||
| Cr52 -(n,2n)-> Cr51 | 24 h | 1.394800 | 0.447494 | ||
| Mn | 54 | Mn55 -(n,2n)-> Mn54 | 24 h | 17.368878 | 3.965315 |
| Fe54 -(n,p)-> Mn54 | 24 h | 17.368878 | 13.388973 | ||
| Fe | 59 | Ni62 -(n,a)-> Fe59 | 24 h | 1.522523 | 0.089144 |
| Fe58 -(n,g)-> Fe59 | 24 h | 1.522523 | 1.393063 | ||
| Co59 -(n,p)-> Fe59 | 24 h | 1.522523 | 0.033587 | ||
| Co | 58 | Ni58 -(n,p)-> Co58 | 24 h | 63.083369 | 37.546590 |
| Ni58 -(n,p)-> Co58m -(IT)-> Co58 | 24 h | 63.083369 | 25.039051 | ||
| 60 | Ni60 -(n,p)-> Co60m -(IT)-> Co60 | 24 h | 11.949525 | 2.096544 | |
| Ni60 -(n,p)-> Co60 | 24 h | 11.949525 | 1.310863 | ||
| Co59 -(n,g)-> Co60m -(IT)-> Co60 | 24 h | 11.949525 | 5.287426 | ||
| Co59 -(n,g)-> Co60 | 24 h | 11.949525 | 3.185863 | ||
| Ni | 57 | Ni58 -(n,2n)-> Ni57 | 24 h | 1.589288 | 1.589288 |
| Ta | 182 | Ta181 -(n,g)-> Ta182 | 24 h | 3.656173 | 2.302621 |
| Ta181 -(n,g)-> Ta182m -(IT)-> Ta182 | 24 h | 3.656173 | 1.341304 |
This means that we can perform a further refinement of the pathways to consider. First, we need to convert the reaction strings into Pathway objects
from f4enix.output.fispact_legacy_out import Pathway
pathways = []
for string in df.reset_index()['pathway'].unique():
pathways.append(Pathway.from_string(string))
pathways
[Pathway(parent=Fe54, daughter=Cr51, perc=100, reactions=['(n,a)'], intermediates=None),
Pathway(parent=Cr50, daughter=Cr51, perc=100, reactions=['(n,g)'], intermediates=None),
Pathway(parent=Cr52, daughter=Cr51, perc=100, reactions=['(n,2n)'], intermediates=None),
Pathway(parent=Mn55, daughter=Mn54, perc=100, reactions=['(n,2n)'], intermediates=None),
Pathway(parent=Fe54, daughter=Mn54, perc=100, reactions=['(n,p)'], intermediates=None),
Pathway(parent=Ni62, daughter=Fe59, perc=100, reactions=['(n,a)'], intermediates=None),
Pathway(parent=Fe58, daughter=Fe59, perc=100, reactions=['(n,g)'], intermediates=None),
Pathway(parent=Co59, daughter=Fe59, perc=100, reactions=['(n,p)'], intermediates=None),
Pathway(parent=Ni58, daughter=Co58, perc=100, reactions=['(n,p)'], intermediates=None),
Pathway(parent=Ni58, daughter=Co58, perc=100, reactions=['(n,p)', '(IT)'], intermediates=[Co58m]),
Pathway(parent=Ni60, daughter=Co60, perc=100, reactions=['(n,p)', '(IT)'], intermediates=[Co60m]),
Pathway(parent=Ni60, daughter=Co60, perc=100, reactions=['(n,p)'], intermediates=None),
Pathway(parent=Co59, daughter=Co60, perc=100, reactions=['(n,g)', '(IT)'], intermediates=[Co60m]),
Pathway(parent=Co59, daughter=Co60, perc=100, reactions=['(n,g)'], intermediates=None),
Pathway(parent=Ni58, daughter=Ni57, perc=100, reactions=['(n,2n)'], intermediates=None),
Pathway(parent=Ta181, daughter=Ta182, perc=100, reactions=['(n,g)'], intermediates=None),
Pathway(parent=Ta181, daughter=Ta182, perc=100, reactions=['(n,g)', '(IT)'], intermediates=[Ta182m])]
And after that it is possible to filter out the reactions that are not needed in the reac file:
inp.reac_file.filter_by_paths(pathways)
inp.reac_file
Parent MT Daughter Comment
24050.99c 102 24051 Cr50.99c -> Cr51
24052.99c 16 24051 Cr52.99c -> Cr51
25055.99c 16 25054 Mn55.99c -> Mn54
26054.99c 103 25054 Fe54.99c -> Mn54
26054.99c 107 24051 Fe54.99c -> Cr51
26058.99c 102 26059 Fe58.99c -> Fe59
27059.99c 102 27060 Co59.99c -> Co60
27059.99c 103 26059 Co59.99c -> Fe59
28058.99c 103 27058 Ni58.99c -> Co58
28058.99c 16 28057 Ni58.99c -> Ni57
28060.99c 103 27060 Ni60.99c -> Co60
28062.99c 107 26059 Ni62.99c -> Fe59
73181.99c 102 73182 Ta181.99c -> Ta182
D1SUNED input file finalization#
Now that the irrad and reac file have been successfully generated it is time to provide some final touches to the input itself. First of all, the correct D1S library should be assigned to the parent isotopes for which reactions have been defined.
inp.smart_translate(
'99c', # activation library to use for parents
'00c', # transport library to use for all other isotopes
lm # LibManager of choice (default one can be used in most cases)
)
print(inp.materials['M1'].to_text()[:1000])
M1
6012.00c 1.167430E-4 $ C-12 WEIGHT(%) 0.029679 AB(%) 98.93
6013.00c 1.262660E-6 $ C-13 WEIGHT(%) 0.029679 AB(%) 1.07
25055.99c 1.564670E-3 $ Mn-55 WEIGHT(%) 1.8 AB(%) 100.0
28058.99c 6.785300E-3 $ Ni-58 WEIGHT(%) 12.25 AB(%) 68.077
28060.99c 2.613690E-3 $ Ni-60 WEIGHT(%) 12.25 AB(%) 26.223
28061.00c 1.136150E-4 $ Ni-61 WEIGHT(%) 12.25 AB(%) 1.1399
28062.99c 3.622550E-4 $ Ni-62 WEIGHT(%) 12.25 AB(%) 3.6345
28064.00c 9.225560E-5 $ Ni-64 WEIGHT(%) 12.25 AB(%) 0.9256
24050.99c 6.983620E-4 $ Cr-50 WEIGHT(%) 17.5 AB(%) 4.345
24052.99c 1.346730E-2 $ Cr-52 WEIGHT(%) 17.5 AB(%) 83.789
24053.00c 1.527070E-3 $ Cr-53 WEIGHT(%) 17.5 AB(%) 9.5009
24054.00c 3.801180E-4 $ Cr-54 WEIGHT(%) 17.5 AB(%) 2.365
42092.00c 1.846880E-4 $ Mo-92 WEIGHT(%) 2.5 AB(%) 14.84
And then the last final touches to automatically add the PIKMT card tracking all nuclides contained in the reaction file and creating a binning to isolate the different contributions of the daughters. Then the input can be written to file to start the simulations.
inp.add_PIKMT_card()
inp.add_daughter_contribution_from_irr('F104') # also subsets can be defined if needed
print(inp.other_data['PIKMT'].card())
print(inp.other_data['F104'].card())
# inp.write('production_sphere.i')
PIKMT
24050 0
24052 0
25055 0
26054 0
26058 0
27059 0
28058 0
28060 0
28062 0
73181 0
F104:p 3
FU104 0
24051
25054
26059
27058
27060
28057
73182
Post-processing of results#
After your calculation was run, you can rescale your dose tallies (if binned by daughter contribution) for a new irradiation scenario.
import matplotlib.pyplot as plt
from f4enix.output.mctal import Mctal, normalize_tally
# Read your mctal file
mctal = Mctal('mctal_daughter')
# Normalize dose tally
tallynum = 124
mctal.set_d1s_relative_contribution(tallynum)
dose_tally = mctal.tallydata[tallynum]
dose_tally## ##3#######
| Daughter | Value | Error | Normalized Value | |
|---|---|---|---|---|
| 0 | 0 | 0.000000e+00 | 0.0000 | 0.000000e+00 |
| 1 | 26059 | 1.736590e-05 | 0.0044 | 8.365197e-03 |
| 2 | 21046 | 3.319390e-07 | 0.0663 | 1.598958e-04 |
| 3 | 27058 | 3.043810e-04 | 0.0018 | 1.466211e-01 |
| 4 | 24051 | 1.588970e-05 | 0.0045 | 7.654108e-03 |
| 5 | 51124 | 2.588240e-11 | 0.1776 | 1.246762e-08 |
| 6 | 25054 | 1.599160e-04 | 0.0027 | 7.703194e-02 |
| 7 | 21048 | 7.115630e-07 | 0.0454 | 3.427617e-04 |
| 8 | 42099 | 1.215240e-05 | 0.0050 | 5.853841e-03 |
| 9 | 51122 | 1.058410e-11 | 0.2915 | 5.098387e-09 |
| 10 | 27057 | 5.473280e-06 | 0.0072 | 2.636493e-03 |
| 11 | 41092 | 5.231740e-06 | 0.0189 | 2.520142e-03 |
| 12 | 25056 | 1.119620e-05 | 0.0005 | 5.393238e-03 |
| 13 | 47110 | 4.177280e-09 | 0.0158 | 2.012206e-06 |
| 14 | 73182 | 5.099150e-06 | 0.0182 | 2.456273e-03 |
| 15 | 74187 | 9.396210e-04 | 0.0014 | 4.526178e-01 |
| 16 | 27060 | 3.826130e-04 | 0.0010 | 1.843056e-01 |
| 17 | 72181 | 2.438560e-07 | 0.0571 | 1.174660e-04 |
| 18 | 28057 | 1.590960e-05 | 0.0106 | 7.663694e-03 |
| 19 | 11024 | 1.278690e-04 | 0.0109 | 6.159482e-02 |
| 20 | 74181 | 2.540240e-06 | 0.0078 | 1.223640e-03 |
| 21 | 29064 | 6.941980e-05 | 0.0021 | 3.343969e-02 |
| 22 | 75184 | 5.526980e-10 | 1.0000 | 2.662360e-07 |
| 23 | 28065 | 0.000000e+00 | 0.0000 | 0.000000e+00 |
def plot_radioisotope_contribution(tally):
plt.figure(figsize=(12, 8))
plt.bar(tally["Daughter"].astype(str), tally["Normalized Value"], color="tab:blue")
plt.xlabel("Daughter")
plt.ylabel("Relative dose contribution [-]")
plt.title(f"Daughter contribution to dose tally")
plt.grid(axis="y")
plt.xticks(rotation=45) # Rotate x-tick labels if needed
plt.tight_layout()
plt.show()
# Let's plot the daughters relative contributions
plot_radioisotope_contribution(dose_tally)
# define a new scenario (only 0 seconds cooling time)
new_pulses = (
[Pulse(1, 1e10, TIME_UNITS.DAY), Pulse(2, 0, TIME_UNITS.DAY)]*2 +
[Pulse(1, 0, TIME_UNITS.YEAR)] +
[Pulse(1, 1e10, TIME_UNITS.DAY), Pulse(2, 0, TIME_UNITS.DAY)]*2
)
new_irr_scenario = IrradiationScenario(new_pulses)
# Generate scaling factors for the new scenario
scaling_factors = irr_file.get_scaling_factors_new_scenario(1, new_irr_scenario, norm=1.0e10)
# rescale the dose tally
new_dose_tally = dose_tally.copy()
scaling_col = scaling_factors.iloc[:, 0]
new_dose_tally["Value"] = new_dose_tally["Daughter"].map(scaling_col) * new_dose_tally["Value"]
normalize_tally(new_dose_tally)
| Daughter | Value | Error | Normalized Value | |
|---|---|---|---|---|
| 0 | 0 | NaN | 0.0000 | NaN |
| 1 | 26059 | 0.000017 | 0.0044 | 0.019273 |
| 2 | 21046 | NaN | 0.0663 | NaN |
| 3 | 27058 | 0.000304 | 0.0018 | 0.337696 |
| 4 | 24051 | 0.000016 | 0.0045 | 0.017633 |
| 5 | 51124 | NaN | 0.1776 | NaN |
| 6 | 25054 | 0.000160 | 0.0027 | 0.177472 |
| 7 | 21048 | NaN | 0.0454 | NaN |
| 8 | 42099 | NaN | 0.0050 | NaN |
| 9 | 51122 | NaN | 0.2915 | NaN |
| 10 | 27057 | NaN | 0.0072 | NaN |
| 11 | 41092 | NaN | 0.0189 | NaN |
| 12 | 25056 | NaN | 0.0005 | NaN |
| 13 | 47110 | NaN | 0.0158 | NaN |
| 14 | 73182 | 0.000005 | 0.0182 | 0.005658 |
| 15 | 74187 | NaN | 0.0014 | NaN |
| 16 | 27060 | 0.000383 | 0.0010 | 0.424616 |
| 17 | 72181 | NaN | 0.0571 | NaN |
| 18 | 28057 | 0.000016 | 0.0106 | 0.017651 |
| 19 | 11024 | NaN | 0.0109 | NaN |
| 20 | 74181 | NaN | 0.0078 | NaN |
| 21 | 29064 | NaN | 0.0021 | NaN |
| 22 | 75184 | NaN | 1.0000 | NaN |
| 23 | 28065 | NaN | 0.0000 | NaN |
# Let's plot the relative daughter contribution after rescaling for the new scenario
plot_radioisotope_contribution(new_dose_tally)
We may also want to have the dose tally results for a different cooling time, it is possible again by rescaling the daughter contributions.
# Generate scaling factors for the new scenario
scaling_factors = irr_file.get_scaling_factors_cooling_time(1, (30, TIME_UNITS.DAY))
# rescale the dose tally
new_dose_tally = dose_tally.copy()
scaling_col = scaling_factors.iloc[:, 0]
new_dose_tally["Value"] = new_dose_tally["Daughter"].map(scaling_col) * new_dose_tally["Value"]
normalize_tally(new_dose_tally)
| Daughter | Value | Error | Normalized Value | |
|---|---|---|---|---|
| 0 | 0 | NaN | 0.0000 | NaN |
| 1 | 26059 | 1.088266e-05 | 0.0044 | 1.399283e-02 |
| 2 | 21046 | NaN | 0.0663 | NaN |
| 3 | 27058 | 2.269809e-04 | 0.0018 | 2.918500e-01 |
| 4 | 24051 | 7.500937e-06 | 0.0045 | 9.644638e-03 |
| 5 | 51124 | NaN | 0.1776 | NaN |
| 6 | 25054 | 1.496104e-04 | 0.0027 | 1.923677e-01 |
| 7 | 21048 | NaN | 0.0454 | NaN |
| 8 | 42099 | NaN | 0.0050 | NaN |
| 9 | 51122 | NaN | 0.2915 | NaN |
| 10 | 27057 | NaN | 0.0072 | NaN |
| 11 | 41092 | NaN | 0.0189 | NaN |
| 12 | 25056 | NaN | 0.0005 | NaN |
| 13 | 47110 | NaN | 0.0158 | NaN |
| 14 | 73182 | 4.253701e-06 | 0.0182 | 5.469371e-03 |
| 15 | 74187 | NaN | 0.0014 | NaN |
| 16 | 27060 | 3.785027e-04 | 0.0010 | 4.866754e-01 |
| 17 | 72181 | NaN | 0.0571 | NaN |
| 18 | 28057 | 1.460753e-11 | 0.0106 | 1.878224e-08 |
| 19 | 11024 | NaN | 0.0109 | NaN |
| 20 | 74181 | NaN | 0.0078 | NaN |
| 21 | 29064 | NaN | 0.0021 | NaN |
| 22 | 75184 | NaN | 1.0000 | NaN |
| 23 | 28065 | NaN | 0.0000 | NaN |
# Let's plot the relative daughter contribution after rescaling for the new cooling time
plot_radioisotope_contribution(new_dose_tally)