CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[cfMesh] cfMesh in combination with blockMesh?

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

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2015, 14:35
Default cfMesh in combination with blockMesh?
  #1
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi FOAMers,

I have a question regarding cfMesh.

I have a .stl geometry of a wing which I want to simulate. I have the issue that I cannot cut it out of a box in CAD as it is a complex surface .stl file (or at least I am not clever enough to do it).
Is there a way to get a box around it in OpenFOAM and then mesh it with cfMesh?

I know it would be possible using blockMesh in combination with snappyHexMesh. However, I want to use cfMesh as it gives me better results.

Thank you very much in advance for your help!
pizzaspinate is offline   Reply With Quote

Old   March 27, 2015, 07:52
Default
  #2
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

You can use surfaceGenerateBoundingBox that comes with cfMesh for that purpose. The syntax is the following:
surfaceGenerateBoundingBox.exe <input surface file> <output surface file> <x-neg> <x-pos> <y-neg> <y-pos> <z-neg> <z-pos>
The last six values represent the offset of the box from the surface bounds in all directions.
I hope this helps.
SH_Zhong, al.csc and Jun_93 like this.
franjo_j is offline   Reply With Quote

Old   March 27, 2015, 09:43
Default
  #3
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi Franjo,
thank you very much for your help! May I ask you another question?
When I want to run cfmesh in parallel is the procedure the same as for snappyHexMesh?

For example:
1. decomposePar
2. mpirun -np 4 cartesianMesh -overwrite -parallel?

Thank you very much in advance for your help.
pizzaspinate is offline   Reply With Quote

Old   March 27, 2015, 16:50
Default cfMesh - running MPI
  #4
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
The procedure is very similar, and it consists of the following steps:
1. Prepare meshDict and decomposeParDict. You just need the numberOfSubdomains in decomposeParDict.
2. Run preparePar - this utility generates processor* directories.
3. Run the mesher - mpirun -np <num procs> cartesianMesh -parallel

Please note that currently only cartesianMesh can be run using MPI.

By default, cfMesh uses all available cores of your computer, so you do not need to run MPI jobs to gain speed. MPI is useful when you want to generate large meshes that do not fit into the memory of a single computer.
franjo_j is offline   Reply With Quote

Old   March 31, 2015, 05:10
Default
  #5
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Thank you Franjo for your help.
May I ask you another question, please?
I played a bit with cfMesh to get a mesh around a blended wing body. Unfortunately I get a lot of warnings saying that zero or negative tetrahedra were detected. This results in a really poor mesh around the leading and trailing edge (see attached pictures). Do you know by any chance how to avoid these cells?
I also get a warning saying that the surface is not a manifold. However when I check it in for example MeshLab or Slic3r I get told that the geometry is watertight. Is there a way to fix my stl in opnefoam so that i dont get the warning? And do you think the poor mesh results from the not manifold warning?
Thank you very much for all the help!!!!!
Attached Images
File Type: jpg Mesh_1.jpg (80.0 KB, 441 views)
File Type: jpg Mesh_2.jpg (81.0 KB, 334 views)
pizzaspinate is offline   Reply With Quote

Old   April 1, 2015, 04:52
Default
  #6
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

How many boundary layers are there in the mesh? Can you please generate a mesh with a single layer, and check if it still happens? I have noticed this kind of behavior on cases with more than 5 layers, when the smoother struggles to get rid of twisted faces in the layer. We have worked on that problem, and we plan to release improvements with the next release. Are you interested to test them?
The warning "Surface is not a manifold" just inform the user that some edges in the surface mesh are not connected to two triangles. It is a warning, and in most cases it does not affect the quality of the resulting mesh unless you have: large gaps, huge cracks, holes, baffles, multi-material surface, etc. that are comparable in size to the requested cell size. Please do not worry to much about this warning.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   April 2, 2015, 05:52
Default
  #7
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi,
there were 15 layers in my mesh. I have played around a bit with one layer as you suggested and the results look good so far. Thank you for that!!! :-)

I have just increased the number of layers to 2...but unfortunately this results again in negative tetrahedra, wrong pointing faces and severe warpage.

I would love to test the improved version!!!! Where can I get it from/ when is the next release coming out?
pizzaspinate is offline   Reply With Quote

Old   April 2, 2015, 15:28
Default
  #8
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

It is in the development branch from the cfMesh's git repository at SourceForge. This branch contains latest developments. Please add optimiseLayer 1; in the boundaryLayers dictionary to activate the new functionality. The example is provided in ship5415Octree.
I hope it can solve solve your current problems.
Regarding the release, we are in the stabilisation phase, and will roll it out when we confirm that it is stable and robust. I would love to hear your feedback, too.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   April 3, 2015, 15:39
Default
  #9
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi,
thank you very much. How exactly do I implement the optimiseLayer 1 in cfMesh. I am not an advanced user but have just started recently using OpenFOAM.
Do I have to download the file from http://sourceforge.net/p/cfmesh/code...elopment/tree/ ?
Do I copy paste this file then into the specific folder in cfMesh?
pizzaspinate is offline   Reply With Quote

Old   April 9, 2015, 07:40
Default
  #10
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

Please try the following procedure:
1. Go the SourceForge site of cfMesh, and click the Code button.
2. Select the development branch under the branches menu.
3. Press the Download snapshot button. This will download an archive with the code.
4. Unpack the archive, and compile the code in a Linux shell with a working OpenFOAM environment. Compilation is started by typing ./Allwmake in the root directory of cfMesh code. You may need to delete libmeshLibrary.so from your FOAM_LIBBIN if it already exists there.

Feel free to contact me if you nee more assistance.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   April 10, 2015, 08:13
Default
  #11
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi,
thanks I tried to run the Allwmake in the folder where I unzipped the file. But I get the following error. What did I do wrong?
Attached Files
File Type: gz make.txt.tar.gz (8.3 KB, 13 views)
pizzaspinate is offline   Reply With Quote

Old   April 10, 2015, 17:34
Default
  #12
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

What is the output of 'which cartesianMesh'? Does it point to the one from localuser or in /opt/openfoam231? It shall point to the one in localuser.
The second bit we need to figure out whether libmeshLibrary.so is used from the right location. What do you get when you type ldd cartesianMesh? What does it tell you for libmeshLibrary.so? It shall use the one in $FOAM_USER_LIBBIN, and this is the one in /home/localuser and it should not be the one in /opt/openfoam231.
The problem can be resolved by removing old installation of cfMesh.
I hope this helps.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   April 12, 2015, 03:03
Default
  #13
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi,

the command "which cartesianMesh" points to localuser so it is fine.
However, ldd cartesianMesh gives the output "ldd: ./cartesianMesh: No such file or diretory".
I let IT services at my uni have look at it tomorrow, too. Maybe they can help as well
pizzaspinate is offline   Reply With Quote

Old   April 15, 2015, 10:30
Default
  #14
Member
 
Join Date: Dec 2012
Posts: 81
Rep Power: 10
pizzaspinate is on a distinguished road
Hi,
reinstalling cfMesh solved the problem
However, my mesh still doesnt look good (but it improved a bit).....Do you mind having a look at my meshDict file? Just to make sure that I did not make any mistakes or forgot a setting?
I will also try to run it again tomorrow with a more powerful computer to see if a smaller minCellSize and local refinement yields to any improvement.
Attached Images
File Type: jpg mesh_new1.jpg (88.2 KB, 278 views)
File Type: jpg mesh_new2.jpg (97.9 KB, 206 views)
File Type: jpg mesh_new3.jpg (97.9 KB, 200 views)
Attached Files
File Type: txt meshDict.txt (1.6 KB, 39 views)
pizzaspinate is offline   Reply With Quote

Old   April 16, 2015, 08:09
Default
  #15
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

You have not activated the smoother. You can do it by adding the following settings n boundaryLayers dictionary:

boundaryLayers
{
optimiseLayer 1; // activates layer optimisation

// optional parameters
optimisationParameters
{
// number of iterations in the procedure for reducing normal-variation
nSmoothNormals 5;

// max number of total iterations
maxNumIterations 5;

// feature size factor. Reasonable range <0.2, 0.5>
// lower values force thinner layers
featureSizeFactor 0.4;

// shall the normal vectors be recalculated
reCalculateNormals 1;

// relative thickess variation between two hair nSmoothNormals
// lower value produce thinner and more uniform layers
relThicknessTol 0.1;
}
}

I hope this solves your problems.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   June 16, 2015, 06:50
Default
  #16
New Member
 
Join Date: Jan 2015
Posts: 9
Rep Power: 8
gajjar is on a distinguished road
Hi,

I have just started working on cfmesh. But i am getting too many lowQualityTetFaces error. I am posting the errors i am getting using checkMesh -allGeometry -allTopology.

Checking geometry...
Overall domain bounding box (-5.23459e-06 4.45995e-05 1.46569e-05) (0.017315 0.0186138 0.018359)
Mesh (non-empty, non-wedge) directions (1 1 1)
Mesh (non-empty) directions (1 1 1)
Boundary openness (1.19776e-15 -1.37137e-15 6.05617e-15) OK.
Max cell openness = 4.6652e-16 OK.
Max aspect ratio = 19.5614 OK.
Minimum face area = 9.4506e-12. Maximum face area = 1.51195e-08. Face area magnitudes OK.
Min volume = 1.31154e-16. Max volume = 5.20293e-13. Total volume = 3.39696e-07. Cell volumes OK.
Mesh non-orthogonality Max: 81.9261 average: 6.40555
*Number of severely non-orthogonal (> 70 degrees) faces: 58.
Non-orthogonality check OK.
<<Writing 58 non-orthogonal faces to set nonOrthoFaces
Face pyramids OK.
***Max skewness = 4.27901, 17 highly skew faces detected which may impair the quality of the results
<<Writing 17 skew faces to set skewFaces
Coupled point location match (average 0) OK.
***Error in face tets: 8628 faces with low quality or negative volume decomposition tets.
<<Writing 8628 faces with low quality or negative volume decomposition tets to set lowQualityTetFaces
Min/max edge length = 1.36234e-06 0.00019765 OK.
*There are 2 faces with concave angles between consecutive edges. Max concave angle = 88.1413 degrees.
<<Writing 2 faces with concave angles to set concaveFaces
Face flatness (1 = flat, 0 = butterfly) : min = 0.802317 average = 0.999754
All face flatness OK.
Cell determinant (wellposedness) : minimum: 0.00421605 average: 3.87224
Cell determinant check OK.
***Concave cells (using face planes) found, number of cells: 6
<<Writing 6 concave cells to set concaveCells
Face interpolation weight : minimum: 0.0317005 average: 0.475552
***Faces with small interpolation weight (< 0.05) found, number of faces: 9
<<Writing 9 faces with low interpolation weights to set lowWeightFaces
Face volume ratio : minimum: 0.00856542 average: 0.911692
***Faces with small volume ratio (< 0.01) found, number of faces: 1
<<Writing 1 faces with low volume ratio cells to set lowVolRatioFaces

Failed 5 mesh checks.

End


I am using following settings in meshDict.


surfaceFile "test.stl";

maxCellSize 0.00007;

/*boundaryCellSize 0.025;*/


boundaryLayers
{
nLayers 5;
thicknessRatio 1.0;

}


I have also attached the pictures where i am getting these bad faces. Can anyone help me to get rid of these errors.lowqualitytetfaces_surface.jpg

lowqualitytetfaces.jpg
gajjar is offline   Reply With Quote

Old   June 16, 2015, 07:17
Default
  #17
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 14
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

Can you please refine the mesh in the regions where these bad cells are. It is difficult to obey geometry constraints and obtain high quality with coarse meshes like this one. The cells are larger than the feature size, and that is not desired. You can refine the mesh locally via: localRefinement, surfaceMeshRefinement, or edgeMeshRefinement.

Regards,

Franjo
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   December 5, 2016, 10:27
Default Merge the resulting mesh
  #18
New Member
 
Join Date: Dec 2011
Location: Spain
Posts: 25
Rep Power: 11
grayback87 is on a distinguished road
Quote:
Originally Posted by franjo_j View Post
The procedure is very similar, and it consists of the following steps:
1. Prepare meshDict and decomposeParDict. You just need the numberOfSubdomains in decomposeParDict.
2. Run preparePar - this utility generates processor* directories.
3. Run the mesher - mpirun -np <num procs> cartesianMesh -parallel

Please note that currently only cartesianMesh can be run using MPI.

By default, cfMesh uses all available cores of your computer, so you do not need to run MPI jobs to gain speed. MPI is useful when you want to generate large meshes that do not fit into the memory of a single computer.
Dear Franjo,
I found very useful your cfMesh tool that you developed.

However when I need to mesh a big model I need to do it in serial because I don't find a way to merge the mesh created by the process you stated above (this can take several hours).
The process is the following:

1st - preparePar
2nd - mpiexec -np 4 cartesian -parallel
3rd - Here is where I find the problem. It does not matter whether I use reconstructPar, reconstructParMesh or any other, as I cannot merge the meshed and update the ~/constant folder with the polymesh folder.
Can you please help me with this step? I reckon I am not the only one facing this problem.

Thanks!
grayback87 is offline   Reply With Quote

Old   April 13, 2017, 10:47
Default
  #19
New Member
 
Robert Peters
Join Date: Oct 2012
Posts: 3
Rep Power: 11
rgpeters is on a distinguished road
I am having the same issue with Reconstructing the mesh. I am using 1.0.

Edit: using ReconstructParMesh -fullMatch -constant fixed this for me.
rgpeters is offline   Reply With Quote

Old   September 15, 2017, 08:11
Default
  #20
Member
 
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 65
Rep Power: 7
ashishmagar600 is on a distinguished road
Hello everyone.

@franjo_j, very thankful to you for all the guidance above.

However I had one question. Is there any method to specify a refinementBox (as we could do in sHM), so that the cell size inside the refBox is smaller than the overall cell size? Otherwise I would have to have fine cell size all over the domain

Thanks for all your help.


@graybak87, what is your problem exactly? upload a log file what errors you are having.
Try to use solution given by rgpeters.
ashishmagar600 is offline   Reply With Quote

Reply

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 questions badoumba OpenFOAM Community Contributions 3 March 17, 2017 03:46
[cfMesh] using cfMesh with interFoam ends in a Floating point exception STEFGER OpenFOAM Community Contributions 3 October 17, 2016 02:33
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 14:53
[blockMesh] set of xyz data in blockMesh psk OpenFOAM Meshing & Mesh Conversion 12 August 27, 2013 08:37
Blockmesh cavity error message tonitoney OpenFOAM Installation 2 March 17, 2008 11:59


All times are GMT -4. The time now is 11:14.