forked from crp/ecp-benchmarks
commit fea65f02928ed7b65b0aa88e16af0e9f308dc28e
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Mon Feb 5 09:20:20 2018 -0600
Remove XML files and old models
commit 423b3ade32be620dab7ba6fe9c292a6ee4758e9e
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Mon Feb 5 09:10:54 2018 -0600
Fix bug in ring generation
commit f5a3acd3d6d0eba7edf4b0c94e76aebdcaa2cd62
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Mon Feb 5 09:05:51 2018 -0600
Add option to specify output directory
commit 0c4bca51b38bbb94fffe1d13157f693bee4dea03
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Tue Jan 23 14:50:09 2018 -0600
Add plots for assembly
commit 2813d95ea694259bd50ae7fa19087f8652fc0bc5
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Sun Jan 21 16:08:45 2018 -0600
Shared compositions when building assembly
commit 5ee50611df13f5df03144266d2c08f2890fdaf72
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Sun Jan 21 15:32:48 2018 -0600
Fix build-core-fresh
commit e375ad22a7fb05def86664f5be8411ee822e23a2
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Fri Jan 19 15:51:51 2018 -0600
Use pathlib in build-assembly and move assembly directory
commit 53d38a3b3711b44dd75313132c4122f2192df16c
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Fri Jan 19 14:39:09 2018 -0600
Add an option to use depleted materials
commit 9c52f82bd0cd989b10938c85586caba331efa1f4
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Jan 17 14:02:27 2018 -0600
Add SMR assembly model
commit 82f60acfb3b8889d812e03eb4ee2007b2a5a501e
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Jan 17 12:34:35 2018 -0600
Add docstrings here and there
commit a957d442a8
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Jan 17 12:18:11 2018 -0600
Special treatment for a single radial/axial region in fuel pins
commit dac1af47ad
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Jan 17 06:54:24 2018 -0600
Add number of rings/axial segments as command-line options
commit c1082420e4
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Jan 17 06:47:03 2018 -0600
Use argparse in build-fresh.py
commit a20d15c0cb
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Jan 17 06:27:01 2018 -0600
Make number of rings configurable
commit 96b1ae8513
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Tue Jan 16 22:44:15 2018 -0600
Generate pin universes within function
commit 0b1965e27f
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Tue Jan 16 22:28:44 2018 -0600
Put geometry and reflector/assembly universes in functions
commit 337d4cff69
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Wed Nov 22 12:22:17 2017 -0600
Make sure sleeve appears on fifth grid spacer
commit 46e379e169
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Tue Nov 14 14:54:14 2017 -0600
Don't break up fuel region over multiple universes in z direction
commit 7e735bec85
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Fri Nov 10 11:49:36 2017 -0600
Fix number of pellets in SMR
commit 186c525c8a
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Thu Nov 2 23:27:48 2017 -0500
Add axial subdivision of fuel pins
commit 6762ab0237
Author: Paul Romano <paul.k.romano@gmail.com>
Date: Fri Oct 20 07:54:57 2017 -0400
Add ten rings in fuel
124 lines
4.1 KiB
Python
124 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import shutil
|
|
import copy
|
|
import argparse
|
|
|
|
import numpy as np
|
|
|
|
import openmc
|
|
from smr.materials import materials
|
|
from smr.plots import core_plots
|
|
from smr.surfaces import lattice_pitch, bottom_fuel_stack, top_active_core
|
|
from smr.core import core_geometry
|
|
|
|
|
|
# Define command-line options
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-m', '--multipole', action='store_true',
|
|
help='Whether to use multipole cross sections')
|
|
parser.add_argument('-t', '--tallies', choices=('cell', 'mat'), default='cell',
|
|
help='Whether to use distribmats or distribcells for tallies')
|
|
parser.add_argument('-r', '--rings', type=int, default=10,
|
|
help='Number of annular regions in fuel')
|
|
parser.add_argument('-a', '--axial', type=int, default=196,
|
|
help='Number of axial subdivisions in fuel')
|
|
parser.add_argument('-d', '--depleted', action='store_true',
|
|
help='Whether UO2 compositions should represent depleted fuel')
|
|
args = parser.parse_args()
|
|
|
|
|
|
geometry = core_geometry(args.rings, args.axial, args.depleted)
|
|
|
|
#### "Differentiate" the geometry if using distribmats
|
|
if args.tallies == 'mat':
|
|
# Count the number of instances for each cell and material
|
|
geometry.determine_paths(instances_only=True)
|
|
|
|
# Extract all cells filled by a fuel material
|
|
fuel_mats = {m for m in materials if 'UO2 Fuel' in m.name}
|
|
|
|
for cell in geometry.get_all_cells().values():
|
|
if cell.fill in fuel_mats:
|
|
# Fill cell with list of "differentiated" materials
|
|
cell.fill = [cell.fill.clone() for i in range(cell.num_instances)]
|
|
|
|
#### Create OpenMC "materials.xml" file
|
|
all_materials = geometry.get_all_materials()
|
|
materials = openmc.Materials(all_materials.values())
|
|
materials.export_to_xml()
|
|
|
|
|
|
#### Create OpenMC "geometry.xml" file
|
|
geometry.export_to_xml()
|
|
|
|
|
|
#### Create OpenMC "settings.xml" file
|
|
|
|
# Construct uniform initial source distribution over fissionable zones
|
|
lower_left = [-7.*lattice_pitch/2., -7.*lattice_pitch/2., bottom_fuel_stack]
|
|
upper_right = [+7.*lattice_pitch/2., +7.*lattice_pitch/2., top_active_core]
|
|
source = openmc.source.Source(space=openmc.stats.Box(lower_left, upper_right))
|
|
source.space.only_fissionable = True
|
|
|
|
settings = openmc.Settings()
|
|
settings.batches = 200
|
|
settings.inactive = 100
|
|
settings.particles = 10000
|
|
settings.output = {'tallies': False}
|
|
settings.source = source
|
|
settings.sourcepoint_write = False
|
|
|
|
if args.multipole:
|
|
settings.temperature = {'multipole': True, 'tolerance': 1000}
|
|
|
|
settings.export_to_xml()
|
|
|
|
|
|
#### Create OpenMC "plots.xml" file
|
|
plots = core_plots()
|
|
plots.export_to_xml()
|
|
|
|
|
|
#### Create OpenMC "tallies.xml" file
|
|
tallies = openmc.Tallies()
|
|
|
|
# Extract all fuel materials
|
|
materials = geometry.get_materials_by_name(name='Fuel', matching=False)
|
|
|
|
# If using distribcells, create distribcell tally needed for depletion
|
|
if args.tallies == 'cell':
|
|
# Extract all cells filled by a fuel material
|
|
fuel_cells = []
|
|
for cell in geometry.get_all_cells().values():
|
|
if cell.fill in materials:
|
|
tally = openmc.Tally(name='depletion tally')
|
|
tally.scores = ['(n,p)', '(n,a)', '(n,gamma)',
|
|
'fission', '(n,2n)', '(n,3n)', '(n,4n)']
|
|
tally.nuclides = cell.fill.get_nuclides()
|
|
tally.filters.append(openmc.DistribcellFilter([cell]))
|
|
tallies.append(tally)
|
|
|
|
# If using distribmats, create material tally needed for depletion
|
|
elif args.tallies == 'mat':
|
|
tally = openmc.Tally(name='depletion tally')
|
|
tally.scores = ['(n,p)', '(n,a)', '(n,gamma)',
|
|
'fission', '(n,2n)', '(n,3n)', '(n,4n)']
|
|
tally.nuclides = materials[0].get_nuclides()
|
|
tally.filters = [openmc.MaterialFilter(materials)]
|
|
tallies.append(tally)
|
|
|
|
tallies.export_to_xml()
|
|
|
|
|
|
#### Move all XML files to 'fresh' directory
|
|
|
|
if not os.path.exists('core-fresh'):
|
|
os.makedirs('core-fresh')
|
|
|
|
shutil.move('materials.xml', 'core-fresh/materials.xml')
|
|
shutil.move('geometry.xml', 'core-fresh/geometry.xml')
|
|
shutil.move('settings.xml', 'core-fresh/settings.xml')
|
|
shutil.move('tallies.xml', 'core-fresh/tallies.xml')
|
|
shutil.move('plots.xml', 'core-fresh/plots.xml')
|