@@ -319,20 +319,24 @@ Default behavior using OpenMC's native PRNG can be manually specified as::
319319
320320.. _subdivision_fsr :
321321
322- ----------------------------------
323- Subdivision of Flat Source Regions
324- ----------------------------------
325-
326- While the scattering and fission sources in Monte Carlo
327- are treated continuously, they are assumed to be invariant (flat) within a
328- MOC or random ray flat source region (FSR). This introduces bias into the
329- simulation, which can be remedied by reducing the physical size of the FSR
330- to dimensions below that of typical mean free paths of particles.
322+ -----------------------------
323+ Subdivision of Source Regions
324+ -----------------------------
331325
332- In OpenMC, this subdivision currently must be done manually. The level of
326+ While the scattering and fission sources in Monte Carlo are treated
327+ continuously, they are assumed to have a shape (flat or linear) within a MOC or
328+ random ray source region (SR). This introduces bias into the simulation that can
329+ be remedied by reducing the physical size of the SR to be smaller than the
330+ typical mean free paths of particles. While use of linear sources in OpenMC
331+ greatly reduces the error stemming from this approximation, subdivision is still
332+ typically required.
333+
334+ In OpenMC, this subdivision can be done either manually by the user (by defining
335+ additional surfaces and cells in the geometry) or automatically by assigning a
336+ mesh to one or more cells, universes, or material types. The level of
333337subdivision needed will be dependent on the fidelity the user requires. For
334- typical light water reactor analysis, consider the following example subdivision
335- of a two-dimensional 2x2 reflective pincell lattice:
338+ typical light water reactor analysis, consider the following example of manual
339+ subdivision of a two-dimensional 2x2 reflective pincell lattice:
336340
337341.. figure :: ../_images/2x2_materials.jpeg
338342 :class: with-border
@@ -344,9 +348,79 @@ of a two-dimensional 2x2 reflective pincell lattice:
344348 :class: with-border
345349 :width: 400
346350
347- FSR decomposition for an asymmetrical 2x2 lattice (1.26 cm pitch)
351+ Manual decomposition for an asymmetrical 2x2 lattice (1.26 cm pitch)
352+
353+ Geometry cells can also be subdivided into small source regions by assigning a
354+ mesh to a list of domains, with each domain being of type
355+ :class: `openmc.Material `, :class: `openmc.Cell `, or :class: `openmc.Universe `. The
356+ idea of defining a source region as a combination of a base geometry cell and a
357+ mesh element is known as "cell-under-voxel" style geometry, although in OpenMC
358+ the mesh can be any kind and is not restricted to 3D regular voxels. An example
359+ of overlaying a simple 2D mesh over a geometry is given as::
360+
361+ sr_mesh = openmc.RegularMesh()
362+ sr_mesh.dimension = (n, n)
363+ sr_mesh.lower_left = (0.0, 0.0)
364+ sr_mesh.upper_right = (x, y)
365+ domain = geometry.root_universe
366+ settings.random_ray['source_region_meshes'] = [(sr_mesh, [domain])]
367+
368+ In the above example, we apply a single :math: `n \times n` uniform mesh over the
369+ entire domain by assigning it to the root universe of the geometry.
370+ Alternatively, we might want to apply a finer or coarser mesh to different
371+ regions of a 3D problem, for instance, as::
372+
373+ fuel = openmc.Material(name='UO2 fuel')
374+ ...
375+ water = openmc.Material(name='hot borated water')
376+ ...
377+ clad = openmc.Material(name='Zr cladding')
378+ ...
379+
380+ coarse_mesh = openmc.RegularMesh()
381+ coarse_mesh.dimension = (n, n, n)
382+ coarse_mesh.lower_left = (0.0, 0.0, 0.0)
383+ coarse_mesh.upper_right = (x, y, z)
384+
385+ fine_mesh = openmc.RegularMesh()
386+ fine_mesh.dimension = (2*n, 2*n, 2*n)
387+ fine_mesh.lower_left = (0.0, 0.0, 0.0)
388+ fine_mesh.upper_right = (x, y, z)
389+
390+ settings.random_ray['source_region_meshes'] = [(fine_mesh, [fuel, clad]), (coarse_mesh, [water])]
391+
392+ Note that we don't need to adjust the outer bounds of the mesh to tightly wrap
393+ the domain we assign the mesh to. Rather, OpenMC will dynamically generate
394+ source regions based on the mesh bins rays actually visit, such that no
395+ additional memory is wasted even if a domain only intersects a few mesh bins.
396+ Going back to our 2x2 lattice example, if using a mesh-based subdivision, this
397+ might look as below:
398+
399+ .. figure :: ../_images/2x2_sr_mesh.png
400+ :class: with-border
401+ :width: 400
348402
349- In the future, automated subdivision of FSRs via mesh overlay may be supported.
403+ 20x20 overlaid "cell-under-voxel" mesh decomposition for an asymmetrical 2x2 lattice (1.26 cm pitch)
404+
405+ Note that mesh-bashed subdivision is much easier for a user to implement but
406+ does have a few downsides compared to manual subdivision. Manual subdivision can
407+ be done with the specifics of the geometry in mind. As in the pincell example,
408+ it is more efficient to subdivide the fuel region into azimuthal sectors and
409+ radial rings as opposed to a Cartesian mesh. This is more efficient because the
410+ regions are a more uniform size and follow the material boundaries closer,
411+ resulting in the need for fewer source regions. Fewer source regions tends to
412+ equate to a faster computational speed and/or the need for fewer rays per batch
413+ to achieve good statistics. Additionally, applying a mesh often tends to create
414+ a few very small source regions, as shown in the above picture where corners of
415+ the mesh happen to intersect close to the actual fuel-moderator interface. These
416+ small regions are rarely visited by rays, which can result in inaccurate
417+ estimates of the source within those small regions and, thereby, numerical
418+ instability. However, OpenMC utilizes several techniques to detect these small
419+ source regions and mitigate instabilities that are associated with them. In
420+ conclusion, mesh overlay is a great way to subdivide any geometry into smaller
421+ source regions. It can be used while retaining stability, though typically at
422+ the cost of generating more source regions relative to an optimal manual
423+ subdivision.
350424
351425.. _usersguide_flux_norm :
352426
0 commit comments