snappyHexMesh: multi-region closed volume stl region assignment broken
Summary
snappyHexMesh seems to delete all cells despite having 2 closed name surfaces that are marked as inside. One is nested inside the other but that's about the only tricky thing here.
In intermediate output it does seem snappy refines out the mesh with the right regions set from regionSplit, but removes them before finishing Foam::meshRefinement::baffleAndSplitMesh ending in crashes.
Basically from refined cells, snappyHexMesh should just be seeing if each one of the cell centers is unset and if it is, it should check if the cell center is inside any one of the closed volume surfaces (in the order of the list), and if it is, we should assign the cell a cell zone id (the refinement surface region name or cell zone if explicitly named) that corresponds to the closed volume surfaces from the geometry list (declaration list order to resolve ambiguity); it should be considered inside by default or from the zoneInside flag. It should not be deleted.
Steps to reproduce
Example case
What is the current bug behaviour?
Currently it crashes without locations and pointinside all being set - which still seems easy to get incorrect output - none of these should be necessary to generate a mesh - and indeed writing debug meshes can show good intermediate results. Frequently the background mesh ends up in the final output.
What is the expected correct behavior?
Snappy should succeed and have the outer.stl surface with the inner.stl surface inside that, marked as separate regions. User should not have to use locationsInMesh and at most a locationOutsideMesh. Background mesh shouldn't be output.
Relevant logs and/or images
Found 2 closed, named surfaces. Assigning cells in/outside these surfaces to the corresponding cellZone.
Walking from known cellZones; crossing a faceZone face changes cellZone
Created baffles in = 0 s
After introducing baffles : cells:0 faces:0 points:0
--> FOAM FATAL ERROR: (openfoam-2306)
No points or no cells in mesh
bad size -2147483647
From Foam::List<T>::List(Foam::label, Foam::zero) [with T = int; Foam::label = int]
in file /home/abuild/rpmbuild/BUILD/OpenFOAM-v2306/src/OpenFOAM/lnInclude/List.C at line 157.
FOAM aborting
[stack trace]
=============
#1 Foam::error::simpleExit(int, bool) in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#2 Foam::error::exiting(int, bool) in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#3 Foam::List<int>::List(int, Foam::zero) in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/bin/snappyHexMesh
#4 Foam::meshRefinement::printMeshInfo(bool, Foam::string const&) const in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/lib/libsnappyHexMesh.so
#5 Foam::meshRefinement::baffleAndSplitMesh(bool, Foam::snapParameters const&, bool, bool, Foam::Field<double> const&, int, Foam::dictionary const&, Foam::Time&, Foam::List<int> const&, Foam::List<int> const&, Foam::Field<Foam::Vector<double> > const&, Foam::List<Foam::word> const&, Foam::Field<Foam::Vector<double> > const&, bool, Foam::refPtr<Foam::coordSetWriter> const&) in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/lib/libsnappyHexMesh.so
#6 Foam::snappyRefineDriver::baffleAndSplitMesh(Foam::refinementParameters const&, Foam::snapParameters const&, bool, Foam::dictionary const&) in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/lib/libsnappyHexMesh.so
#7 Foam::snappyRefineDriver::doRefine(Foam::dictionary const&, Foam::refinementParameters const&, Foam::snapParameters const&, bool, Foam::meshRefinement::FaceMergeType, Foam::dictionary const&) in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/lib/libsnappyHexMesh.so
#8 ? in /usr/lib/openfoam/openfoam2306/platforms/linux64GccDPInt32Opt/bin/snappyHexMesh
Environment information
- OpenFOAM version :v2306 (using science repos packages)
- Operating system : openSUSE 5.5
- Hardware info : amd
- Compiler :gcc
Possible fixes
Seems like the issue occures either on this line or potentially just a little later