How to specify boundary current

Hi all,

I want to know if the neutron current on the boundary (inward and outward) can be specified in openmc. In other words, the boundary current is given as the boundary condition. How to apply this boundary in openmc. Can you give me some advice? Thank you.

yahui

There’s no “easy” way to do this, but depending on the shape of your boundary, there may be several ways to achieve it. For starters, if your boundary is an x-, y- or z-plane, you can use openmc.stats.CartesianIndependent to specify a distribution over each of the directions. For example, to have a source on a plane at z=5 that extends from x=-10 to 10 and y=-10 to 10:

x_dist = openmc.stats.Uniform(-10, 10)
y_dist = openmc.stats.Uniform(-10, 10)
z_dist = openmc.stats.Discrete([5.0], [1.0])
spatial_dist = openmc.stats.CartesianIndependent(x_dist, y_dist, z_dist)

Then you would need an angular distribution. For example, if you wanted a monodirectional distribution facing in the negative z direction:

angle_dist = openmc.stats.Monodirectional((0.0, 0.0, -1.0))

Then put these together in a source object

settings = openmc.Settings()
settings.source = openmc.Source(space=spatial_dist, angle=angle_dist)

If this is not a viable approach, you could create a source file manually with source points distributed on the boundary

n_source = 10000
source_particles = []
for _ in range(n_source):
    # sample position/angle/energy of source site using Python
    p = openmc.SourceParticle(...)
    source_particles.append(p)
openmc.write_source_file(source_particles, "my_source.h5")

Then specify in the settings to use this file:

settings = openmc.Settings()
settings.source = openmc.Source(filename="my_source.h5")

Finally, your last option might be to write a C++ custom source routine.

3 Likes

Hey @paulromano,

Although this may not have been the intention of @wangyahui, this answer does not work for the case of a prescribed incident flux boundary condition for a k eigenvalue calculation. As far as I can tell OpenMC has no concept of a boundary source for a k eigenvalue calculation, and the source purely refers to the initial guess of the fission source, which doesn’t affect the problem (assuming it is well converged). Note that inhomogeneous (incident flux) boundary conditions are mathematically well defined for k eigenvalue calculations despite the fact that they resemble a fixed source problem. Are there any workarounds to this to make it possible to, for example, compute incident flux response functions in OpenMC?

(for reference: incident flux response expansion paper)