CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] Several .stl for better snappy mesh quality?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2019, 16:24
Question Several .stl for better snappy mesh quality?
  #1
New Member
 
anna
Join Date: Mar 2019
Posts: 5
Rep Power: 7
hasini is on a distinguished road
Hi forum!

I'm working on my first OpenFoam case and have a more general question for the meshing with snappyHexMesh:

In which ways can I increase the quality of my mesh by separating my geometry into an increasing number of .stl files?

Take for example the case of a car: If I made an .stl file of the chassis and an .stl of the windows - with this I could only change the level of refinement on each surface, right? Or would this also help for example to detect the edges between windows and chassis (by also generating .emesh files out of both .stl)? And therefore increase the quality of my mesh at the borders of these separate .stl files?

Maybe I haven't really understood how the edge refinement with the .emesh files work and that's why I'm asking - maybe anyone of you could explain that thoroughly?

Thanks!!!
hasini is offline   Reply With Quote

Old   April 12, 2019, 19:29
Default
  #2
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 10
aow is on a distinguished road
As you pointed out, you can certainly specify different levels of refinement for individual .stl objects, which will control the cell sizing; however in my experience with trying it out, splitting up a larger .stl file into sub-components will not have much if any effect on the sharpness of the edges.

From my own experience, the best way to control the sharpness is whether or not you choose to use the features section within the castellatedMeshControls section of snappyHexMeshDict. See below for an example.
Code:
features
(
    {
        file "mySTLObject.eMesh";
        level 2; // 0 = blockMesh cell size, >0 gives refinement
    }
);
However, prior to running snappyHexMesh, you need to make sure that you've used the surfaceFeatureExtract utility on your .stl objects first, which requires having surfaceFeatureExtractDict in your system directory.

Additionally, make sure you include the required parameters in the snapControls section too. See below for an example.
Code:
snapControls
{
    // basic controls
    nSmoothPatch 5;
    tolerance 2.0;
    nSolveIter 30;
    nRelaxIter 5;
    // feature-related controls
    nFeatureSnapIter 10;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}
I've not tried using the implicitFeatureSnap option for a long time so I cannot speak as to how well it works versus the explicitFeatureSnap option off the top of my head, but the explicit one has worked well for me regardless of how curved, sharply-angled, etc... my .stl objects have been that I tried to mesh in recent times.
aow is offline   Reply With Quote

Old   April 13, 2019, 08:45
Default
  #3
New Member
 
anna
Join Date: Mar 2019
Posts: 5
Rep Power: 7
hasini is on a distinguished road
Thanks a lot for your reply! I so far also came to the conclusion that it only makes sense to split a geometry if you want different refinement levels or if it is a special part (like boundaries or a rotating wheel).


Implementation of the .eMesh worked very well! I will try out later on the implicit feature on the same mesh and post the results here.
hasini is offline   Reply With Quote

Old   April 13, 2019, 17:28
Default
  #4
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 10
aow is on a distinguished road
Awesome! I'm glad it worked out well for you.

The other reason why you might want to split up a larger .stl into smaller pieces is to make it easier to measure forces, pressures, etc... over a specific piece of the whole object. To do this, you can make function objects in your controlDict or as separate scripts that get included in your controlDict (see the entire list of options for creating function objects at https://www.openfoam.com/documentati...n-objects.html). For example, this is a possible way to record force on a patch associated with an .stl file.
Code:
functions
{
    mySTLcomponentForce
    {
        type forces;
        libs ("libforces.so");
        writeControl timeStep;
        timeInterval 1;
        log yes;
        patches (mySTLcomponent);
        rho rhoInf;
        rhoInf 1;
        CofR (0 0 0);
        pitchAxis (0 1 0);
    }
}
aow is offline   Reply With Quote

Old   April 16, 2019, 03:49
Default
  #5
New Member
 
anna
Join Date: Mar 2019
Posts: 5
Rep Power: 7
hasini is on a distinguished road
Yes, that's true! Haven't thought up to the post-processing so far. Thanks for the input

Anyway, I tried the implicit feature and compared it to the explicit (with the .emesh) and the results were very disappointing. I really recommand to use the explicit with a propper .emesh file for the edges.

I also found this website, where you can see visual comparisons of the implicit, explicit and multiRegionFeatureSnap version: https://www.cfdsupport.com/OpenFOAM-...t/node127.html

I haven't tried the 3rd possiblity yet (multiRegionFeatureSnap) - but on that website it looks pretty similar to the explicit one.
hasini is offline   Reply With Quote

Old   April 16, 2019, 14:08
Default
  #6
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 10
aow is on a distinguished road
Sure thing, glad to be of help.

I had similar experiences with the implicit feature snapping in the past and gave up on trying it out eventually since the explicit feature snapping worked so well.

Concerning the multi-region snapping, I don't think using multiple .stl files causes OpenFOAM to generate multiple regions when you use snappyHexMesh. You have to very intentionally create two separate mesh regions using OpenFoam mesh manipulation/generation utilities. For example, this tutorial demonstrates a solver, chtMultiRegionFoam, that was designed to solve conjugate heat transfer problems with two regions meant to represent solid and fluid bodies.
aow is offline   Reply With Quote

Reply

Tags
.emesh, .stl, edge, quality, snappyhexmesh


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
Gambit problems Althea FLUENT 22 January 4, 2017 03:19
[ICEM] Heart modeling - ICEM Hexa Mesh quality improvement heart_modeller ANSYS Meshing & Geometry 1 April 8, 2016 08:16
[ICEM] Bad Quality **Anny** ANSYS Meshing & Geometry 7 May 28, 2015 05:03
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55
Icemcfd 11: Loss of mesh from surface mesh option? Joe CFX 2 March 26, 2007 18:10


All times are GMT -4. The time now is 04:52.