View Issue Details

IDProjectCategoryView StatusLast Update
0001282OpenFOAMBugpublic2014-06-13 09:00
Reporteruser528Assigned Touser4 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSSUSE Linux Enterprise ServerOS Version11.2
Summary0001282: splitMeshRegions fails if there are several faceZones between regions
DescriptionAssume I have a mesh with two cellRegions, the boundary between which consists of several faceZones. In such a case, a call to splitMeshRegions -cellZonesOnly -useFaceZones fails with an error message similar to

--> FOAM FATAL ERROR:
1 not found in table. Valid entries: 1(0)

    From function HashTable<T, Key, Hash>::operator[](const Key&)
    in file /nfs/inn/disks/dts_tcad_disk2/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/HashTableI.H at line 117.

FOAM exiting
Steps To Reproduce1. Unpack the attached case. It has a simple 4-cell mesh, the two bottom cells are assigned to one cellZone, the two others to another cellZone. The two faces that separate the cellZones are individually assigned to two faceZones.
2. Run splitMeshRegions -cellZonesOnly -useFaceZones
3. See the error message.

The expected result is two meshes created in a new time directory, and the boundary between those meshes should consist of two patches.
Additional InformationThe problem arises from lines 499-501 of splitMeshRegions.C. There the information about a new patch separating two regions is added to a hash table, the pair of regions ("the edge") being the key of that hash table. However, if there is already such an element in the hash table, that is, if previously another patch separating the same two regions was found, then this data is overwritten. Instead of this, in such a case, the new patch should be added to already existing patches.

The diff to fix the bug is below:
diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
index 7c6d3a4..aac9c5a 100755
--- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
+++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
@@ -495,11 +495,15 @@ void getInterfaceSizes
                 );
             }
             interfaceSizes[nInterfaces] = infoIter();
-
- Map<label> zoneAndInterface;
- zoneAndInterface.insert(zoneID, nInterfaces);
- regionsToInterface.insert(e, zoneAndInterface);
-
+
+
+ if (regionsToInterface.found(e)) {
+ regionsToInterface[e].insert(zoneID, nInterfaces);
+ } else {
+ Map<label> zoneAndInterface;
+ zoneAndInterface.insert(zoneID, nInterfaces);
+ regionsToInterface.insert(e, zoneAndInterface);
+ }
             nInterfaces++;
         }
     }
TagsNo tags attached.

Activities

user528

2014-05-07 09:15

 

user4

2014-06-13 08:59

  ~0003132

fixed in 420997e125612db1a5a1e4d49133c9858878c5a6

Thanks for report

Issue History

Date Modified Username Field Change
2014-05-07 09:15 user528 New Issue
2014-05-07 09:15 user528 File Added: SplitMeshRegions_example.zip
2014-06-13 08:59 user4 Note Added: 0003132
2014-06-13 08:59 user4 Status new => resolved
2014-06-13 08:59 user4 Fixed in Version => 2.3.x
2014-06-13 08:59 user4 Resolution open => fixed
2014-06-13 08:59 user4 Assigned To => user4