-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implicit Complement Position in DAGMC Indices #934
Comments
Noting here that this affects other operations in DAGMC such as implicit complement material assignment, which assumes that we read the IPC's material assignment off a graveyard volume before getting to the IPC handle in this method. DAGMC/src/dagmc/dagmcmetadata.cpp Lines 112 to 249 in b001729
|
Does this mean we need a fix for this? Or does your fix take care of this? |
#935 should fix this as well. Just noting that our dependence on the IPC being at the back of the DAGMC index space has affects outside of the geometry queries. |
Closed by #935 |
Short Version
A constant defining the structure of the
EntityHandle
space in MOAB was changed between MOAB 5.3.0 and MOAB 5.4.0 (commit linked below), revealing an issue with placement of the implicit complement handle in the DAGMC indices structure.For a file with enough
MeshSet
's to be read, the implicit complement handle may not appear at the end of theEntityHandle
space, meaning that one may perform a point containment check on the implicit complement volume before other, explicit volumes if looping over all volumes in the model. While its surprising that this constant changed, this is not the fault of MOAB,EntityHandles
are required to be unique but not monotonically increasing when generated. This bug was present before the change in MOAB, but the change makes the likelihood of it occurring much higher.Searching the implicit complement before other volumes can cause problems for source points that are coincident with surfaces. This may only be true for problems with imperfect topology relationships (failed imprinting/merging) and is why it didn't show up in the OpenMC tests, which use only well-formed models.
The fix for us would be to take extra care to ensure that the implicit complement volume is placed at the back of our data structures in
DagMC::build_indices
.In external code interfaces, it would probably be wise to have a check that the implicit complement is checked last. In OpenMC, for example, this would look like the following in
openmc::DAGUniverse::find_cell
:Long (Long) Version
What changed in MOAB?
Between versions 5.3.0 and 5.4.0, a fundamental constant was changed in MOAB,
SequenceManager::DEFAULT_VERTEX_SEQUENCE_SIZE
, in this commit which propagates up to the variableSequenceManager::DEFAULT_MESHSET_SEQUENCE_SIZE
. This update causes the sequence ofEntityHandle
's to change when generating newMeshSet
's. This changes affects other entity types as well, but only theMeshSet
EntityHandle
's impact the problem here.From debugging the
GeomTopoTool::generate_implicit_complement
method:SequenceManager::create_mesh_set
. In both versions of MOAB we then callTypeSequenceManager::find_free_handle
, presumably searching for a free entity handle in the space of the existing handle sequences that have already been allocated.TypeSequenceManager::find_free_handle
, one loop goes over astd::set
ofThe difference between the two becomes evident when loading a file:
MOAB generates and pre-allocates memory for new handles in chunks, referred to as sequences, with a default size based on the variables changed in the commit linked above. The allocation is managed by a
SequenceData
object and associatedEntitySequences
indicate whichEntityHandle
s have been assigned that sequence (viaCore::create_meshset
,Core::create_vertex
, etc.). More on this topic can be found in the documentation here. When a newEntityHandle
is requested and the current sequence is out of space, another is allocated automatically. New sequences are almost always generated with the default size, with some exceptions. File I/O is one of these exceptions and has an impact on loading files with DAGMC.We create a new file set
MeshSet
inDagMC::load_file
, this file gets the firstEntityHandle
available in the sequence (something like12682136550675316737
) in both MOAB versions. Nothing new. The behavior diverges when we load a file inReadUtil::read_sets
. This method looks for a MeshSetSequence that will hold all of the sets in the file. If one isn't found that will contain them all, then a new sequence is created behind the initialMeshSetSequence
that was created when the file set was made. If a sequence exists that will hold all of theMeshSet
's in the file, it is used starting with the next availableEntityHandle
in the sequence. In 5.3.x, the defaultEntityHandle
sequence is holds 524,287 handles whereas in 5.4.1 the default size sequence holds 16,383 handles. The outcome is this:5.3.1 EntityHandle Space:
| File Set | .h5m file sets |
5.4.1 EntityHandle Space:
| File Set | Unused Handle Space | .h5m file sets |
Later, when
DAGMC
creates the implicit complement meshset viamoab::GeomTopoTool::generate_implicit_complement
, the next available handle in the global sequence is used:5.3.1 EntityHandle Space After Generating the Implicit Complement:
| File Set | .h5m file sets | IPC Handle |
5.4.1 EntityHandle Space After Generating the Implicit Complement:
| File Set | IPC Handle | Unused Handle Space | .h5m file sets |
How does this affect DAGMC?
When the implicit complement is generated by DAGMC, a new
MeshSet
is created in the MOAB instance. Previously, theEntityHandle
of thisMeshSet
was larger than all existingMeshSet
's in the MOAB instance (at least in many/most cases??) and, as a result, this handle would end up at the end of theGeomTopoTool::geomRanges
data member (a series of containers that will always iterate over the containedEntityHandle
's in increasing order of their value) when iterating through the volumeEntityHandle
's. This ordering propagates into theDagMC::entHandles
data member that is used by Monte Carlo code interfaces to create cells.The effective change in behavior is that the implicit complement volume is checked for containment before other explicit volumes. In a model where all surfaces aren't merged or other problems exist, this can cause ambiguity in point containment queries. This was previously (perhaps intentionally?) resolved by favoring containment in explicitly defined volumes over the implicit complement volume. With the new ordering of
EntityHandle
's resulting from the upstream change in MOAB, this is no longer the case. So some particles are being born in regions of the implicit complementEvidence of this problem in the Open MSRE Model
This is a model kindly generated and curated by Copenhagen Atomics here . @paulromano discovered a large discrepancy in the eigenvalue when doing nothing but changing between versions of MOAB in his software stack.
OpenMC k-eff w/ 5.3.0: 1.01285 +/- 0.00225
OpenMC k-eff w/ 5.4.1: 0.98537 +/- 0.00220
When debugging the problem and comparing tracks I noted that some tracks of identical position and direction were born in different cells. These cells had different IDs and different indexes in the DAGMC datastructures due to the new
EntityHandle
sequencing, making it difficult to determine the root cause of the issue. Eventually I discovered that theEntityHandle
space of volumes were very different and that the implicit complement handle was at the end of the data structure rather than the front for MOAB 5.4.1:MOAB 5.3.0
MOAB 5.4.1

The text was updated successfully, but these errors were encountered: