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/)
-   -   [snappyHexMesh] jagged, ragged edges... (https://www.cfd-online.com/Forums/openfoam-meshing/72595-jagged-ragged-edges.html)

niklas July 13, 2010 10:10

you only have to move the 3/polyMesh/points to the constant/polyMesh directory.

johannes July 14, 2010 07:06

@ Stephane:

Thanks for your input! It works indeed, so the fpe problem is solved.

@ Niklas:

After disabling smoothing, snapEdge runs fine but I'm still not getting nice edges over the patch.

At the moment I'm testing with different tolerances of 0.2 to 0.8. I also reduced relaxation to 0.9 but the effect was hardly visible.

I'll try to recreate the stl geometry I used for this test to reduce filesize so that I can send it to you or upload it somewhere to provide you with a 'challenging' testcase. :)

Quote:

Originally Posted by niklas (Post 266822)
Finally...As I say on the wiki, sometimes it works and sometimes not, but I've always been able to improve the feature representation and its just a little tool I wrote for me without the intention of releasing it, but as I discovered that I wasnt alone with this problem I thought I'd share it with the rest of you hoping that you'd find some use for it.
So bare that in mind that its very much a work-in-progress.

Yeah, that's very ok for me. Since the featureEdge component of sHM still seems to be in an very early state, it's great to have such a tool at all, especially with the option for improving whole patches and not only patch edges. So thanks again for sharing and your support!

Best regards,
Johannes

niklas July 14, 2010 09:02

I'm playing with your case and there are faces that are more on the gas inlets than on the walls, but they still belong to the walls, so this will never work.
I've increased the cell resolution at the inlets and that improves the starting mesh alot
and makes life alot easier for snapEdge, but for some weird reason, that I
havent figured out yet, it just ignores some of the edges.

niklas July 15, 2010 11:59

2 Attachment(s)
Can you download the latest version from the wiki and try these settings.
If you want it better around the capillaries/walls intersection you have to refine it more.

juho July 26, 2010 07:55

Quote:

Originally Posted by niklas (Post 267480)
Can you download the latest version from the wiki and try these settings.
If you want it better around the capillaries/walls intersection you have to refine it more.

Thank you and sorry it took me a while to respond, I've been on vacation and out of town. The new version of snapEdge seems to work fine, but only if I use the capillaries.stl to define the edge. If I use the gasInlets.stl the checkMesh fails. Is there a logic behind this behaviour?

I still have a couple of troublesome cells in the two-phase simulation, but those are snappyHexMesh issues and not related to snapEdge.

niklas July 28, 2010 07:35

Quote:

Originally Posted by juho (Post 268885)
Is there a logic behind this behaviour?

nope, there shouldnt be any difference.

g.redondo July 29, 2010 04:49

Great job Niklas,

I was wondering how do you handle layers of prisms. My guess is that it would be better first to run SHM without prisms, then snapEdge and last SHM for prisms (don't know if possible). Otherwise snapEdge would deform the first layer. Anyway, what's your opinion or best practice about this?

Regards,

Gonzalo

openfoam_user July 29, 2010 05:05

Hi Gonzalo,

yes, you are right.

First use sHM without prism layers, then snapEdge and finally sHM with only layers.

I will soon put pictures about it with the ahmed body. Work in progress ...

Regards,

Stephane.

g.redondo July 29, 2010 05:11

Great, waiting for it!

Regards,

Gonzalo

openfoam_user July 29, 2010 07:40

Hi Niklas,

this morning I have updated the GIT version of OpenFOAM-1.7.x.

And I have the following error message when using snapEdge:

----------------------------------

[110]cfs10-sanchi /shared/sanchi/OpenFOAM/sanchi-1.7.x/ahmed12.5deg25072010 % snapEdge
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.x |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 1.7.x-40d9ee1a008d
Exec : snapEdge
Date : Jul 29 2010
Time : 13:34:44
Host : cfs10
PID : 8370
Case : /shared/sanchi/OpenFOAM/sanchi-1.7.x/ahmed12.5deg25072010
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 2



--> FOAM FATAL IO ERROR:
keyword stlFileName is undefined in dictionary "/shared/sanchi/OpenFOAM/sanchi-1.7.x/ahmed12.5deg25072010/constant/snapEdgeDict"

file: /shared/sanchi/OpenFOAM/sanchi-1.7.x/ahmed12.5deg25072010/constant/snapEdgeDict from line 18 to line 62.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 395.

FOAM exiting

-----------------------

Regards,

Stephane.

openfoam_user July 29, 2010 13:22

Sorry Niklas,

it was just a problem of my OpenFOAM-1.7.x version.

Now your tool works again.

Stephane.

openfoam_user July 30, 2010 10:00

3 Attachment(s)
Attached are some pictures (front view) about the mesh generation process with snappyHexMesh and the snapEdge tool developed by Niklas Nordin.

The geometry is the Ahmed body.

First step : cell splitting at feature edges and surfaces (sHM)
Second step : snapping to features on STL surfaces (snapEdge)
Third step : add layers (sHM)

I have add 10 layers of cells with snappyHexMesh (addLayers).
The final mesh has 6.8 M cells.
At the end the checkMesh utility gives MESH OK.

Best Regards,

Stephane.

openfoam_user July 30, 2010 10:01

3 Attachment(s)
More pictures (rear view).

Stephane.

g.redondo July 30, 2010 11:34

Nice!

It would be really nice if you can explain the process show your Dict files for each step. This could be added to the wiki.

Regards,

Gonzalo

phsieh2005 August 15, 2010 19:57

example case?
 
Hi,

The snapEdge utility looks like a very useful tool. I tried a simple geometry. All patches were set to Walls just to test. I used the same stl for both snappyHexMesh and snapEdge. But, there basically are no differences before and after snapEdge. I probably did something wrong. Can someone post a simple example case or provide some more detailed explanation? Thanks!

Pei

niklas August 16, 2010 02:54

if you only have 1 patch (walls) you probably didnt use

includeInterior yes;

with only 1 patch you do not have any feature edges that defines the boundary of the patch, since
the patch must be a closed surface.

openfoam_user August 16, 2010 03:02

1 Attachment(s)
Hi,

I have attached a cube.tar.gz file. Do the following commands:

tar xvzf cube.tar.gz
cd cube
blockMesh
snappyHexMesh
ln -s constant/triSurface/cube.stl
snapEdge
paraFoam

and compare times 1, 2 and 3 for CUBE
and you will see that the edges are at the end (time 3) correct !

Have a look at the files:

/cube/system/snappyHexMesh
/cube/constant/snapEdge

Hope it will help you.

PS : I use OpenFOAM-1.7.x (last available git version)

Best regards,
Stephane.

phsieh2005 August 16, 2010 08:55

Thanks niklas and openfoam_user!

The new cube.tar.gz example worked great!

I am wondering about few things:

1. what is the general rule for specifying the tolerance value?
2. if I have 6 faces, but only 3 patches. For example, inlet, outlet, and walls. How to prepare the stl for it? Should I have 3 stl files, ie., inlet.stl, outlet.stl, and walls.stl? Or, 1 stl, but, with inlet/outlet/walls specified inside the stl?
3. can I perform snapEdge several times? That is, do inlet first, then, outlet, then walls. Each with a different snapEdgeDict? The cell size for each feature might be different.

Pei

niklas August 16, 2010 09:23

Quote:

Originally Posted by phsieh2005 (Post 271635)
1. what is the general rule for specifying the tolerance value?

if you have includeInterior no, then you should set something 'large'..i use 10.0.
If you have includeInterior yes, then it will definitely not work with a value larger than 1.0.
The program just checks for proximity of lines. so if you have a (square) face covering a feature it can
attract both lines on opposite sides of the feature line, thus making the face of zero size.

Quote:

Originally Posted by phsieh2005 (Post 271635)
2. if I have 6 faces, but only 3 patches. For example, inlet, outlet, and walls. How to prepare the stl for it? Should I have 3 stl files, ie., inlet.stl, outlet.stl, and walls.stl? Or, 1 stl, but, with inlet/outlet/walls specified inside the stl?

it doesnt matter, the 2 methods are equivalent.

Quote:

Originally Posted by phsieh2005 (Post 271635)
3. can I perform snapEdge several times? That is, do inlet first, then, outlet, then walls. Each with a different snapEdgeDict? The cell size for each feature might be different.

yup, just make sure to set startFrom latestTime in system/controlDict.
usually I just set
snapPatches ( inlet outlet);
and ignore the features on the walls.
using includeInterior no is faaar more robust than setting it to yes.

johannes August 18, 2010 13:00

1 Attachment(s)
Hi Niklas,

I'm still trying to get an improved mesh using snapEdge's includeInterior feature. At first sight the resulting mesh looks quite well but there are still some skips and the checkMesh result always shows at least two missed tests.

If you have some time left it would be great if you could have a look at my case (see attached .tar.gz file with my actual settings and files) and maybe you're able to locate a potential for improvement (e.g. snapEdge or sHM parameters, stl file precision, etc...).

I know that you're still working on snapEdge, so I don't expect a 'perfect' mesh, a checkMesh result without errors would be absolutely ok.

Many thanks in advance!

Best regards,
Johannes


All times are GMT -4. The time now is 13:42.