OpenMC TRISO example is lagging when the height is increased.

156 views
Skip to first unread message

Sharif Abu Darda

unread,
Aug 6, 2020, 4:29:53 AM8/6/20
to OpenMC Users Group
I am trying to run the TRISO example in https://docs.openmc.org/en/latest/examples/triso.html

I am creating a surrounding water for the box and I increased the height of the box as 200 cm. Now, It takes 35 mins just to generate the xml files with a pf=0.35. Now, When I tried to run the K-effective it is stuck in 
.........................

Initializing source particles...


 ====================>     K EIGENVALUE SIMULATION     <====================


  Bat./Gen.      k            Average k

  =========   ========   ====================

and not goes to first batch even after 30 mins. Below is the code I am using. What am I doing wrong. I first encounter the issue when I tried to generate a TRISO containing cylinder like fuel rods. That code was hanging, I tried the example code as it is, and just increased the height and the pf. But, the issue is still there. Does is possible to design a TRISO fuel rod in OpenMC? how? 

import openmc
from math import pi
from IPython.display import Image
import numpy as np
import matplotlib.pyplot as plt
import openmc.model 

# OpenMC simulation parameters
batches = 120                                                              
inactive = 20
particles = 10000

###############################################################################
#                 Exporting to OpenMC material.xml file
###############################################################################

# Material
water = openmc.Material()
water.set_density('g/cm3', 0.6928)
water.add_nuclide('H1', 0.11190, 'wo')
water.add_nuclide('O16', 0.88810, 'wo')
water.add_nuclide('B10', 1.4e-4, 'wo')

fuel = openmc.Material()
fuel.set_density('g/cm3', 10.5)
fuel.add_nuclide('U235', 4.6716e-02)
fuel.add_nuclide('U238', 2.8697e-01)
fuel.add_nuclide('O16',  5.0000e-01)
fuel.add_element('C', 1.6667e-01)

buff = openmc.Material()
buff.set_density('g/cm3', 1.0)
buff.add_element('C', 1.0)
buff.add_s_alpha_beta('c_Graphite')

PyC1 = openmc.Material()
PyC1.set_density('g/cm3', 1.9)
PyC1.add_element('C', 1.0)
PyC1.add_s_alpha_beta('c_Graphite')

PyC2 = openmc.Material()
PyC2.set_density('g/cm3', 1.87)
PyC2.add_element('C', 1.0)
PyC2.add_s_alpha_beta('c_Graphite')

SiC = openmc.Material()
SiC.set_density('g/cm3', 3.2)
SiC.add_element('C', 0.5)
SiC.add_element('Si', 0.5)

graphite = openmc.Material()
graphite.set_density('g/cm3', 1.1995)
graphite.add_element('C', 1.0)
graphite.add_s_alpha_beta('c_Graphite')

# Instantiate a Materials collection and export to XML
materials_file = openmc.Materials([water, fuel, buff, PyC1, PyC2, SiC, graphite])
materials_file.export_to_xml()

###############################################################################
#                 Exporting to OpenMC geometry.xml file
###############################################################################

########################################################## Instantiate Surfaces 
X_0 = openmc.XPlane(x0=0, name='X_0')
Y_0 = openmc.YPlane(y0=0, name='Y_0')
Z_0 = openmc.ZPlane(z0=0, name='Z_0')
min_x = openmc.XPlane(x0=-0.5)
max_x = openmc.XPlane(x0=0.5)
min_y = openmc.YPlane(y0=-0.5)
max_y = openmc.YPlane(y0=0.5)
min_z = openmc.ZPlane(z0=-108.3, boundary_type='reflective')
max_z = openmc.ZPlane(z0=91.7, boundary_type='reflective')
fuel_B_water = openmc.ZCylinder(x0=0, y0=0, r=3.0, boundary_type= 'reflective')
########################################################### Instantiate Cells 
spheres = [openmc.Sphere(r=1e-3*r)
           for r in [45.0, 51.0, 54.5, 58.0]]
cells = [openmc.Cell(fill=fuel, region=-spheres[0]),
         openmc.Cell(fill=buff, region=+spheres[0] & -spheres[1]),
         openmc.Cell(fill=PyC1, region=+spheres[1] & -spheres[2]),
         openmc.Cell(fill=SiC, region=+spheres[2] & -spheres[3]),
         openmc.Cell(fill=PyC2, region=+spheres[3])]
triso_univ = openmc.Universe(cells=cells)
region = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
outer_radius = 61.5*1e-3
centers = openmc.model.pack_spheres(radius=outer_radius, region=region, pf=0.35)
trisos = [openmc.model.TRISO(outer_radius, triso_univ, c) for c in centers]
box = openmc.Cell(region=region)
lower_left, upper_right = box.region.bounding_box
shape = (1, 1, 1)
pitch = (upper_right - lower_left)/shape
lattice = openmc.model.create_triso_lattice(trisos, lower_left, pitch, shape, graphite)
box.fill = lattice
Bundle_B_water = openmc.Cell(region= -fuel_B_water & +X_0 & +max_x & +min_z & -max_z | -fuel_B_water &-X_0 & -min_x & +min_z & -max_z | -fuel_B_water &-Y_0 & -min_y & +min_z & -max_z | -fuel_B_water &+Y_0  & +max_y & +min_z & -max_z, fill= water)
########################################################### Instantiate Universes 
root = openmc.Universe(universe_id=0)
root.add_cells([box, Bundle_B_water])
geometry = openmc.Geometry(root)
geometry.export_to_xml()

###############################################################################
#                   Exporting to OpenMC settings.xml file
###############################################################################

# Instantiate a Settings object, set all runtime parameters, and export to XML
settings_file = openmc.Settings()
settings_file.batches = batches
settings_file.inactive = inactive
settings_file.particles = particles
bounds = [-0.5,-0.5,-108.3,0.5,0.5,91.7]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:] )#only_fissionable=True)
settings_file.source = openmc.source.Source(space=uniform_dist)
settings_file.export_to_xml()

###############################################################################
#                   Exporting to OpenMC plot.xml file
###############################################################################

plot_6 = openmc.Plot()
plot_6.basis ='xy'
plot_6.origin = [0, 0, 0]
plot_6.width = [4, 4]
plot_6.pixels = [500, 500]
plot_6.color_by = 'material'

plot = openmc.Plot()
plot.basis ='xz'
plot.origin = [0, 0, 0]
plot.width = [50, 450]
plot.pixels = [500, 500]
plot.color_by = 'material'

plots = openmc.Plots()
plots += [plot_6, plot]
plots.export_to_xml()

My fuel rod containing TRISO is below. Here instead of a box region, I used a cylinder region and keep everything else to generate TRISO as same as example. 

fuel_top= openmc.ZPlane(z0= +91.7)
bottom_cap_in= openmc.ZPlane(z0= -108.3)
fuel_B_fuel = openmc.ZCylinder(x0=0, y0=0, r=0.3922)
region_1= -fuel_B_fuel & +bottom_cap_in & -fuel_top
Bundle_B_fuel_1 = openmc.Cell(name='cell 4', region=region_1)
outer_radius_1 = 61.5*1e-3
centers_1 = openmc.model.pack_spheres(radius=outer_radius_1, region=region_1, pf=0.35)
trisos_1 = [openmc.model.TRISO(outer_radius_1, triso_univ_1, c) for c in centers_1]
ll, ur = Bundle_B_fuel_1.region.bounding_box
shape_1 = (1, 1, 1)
pitch_1 = (ur - ll)/shape_1
lattice1 = openmc.model.create_triso_lattice(trisos_1, ll, pitch_1, shape_1, graphite)
Bundle_B_fuel_1.fill = lattice1

Please guide. 

pshr...@gmail.com

unread,
Aug 6, 2020, 10:14:11 PM8/6/20
to Sharif Abu Darda, OpenMC Users Group
Hi Sharif,

One thing that jumps out to me is the shape of the TRISO lattice. I'd try creating a TRISO lattice with a shape greater than (1, 1, 1). The lattice is used to accelerate the cell containment search when sourcing and tracking particles by limiting the search to TRISOs in the same lattice cell as the particle. With a shape of (1, 1, 1), all of the TRISOs are in the same lattice cell and in turn all of the TRISOs are in the search list, which is likely why it's taking so long to source those particles.

As a starting point, I've used a shape that is something like the size of the TRISO region divided by 2 diameters of the TRISO particle in each dimension - meaning you'll have ~8-10 TRISOs per lattice cell to search. For your model with a box width of 1 cm and an outer TRISO radius of 0.0613 cm this would result in a shape of (4, 4, 4). This is just a guideline though and something like (8, 8, 8) would be totally reasonable as well. The optimal shape for performance will vary model to model, so feel free to use your best judgement of course.

I hope this helps.

Best regards,

Patrick Shriwise
608-446-8173



--
You received this message because you are subscribed to the Google Groups "OpenMC Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openmc-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openmc-users/77240226-6373-40b5-97bf-ec738ac9bcb5o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages