View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001282OpenFOAM[All Projects] Bugpublic2014-05-07 08:152014-06-13 08:00
Assigned Tomattijs 
PlatformLinuxOSSUSE Linux Enterprise ServerOS Version11.2
Product Version2.3.x 
Target VersionFixed in Version2.3.x 
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

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);
+ }
TagsNo tags attached.
Attached Fileszip file icon [^] (15,781 bytes) 2014-05-07 08:15

- Relationships

-  Notes
mattijs (reporter)
2014-06-13 07:59

fixed in 420997e125612db1a5a1e4d49133c9858878c5a6

Thanks for report

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