CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[cfMesh] cfMesh workflow with complex geometries

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2019, 08:45
Default cfMesh workflow with complex geometries
New Member
Join Date: Apr 2019
Posts: 2
Rep Power: 0
SzpetnyJohan is on a distinguished road

I'd like to start my first post on this forum with a big thanks for the great tool cfMesh is.
It is very convenient to use, but there is one thing that keeps it from being perfect.

I have the following problem with cfMesh.
The 3d geometry I start with is an .stl file containing an object bounded in a box. To create patches I use createFeatureEdges and create an .ftr file. As my object has many sharp corners it is being divided into thousands of tiny patches. It is a pain to work with so many patches so I have to merge them.
One option I used is a createPatch command. It allows to merge the patches and preserve all sharp corners. (copy-pasting thousands of patch names to createPatchDict is really irritating). Unfortunately I am not able to create a boundary layer afterwards as generateBoundaryLayers refers to patch names in my .ftr file and not those created with createPatch.
As it is not acceptable to ignore the boundary layer in my case, I tried a different workflow.
The other option is to use mergeSurfacePatches on my .ftr file. This way I can merge those tiny patches and name them before creating a mesh. It allows to create a boundary layer by referring to a new patch name, but a different problem appears. When the patches are merged the sharp edges are not being preserved.

To sum it up the two workflows I know either do not allow me to create a boundary layer or do not preserve sharp corners.

I believe there must be a simple way to create a mesh with a boundary layer AND sharp edges, so could you please share with me the workflow you use when working with cfmesh?
SzpetnyJohan is offline   Reply With Quote

Old   May 22, 2019, 08:51
Senior Member
Kmeti Rao
Join Date: May 2019
Posts: 145
Rep Power: 8
Krao is on a distinguished road
Hi Patryk,

The problem you have defined is not clear, I use cfMesh and have never come across this problem. If you share more information about your 'complex' geometry. I can give some inputs.

Krao is offline   Reply With Quote

Old   May 24, 2019, 06:52
New Member
Join Date: Apr 2019
Posts: 2
Rep Power: 0
SzpetnyJohan is on a distinguished road

Thank you for the response. I managed to partially "resolve" my problem. I would delete this thread if I knew how to do this. I am sorry.

This problem appears because cfMesh does not preserve sharp corners in the geometry after you merge the patches. It seems that the only option to preserve the geometry is to divide it into many tiny patches. After using surfaceFeatureEdges sometimes there are as many as 5000 patches defining the object. When you start with a single stl containing both the object and the bounding box you are not able to find which patches refer to the box and which refer to the object. You have to do this by first generating a rough mesh and after that checking in paraFoam by trial and error which patch refers to which surface. With thousands of patches it takes a lot of time.

I had the problem described earlier because I merged patches before creating the mesh and I couldn't understand why cfMesh didn't preserve sharp corners of the geometry.
SzpetnyJohan is offline   Reply With Quote

Old   August 14, 2019, 09:23
New Member
Join Date: Nov 2017
Posts: 11
Rep Power: 8
nope is on a distinguished road

I'm not sure if you already though of that, anyway this is the way i handle this:

For each distinctive part i want to use for boundary conditions, i create stl files and name them properly (also within the file, not only filename).

Merge the stl files so there are multiple solids with their proper name within one stl file.

Do the surfaceFeatureEdges. Each "subpatch" created by surfaceFeatureEdges starts with the name you gave to the solid in the stl and a increasing number.

Within the meshDict, you can now use regular expressions to reference to multiple "subpatches" created by surfaceFeatureEdges. This makes life much easier. Attention here, OF v1806 has a bug that prevents regular expressions to work properly with cfMesh. Use OF v1812 and you will be fine.

Let me know if this is useful or something is not clear.

Cheers, nope
nope is offline   Reply With Quote


boundary layer, cfmesh, edge detection, featureedges

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[cfMesh] cfMesh 2D workflow layer optimization ewlks OpenFOAM Community Contributions 2 October 14, 2022 11:31
Tips for Handling Complex Geometries, Very Large Grids tcarrigan Pointwise & Gridgen 5 August 6, 2014 14:44
Meshing complex white-light/GOM based STL models jola Main CFD Forum 13 January 30, 2012 01:35
mesh generator for very complex geometries? cchou2007 Main CFD Forum 3 December 8, 2007 08:37
[Other] Mesh generator for very complex geometries hsieh OpenFOAM Meshing & Mesh Conversion 3 November 21, 2007 14:51

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