Meshing the smallest domain in a multi-domain geometry
Functionality to add/problem to solve
Currently it is not possible to mesh the smallest domain in a multi-domain geometry. Cfmesh allways meshes the domain with the largest number of cells. In some cases this is unwanted such as a mesh for the flow between two concentric cylinders. In snappyHexMesh this is solved using the locationInMesh keyword. This is not available in Cfmesh.
Proposal
Franjo Juretic did implement a basic feature for multi-domain meshing as explained on [cfdonline]. It was pushed to github in a new branch. The commit which enables this is: https://github.com/philippose/cfMesh/commit/7230c449e9a5461a1f0e4aae91bd0117bcd98f26
I’ve implemented this commit in the module of cfMesh for openfoam v2106 and attached the two files that I’ve changed. This allows the use of the keyword: 'allowDisconnectedDomains 1' which is explained in the [cfd online] tread. Problem with this method is that the internal domains are not mapped to the geometry. At least the cellset was not mapped and the resulting mesh using subsetmesh was not snapped to the surface.
As a solution I implemented the keepDomainNumber keyword, which allows you to chose which domain you want to keep. This is not a preferred solution, but it allows you to first visualize all the domains using the allowDisconnectedDomains keyword and in a second attempt mesh the domain number you want to keep.
The best solution would be to implement the locationInMesh keyword. However that is beyond my level to implement.
Using these 2 methods one can view the whole mesh and view the different domains. Then select a single domain using the keepDomainNumber keyword.
What does success look like, and how can we measure that?
I’ve tested it using an own geometry. One can test it using two concentric cylinders with and without the allowDisconnectedDomains keyword. When enabling the function it should make 2 cell-zones. With the keepDomainNumber keyword you should be able to chose between the two domains.
Links / references
[cfd online] https://www.cfd-online.com/Forums/openfoam-community-contributions/150500-how-does-cfmesh-determine-region-mesh.html
checkCellConnectionsOverFaces.C meshOctreeAddressingCreation.C