-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from fusion-energy/develop
fixed a bug with volume normalisation
- Loading branch information
Showing
4 changed files
with
127 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,54 @@ | ||
import openmc | ||
import openmc_post_processor as opp | ||
from spectrum_plotter import plot_spectrum # a convenient plotting package | ||
from spectrum_plotter import plot_spectrum_from_tally # a convenient plotting package | ||
|
||
# loads in the statepoint file containing tallies | ||
statepoint = openmc.StatePoint(filepath="statepoint.2.h5") | ||
|
||
# constructs a dictionary of tallies | ||
results = {} | ||
for tally_name in ["2_neutron_spectra", "3_neutron_spectra"]: | ||
results["2_neutron_spectra"] = statepoint.get_tally(name="2_neutron_spectra") | ||
results["3_neutron_spectra"] = statepoint.get_tally(name="3_neutron_spectra") | ||
|
||
# gets one tally from the available tallies | ||
my_tally = statepoint.get_tally(name=tally_name) | ||
|
||
# returns the tally with normalisation per pulse | ||
result = opp.process_spectra_tally( | ||
tally=my_tally, | ||
required_units="centimeter / pulse", | ||
required_energy_units="MeV", | ||
source_strength=1.3e6, | ||
) | ||
results[tally_name] = result | ||
# plots a graph of the results with the units as recorded in the tally | ||
plot = plot_spectrum_from_tally( | ||
spectrum=results, | ||
x_label="Energy [MeV]", | ||
y_label="neutron flux [centimeters / simulated_particle]", | ||
x_scale="log", | ||
y_scale="log", | ||
filename="combine_spectra_plot_1.html", | ||
required_energy_units="eV", | ||
plotting_package='plotly', | ||
required_units="centimeters / simulated_particle", | ||
) | ||
|
||
|
||
# plots a graph of the results | ||
plot = plot_spectrum( | ||
# plots a graph of the results with the units normalized for source strength | ||
plot = plot_spectrum_from_tally( | ||
spectrum=results, | ||
x_label="Energy [MeV]", | ||
y_label="neutron flux [centimeter / second]", | ||
x_scale="log", | ||
y_scale="log", | ||
# trim_zeros=False, | ||
filename="combine_spectra_plot.html", | ||
plotting_package='plotly' | ||
filename="combine_spectra_plot_2.html", | ||
required_energy_units="MeV", | ||
plotting_package='plotly', | ||
required_units="centimeter / second", | ||
source_strength=1.3e6, | ||
) | ||
|
||
# plots a graph of the results with the units normalized for source strength and volume | ||
plot = plot_spectrum_from_tally( | ||
spectrum=results, | ||
x_label="Energy [MeV]", | ||
y_label="neutron flux [neutrons s^-1 cm^-2]", | ||
x_scale="log", | ||
y_scale="log", | ||
filename="combine_spectra_plot_3.html", | ||
required_energy_units="MeV", | ||
plotting_package='plotly', | ||
required_units="neutrons / second * cm ** -2", | ||
source_strength=1.3e7, | ||
volume=100 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters