Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions models/fng_str/openmc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--batches", type=int, default=100)
parser.add_argument("-p", "--particles", type=int, default=int(1e8))
parser.add_argument("-s", "--threads", type=int)
parser.add_argument("-b", "--batches", type=int, default=100,
help='Number of batches to simulate (int)')
parser.add_argument("-p", "--particles", type=int,
default=int(1e8), help='Number of particles per batch (int)')
parser.add_argument("-s", "--threads", type=int,
help='Number of threads to use in the simulation (int)')
group = parser.add_argument_group("tallies")
group.add_argument("-r", "--reaction_rates_onaxis", action='store_true',
default=False)
default=False, help='Calculate the reaction rates on-axis case')
group.add_argument("-o", "--reaction_rates_offaxis", action='store_true',
default=False)
default=False, help='Calculate the reaction rates off-axis case')
group.add_argument("-d", "--heating", action='store_true',
default=False)
default=False, help='Calculate the nuclear heating case')

args = parser.parse_args()

Expand Down Expand Up @@ -2177,13 +2180,11 @@ def main():
settings.batches = args.batches
settings.particles = args.particles
settings.source = source
settings.weight_windows = openmc.wwinp_to_wws("weight_windows.cadis.wwinp")
if args.heating:
settings.survival_biasing = True
settings.photon_transport = True
settings.electron_treatment = 'ttb'
settings.weight_windows = openmc.wwinp_to_wws("ww_heating.cadis.wwinp")
else:
settings.weight_windows = openmc.wwinp_to_wws("ww_rr.cadis.wwinp")
settings.output = {'tallies': False}

############################################################################
Expand Down
14 changes: 7 additions & 7 deletions models/fng_str/postprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"outputs": [],
"source": [
"# read sinbad data\n",
"experiment_file = ofb.ResultsFromDatabase('experiment.h5', path='results_database')\n",
"mcnp_eff3_file = ofb.ResultsFromDatabase('mcnp-4a-b_eff3.h5', path='results_database')\n",
"mcnp_fendl1_file = ofb.ResultsFromDatabase('mcnp-4a-b_fendl1.h5', path='results_database')\n",
"mcnp_fendl2_file = ofb.ResultsFromDatabase('mcnp-4a-b_fendl2.h5', path='results_database')"
"experiment_file = ofb.ResultsFromDatabase('results_database/experiment.h5')\n",
"mcnp_eff3_file = ofb.ResultsFromDatabase('results_database/mcnp-4a-b_eff3.h5')\n",
"mcnp_fendl1_file = ofb.ResultsFromDatabase('results_database/mcnp-4a-b_fendl1.h5')\n",
"mcnp_fendl2_file = ofb.ResultsFromDatabase('results_database/mcnp-4a-b_fendl2.h5')"
]
},
{
Expand All @@ -52,9 +52,9 @@
"outputs": [],
"source": [
"# read openmc results in results_database/\n",
"openmc_fendl3_file = ofb.ResultsFromDatabase('openmc-0-14-0_fendl32b.h5', path='results_database')\n",
"openmc_endfb8_file = ofb.ResultsFromDatabase('openmc-0-14-0_endfb80.h5', path='results_database')\n",
"openmc_jeff3_file = ofb.ResultsFromDatabase('openmc-0-14-0_jeff33.h5', path='results_database')"
"openmc_fendl3_file = ofb.ResultsFromDatabase('results_database/openmc-0-14-0_fendl32b.h5')\n",
"openmc_endfb8_file = ofb.ResultsFromDatabase('results_database/openmc-0-14-0_endfb80.h5')\n",
"openmc_jeff3_file = ofb.ResultsFromDatabase('results_database/openmc-0-14-0_jeff33.h5')"
]
},
{
Expand Down
33 changes: 13 additions & 20 deletions models/fng_str/run_and_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import numpy as np
import pandas as pd
from pathlib import Path
import h5py

# ignore NaturalNameWarnings
import warnings
Expand All @@ -17,9 +16,12 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-x", "--xslib", type=str)
parser.add_argument("-t", "--when", type=str, default='n/a')
parser.add_argument("-w", "--where", type=str, default='n/a')
parser.add_argument("-x", "--xslib", type=str,
help="Strign with Cross section library name and version (e.g. 'FENDL-2.3')")
parser.add_argument("-t", "--when", type=str, default='n/a',
help="String with the month and year the simulation is run as (e.g. 'June 2021')")
parser.add_argument("-w", "--where", type=str, default='n/a',
help="String with the place/institution where the simulation is run (e.g. 'MIT-PSFC')")

args = parser.parse_args()

Expand Down Expand Up @@ -60,10 +62,10 @@ def main():

# read statepoint file
onaxis_file = ofb.ResultsFromOpenmc(
'statepoint.100.h5', 'reaction_rates_onaxis')
'reaction_rates_onaxis/statepoint.100.h5')
offaxis_file = ofb.ResultsFromOpenmc(
'statepoint.100.h5', 'reaction_rates_offaxis')
heating_file = ofb.ResultsFromOpenmc('statepoint.100.h5', 'heating')
'reaction_rates_offaxis/statepoint.100.h5')
heating_file = ofb.ResultsFromOpenmc('heating/statepoint.100.h5')

# openmc hdf file
filename = ofb.build_hdf_filename(
Expand Down Expand Up @@ -132,22 +134,13 @@ def main():
tally_df = pd.DataFrame(d)

path_to_file = Path('results_database') / filename

# write the tally in the hdf file
tally_df.to_hdf(path_to_file, tally_name, mode='a',
format='table', data_columns=True, index=False)
code_version = 'openmc-' + \
'.'.join(map(str, heating_file.get_openmc_version))

# write attributes to the hdf file
with h5py.File(path_to_file, 'a') as f:
f[tally_name + '/table'].attrs['x_axis'] = xaxis_name
f.attrs['code_version'] = code_version
f.attrs['xs_library'] = args.xslib.strip().replace(' ', '')
f.attrs['batches'] = heating_file.get_batches
f.attrs['particles_per_batch'] = heating_file.get_particles_per_batch
f.attrs['when'] = args.when
f.attrs['where'] = args.where
xs_library = args.xslib.strip().replace(' ', '')
ofb.to_hdf(tally_df, path_to_file, tally_name, xs_library, xaxis_name,
args.when, args.where, code_version,
heating_file.get_batches, heating_file.get_particles_per_batch)


if __name__ == "__main__":
Expand Down
13 changes: 8 additions & 5 deletions models/fng_w/openmc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--batches", type=int, default=100)
parser.add_argument("-p", "--particles", type=int, default=int(1e7))
parser.add_argument("-s", "--threads", type=int)
parser.add_argument("-b", "--batches", type=int, default=100,
help='Number of batches to simulate (int)')
parser.add_argument("-p", "--particles", type=int,
default=int(1e7), help='Number of particles per batch (int)')
parser.add_argument("-s", "--threads", type=int,
help='Number of threads to use in the simulation (int)')
group = parser.add_argument_group("tallies")
group.add_argument("-r", "--reaction_rates", action='store_true',
default=False)
default=False, help='Calculate the reaction rates case')
group.add_argument("-d", "--heating", action='store_true',
default=False)
default=False, help='Calculate the nuclear heating case')

args = parser.parse_args()

Expand Down
15 changes: 7 additions & 8 deletions models/fng_w/postprocessing.ipynb

Large diffs are not rendered by default.

Binary file not shown.
32 changes: 12 additions & 20 deletions models/fng_w/run_and_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import subprocess
import openmc_fusion_benchmarks as ofb
import helpers
import numpy as np
import pandas as pd
from pathlib import Path
import h5py

# ignore NaturalNameWarnings
import warnings
Expand All @@ -17,9 +15,12 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-x", "--xslib", type=str)
parser.add_argument("-t", "--when", type=str, default='n/a')
parser.add_argument("-w", "--where", type=str, default='n/a')
parser.add_argument("-x", "--xslib", type=str,
help="Strign with Cross section library name and version (e.g. 'FENDL-2.3')")
parser.add_argument("-t", "--when", type=str, default='n/a',
help="String with the month and year the simulation is run as (e.g. 'June 2021')")
parser.add_argument("-w", "--where", type=str, default='n/a',
help="String with the place/institution where the simulation is run (e.g. 'MIT-PSFC')")

args = parser.parse_args()

Expand Down Expand Up @@ -50,8 +51,8 @@ def main():

# read statepoint file
reaction_rates_file = ofb.ResultsFromOpenmc(
'statepoint.100.h5', 'reaction_rates')
heating_file = ofb.ResultsFromOpenmc('statepoint.100.h5', 'heating')
'reaction_rates/statepoint.100.h5')
heating_file = ofb.ResultsFromOpenmc('heating/statepoint.100.h5')

# generate openmc hdf file
filename = ofb.build_hdf_filename(
Expand Down Expand Up @@ -79,22 +80,13 @@ def main():
tally_df = pd.DataFrame(d)

path_to_file = Path('results_database') / filename

# write the tally in the hdf file
tally_df.to_hdf(path_to_file, tally_name, mode='a',
format='table', data_columns=True, index=False)
code_version = 'openmc-' + \
'.'.join(map(str, heating_file.get_openmc_version))

# write attributes to the hdf file
with h5py.File(path_to_file, 'a') as f:
f[tally_name + '/table'].attrs['x_axis'] = xaxis_name
f.attrs['code_version'] = code_version
f.attrs['xs_library'] = args.xslib.strip().replace(' ', '')
f.attrs['batches'] = heating_file.get_batches
f.attrs['particles_per_batch'] = heating_file.get_particles_per_batch
f.attrs['when'] = args.when
f.attrs['where'] = args.where
xs_library = args.xslib.strip().replace(' ', '')
ofb.to_hdf(tally_df, path_to_file, tally_name, xs_library, xaxis_name,
args.when, args.where, code_version,
heating_file.get_batches, heating_file.get_particles_per_batch)


if __name__ == "__main__":
Expand Down
9 changes: 6 additions & 3 deletions models/fns_clean_w/openmc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--batches", type=int, default=100)
parser.add_argument("-p", "--particles", type=int, default=int(1e7))
parser.add_argument("-s", "--threads", type=int)
parser.add_argument("-b", "--batches", type=int, default=100,
help='Number of batches to simulate (int)')
parser.add_argument("-p", "--particles", type=int,
default=int(1e7), help='Number of particles per batch (int)')
parser.add_argument("-s", "--threads", type=int,
help='Number of threads to use in the simulation (int)')

args = parser.parse_args()

Expand Down
4 changes: 2 additions & 2 deletions models/fns_clean_w/postprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"outputs": [],
"source": [
"# read sinbad data\n",
"experiment_file = ofb.ResultsFromDatabase('experiment.h5', path='results_database')"
"experiment_file = ofb.ResultsFromDatabase('results_database/experiment.h5')"
]
},
{
Expand All @@ -54,7 +54,7 @@
"outputs": [],
"source": [
"# read openmc results in results_database/\n",
"openmc_fendl3_file = ofb.ResultsFromDatabase('openmc-0-14-0_fendl32b.h5', path='results_database')"
"openmc_fendl3_file = ofb.ResultsFromDatabase('results_database/openmc-0-14-0_fendl32b.h5')"
]
},
{
Expand Down
Binary file not shown.
11 changes: 7 additions & 4 deletions models/fns_clean_w/run_and_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-x", "--xslib", type=str)
parser.add_argument("-t", "--when", type=str, default='n/a')
parser.add_argument("-w", "--where", type=str, default='n/a')
parser.add_argument("-x", "--xslib", type=str,
help="Strign with Cross section library name and version (e.g. 'FENDL-2.3')")
parser.add_argument("-t", "--when", type=str, default='n/a',
help="String with the month and year the simulation is run as (e.g. 'June 2021')")
parser.add_argument("-w", "--where", type=str, default='n/a',
help="String with the place/institution where the simulation is run (e.g. 'MIT-PSFC')")

args = parser.parse_args()

Expand All @@ -45,7 +48,7 @@ def main():
p.wait()

# read statepoint file
openmc_file = ofb.ResultsFromOpenmc('statepoint.100.h5', 'results')
openmc_file = ofb.ResultsFromOpenmc('results/statepoint.100.h5')

# openmc hdf file
filename = ofb.build_hdf_filename(
Expand Down
10 changes: 6 additions & 4 deletions models/fns_duct/openmc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--batches", type=int, default=100)
parser.add_argument("-p", "--particles", type=int, default=int(1e9))
parser.add_argument("-s", "--threads", type=int)
parser.add_argument("-c", "--cwd", type=str)
parser.add_argument("-b", "--batches", type=int, default=100,
help='Number of batches to simulate (int)')
parser.add_argument("-p", "--particles", type=int,
default=int(1e9), help='Number of particles per batch (int)')
parser.add_argument("-s", "--threads", type=int,
help='Number of threads to use in the simulation (int)')

args = parser.parse_args()

Expand Down
10 changes: 5 additions & 5 deletions models/fns_duct/postprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"outputs": [],
"source": [
"# read sinbad data\n",
"experiment_file = ofb.ResultsFromDatabase('experiment.h5', path='results_database')\n",
"mcnp_jendl33_file = ofb.ResultsFromDatabase('mcnp-4b-c_jendl33.h5', path='results_database')\n",
"mcnp_fendl2_file = ofb.ResultsFromDatabase('mcnp-4b-c_fendl2.h5', path='results_database')"
"experiment_file = ofb.ResultsFromDatabase('results_database/experiment.h5')\n",
"mcnp_jendl33_file = ofb.ResultsFromDatabase('results_database/mcnp-4b-c_jendl33.h5')\n",
"mcnp_fendl2_file = ofb.ResultsFromDatabase('results_database/mcnp-4b-c_fendl2.h5')"
]
},
{
Expand All @@ -53,8 +53,8 @@
"outputs": [],
"source": [
"# read openmc results in results_database/\n",
"openmc_fendl3_file = ofb.ResultsFromDatabase('openmc-0-14-0_fendl32b.h5', path='results_database')\n",
"openmc_endfb8_file = ofb.ResultsFromDatabase('openmc-0-14-0_endfb80.h5', path='results_database')"
"openmc_fendl3_file = ofb.ResultsFromDatabase('results_database/openmc-0-14-0_fendl32b.h5')\n",
"openmc_endfb8_file = ofb.ResultsFromDatabase('results_database/openmc-0-14-0_endfb80.h5')"
]
},
{
Expand Down
11 changes: 7 additions & 4 deletions models/fns_duct/run_and_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
def _parse_args():
"""Parse and return commandline arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-x", "--xslib", type=str)
parser.add_argument("-t", "--when", type=str, default='n/a')
parser.add_argument("-w", "--where", type=str, default='n/a')
parser.add_argument("-x", "--xslib", type=str,
help="Strign with Cross section library name and version (e.g. 'FENDL-2.3')")
parser.add_argument("-t", "--when", type=str, default='n/a',
help="String with the month and year the simulation is run as (e.g. 'June 2021')")
parser.add_argument("-w", "--where", type=str, default='n/a',
help="String with the place/institution where the simulation is run (e.g. 'MIT-PSFC')")

args = parser.parse_args()

Expand All @@ -41,7 +44,7 @@ def main():
p.wait()

# read statepoint file
openmc_file = ofb.ResultsFromOpenmc('statepoint.100.h5', 'results')
openmc_file = ofb.ResultsFromOpenmc('results/statepoint.100.h5')

# store activation foil results
xaxis_name = 'Detector No.'
Expand Down
4 changes: 2 additions & 2 deletions notebooks/plotting_results.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"outputs": [],
"source": [
"# experimental results\n",
"experiment_file = ofb.ResultsFromDatabase(filename='experiment.h5', path='example_database')\n",
"experiment_file = ofb.ResultsFromDatabase(file='example_database/experiment.h5')\n",
"experiment_results = experiment_file.get_tally_dataframe(tally_name='rr_nb93')\n",
"# mcnp results \n",
"mcnp_file = ofb.ResultsFromDatabase('mcnp-4b-c_fendl2.h5', path='example_database')\n",
"mcnp_file = ofb.ResultsFromDatabase(file='example_database/mcnp-4b-c_fendl2.h5')\n",
"mcnp_results = mcnp_file.get_tally_dataframe(tally_name='rr_nb93')"
]
},
Expand Down
4 changes: 2 additions & 2 deletions notebooks/push_openmc_to_database.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"metadata": {},
"outputs": [],
"source": [
"openmc_results = ofb.ResultsFromOpenmc(statepoint_file='example_statepoint.100.h5', path='example_results')"
"openmc_results = ofb.ResultsFromOpenmc(file='example_results/example_statepoint.100.h5')"
]
},
{
Expand Down Expand Up @@ -472,7 +472,7 @@
}
],
"source": [
"openmc_file = ofb.ResultsFromDatabase(filename='openmc-0-13-3_fendl32b.h5', path='example_database')\n",
"openmc_file = ofb.ResultsFromDatabase(file='example_database/openmc-0-13-3_fendl32b.h5')\n",
"openmc_file.get_tally_dataframe(tally_name='rr_onaxis1_nb93')"
]
},
Expand Down
Loading