summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Moore <connor.moore@psi.ch>2026-06-26 10:21:53 +0200
committerConnor Moore <connor.moore@psi.ch>2026-06-26 10:21:53 +0200
commita1712ef14f75ee1d2c970bfd4d702a31c49a9833 (patch)
treec7edc5f404bfbf49569bf218155426c4f91e4a1a
parent921038efc9cdd5eaf6e0993b18403680d90efe5f (diff)
Metadata fingerprinting in output file, WIP CLI support for homogenization
-rwxr-xr-xhpmr.py43
1 files changed, 36 insertions, 7 deletions
diff --git a/hpmr.py b/hpmr.py
index 5d07188..4d1e2f8 100755
--- a/hpmr.py
+++ b/hpmr.py
@@ -1,6 +1,36 @@
#!/bin/python3
import openmc
import math
+import argparse as ap
+import hashlib as hl
+import sys
+import time
+
+def id_file():
+ path = sys.argv[0]
+
+ with open(path, "rb") as file:
+ contents = file.read()
+
+ filehash = hl.md5(contents).hexdigest()
+
+ print("="*60)
+ print(f"Run date: {time.ctime()}")
+ print(f"Input file MD5: {filehash}")
+ print("="*60)
+
+
+############ COMMAND LINE ARGUMENTS ############
+id_file()
+
+cli_parser = ap.ArgumentParser(
+ prog="HP-RM TRISO Homogenization Study",
+ description="Program to investigate various homogenization techniques for TRISO compacts in the HP-MR benchmark."
+ )
+
+cli_parser.add_argument("-t","--technique",default="none",choices=["none","vwh","rpt","rrpt"],help="What homogenization technique to use (if any) [none/vwh/rpt/rrpt], default none")
+cli_parser.add_argument("-r","--radius",default="0.5",type=float,help="Radius for RPT or RRPT homogenization [cm], default 0.5 cm. In the case of RRPT, this is the inner radius.")
+cli_args = cli_parser.parse_args()
############ MATERIALS ############
# All materials are specified in the report on HEAT PIPE MICROREACTOR MODELING WITH BLUECRAB
@@ -116,8 +146,6 @@ mat_pipe_k_gas.add_element("K",1.0)
mat_pipe_k_gas.set_density("g/cc",1.11e-4)
mat_list.append(mat_pipe_k_gas)
-
-
############ GEOMETRY ############
# All measurements are in cm unless specified
geo_constant_pin_pitch = 2.3
@@ -172,7 +200,6 @@ geo_triso_compact_universe = openmc.Universe(name="TRISO Compact Universe",cells
## VWH TRISO Compact ##
geo_vwh_fracs = []
geo_n_triso = len(geo_triso_compact_packing)
-print(f'{geo_n_triso = }')
# Get volume fractions for mixing
geo_triso_compact_v_tot = math.pi*geo_constant_triso_radius**2*2*geo_constant_height
@@ -202,7 +229,7 @@ for mat in mat_list:
mat_tsl_saved[mat]=list(mat._sab)
mat._sab=[]
-# Now do a simple volume homogenization
+# Simple VWH
mat_triso_vwh = openmc.Material.mix_materials(
materials=[mat_triso_uco, mat_triso_buffer, mat_triso_pyc1, mat_triso_sic, mat_triso_pyc2, mat_graphite_matrix],
fracs=geo_vwh_fracs,
@@ -210,6 +237,8 @@ mat_triso_vwh = openmc.Material.mix_materials(
name="VWH Homogenized TRISO Compact"
)
+# RPT Homogenization
+
# Restore TSL afterwards
for mat, tsl_list in mat_tsl_saved.items():
mat._sab = tsl_list
@@ -218,6 +247,7 @@ mat_triso_vwh.add_s_alpha_beta("c_Graphite")
# Add to list
mat_list.append(mat_triso_vwh)
+materials = openmc.Materials(mat_list)
# Cast into cells and a universe
geo_triso_vwh_fuel_cell = openmc.Cell(name="TRISO VWH Cell",fill=mat_triso_vwh,region=geo_triso_compact_region)
@@ -281,7 +311,6 @@ geo_assembly_cell = openmc.Cell(name="Unit Assembly Cell",fill=geo_assembly_latt
geo_assembly_universe = openmc.Universe(cells=[geo_assembly_cell])
geometry = openmc.Geometry(geo_assembly_universe)
-geometry.export_to_xml()
############ SETTINGS ############
settings = openmc.Settings()
@@ -304,11 +333,11 @@ set_entropy_mesh.upper_right=(+geo_constant_lattice_pitch,+geo_constant_lattice_
set_entropy_mesh.dimension=(30,30,30)
settings.entropy_mesh=set_entropy_mesh
-settings.export_to_xml()
## Export ##
-materials = openmc.Materials(mat_list)
materials.export_to_xml()
+geometry.export_to_xml()
+settings.export_to_xml()
# Run!
openmc.run()