CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] Is there a quick way to merge all internal faces (defaultFaces) for multiple blocks? (https://www.cfd-online.com/Forums/openfoam-meshing/229494-there-quick-way-merge-all-internal-faces-defaultfaces-multiple-blocks.html)

Ship Designer August 11, 2020 10:50

Is there a quick way to merge all internal faces (defaultFaces) for multiple blocks?
 
2 Attachment(s)
Hello all,

I'm attempting to create a hexahedral domain with multiple blocks in order to obtain better control over cell density where it is really needed, see attached pictures. The blocks are defined in blockMesh and the boundary patches are created later on with createPatch, which works quite well and produces an error free mesh according to checkMesh. The tricky part is merging the internal boundaries between the blocks. Most of the patches have the same congruent area, but the faces don't match and need to be connected.

The methods I've tried so far have all one big disadvantage in common, that is that for each internal block, up to six patches need to be defined in blockMeshDict and then be merged one by one with the respective neighbour. For a domain with say 30 blocks, that's about a 150 internal patches or so without the external boundaries. It becomes clear that this becomes quickly unmanageable and time consuming.

If there would be a way to say "merge all internal faces that touch eachother", without having to define them one by one, that would simplify things a lot. At least createPatch removes all patches with no faces and so only the external boundaries remain, which is very good. Any ideas?

I first tried with mergePatchPairs () but it has limitations. It doesn't work in situations where a patch becomes both a master and a slave, even for subsequent patch pairs. It appears that it tries to merge all listed patches at once.

A workaround that works much better is by using stitchMesh -noFields -overwrite for every patch pair to merge with a shell script. At every call the mesh gets overwritten and so the mesh gets only one master and slave at a time. However, sometimes it still gives fatal errors with faces with less than 3 points or similar but I still have to investigate why that is, as this varies depending on block cell subdivision.

I've also tried attachMesh but it does nothing. It gives no errors but the initial regions created by blockMesh remain separate.

I'm grateful for any suggestions, thanks!


All times are GMT -4. The time now is 23:38.