CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

Couldn't get snappy to generate a mesh

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 20, 2012, 07:28
Question Couldn't get snappy to generate a mesh
  #1
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 8
Horus is on a distinguished road
Hello,

I try to generate a mesh for a geometry of a wind tunnel, given by STL files. It works finde with the Spider mesher and I try to adapt it to snappyHexMesh. The windTunnel file contains multiple solids.

It works when using the configuration below. snap and addLayers are set to false.
When I set snap to true, snappy still runs. But the mesh contains only the patch from bodySmooth and is reduced to one rectangular cell reflecting none of geometry.

Thanks for any help and I would be happy to provide any more information!

Florian

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

castellatedMesh true;
snap            false;
addLayers       false;

geometry
{
  BPID0030_windTunnel.stl
    {
      type triSurfaceMesh;
    }
  GOPT0960_B12_backFastback.stl
    {
      type triSurfaceMesh;
    }
  GOPT0960_A2_bodySmooth.stl
    {
      type triSurfaceMesh;
    }
  GRWS0960_O12_frontWheel.stl
    {
      type triSurfaceMesh;
    }
};

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 20000000;
    minRefinementCells 100;
    nCellsBetweenLevels 1;

    features
    (
    );

    refinementSurfaces
    {
      BPID0030_windTunnel.stl
	{
	  level (2 2);
	}
      GOPT0960_B12_backFastback.stl
       	{
       	  level (2 2);
       	}
      GOPT0960_A2_bodySmooth.stl
       	{
	  level (2 2);
	}     
    }

    resolveFeatureAngle 60;

    refinementRegions
    {
    }

    locationInMesh (3 0 0);

    allowFreeStandingZoneFaces true;
}

snapControls
{
    nSmoothPatch 3;
    tolerance 4.0;
    nSolveIter 30;
    nRelaxIter 5;
}

addLayersControls
{
    relativeSizes true;
    layers
    {
    }
    expansionRatio 1.0;
    finalLayerThickness 0.5;
    minThickness 0.25;
    nGrow 0;
    featureAngle 60;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
}

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-13;
    minTetQuality 1e-30;
    minArea -1;
    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

debug 0;
mergeTolerance 1e-6;
Horus is offline   Reply With Quote

Old   April 20, 2012, 07:49
Default
  #2
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 11
colinB is on a distinguished road
Hey Florian,

I'm not sure if it is still the case, but earlier with sHM the different
steps of meshing were stored in different time-steps.
So if you go to the next time step in paraview you should see
the snapping part you are missing

to suppress this way of mesh generation type
Code:
snappyHexMesh -overwrite
instead of simply
Code:
snappyHexMesh
regards
Colin
colinB is offline   Reply With Quote

Old   April 20, 2012, 07:54
Default
  #3
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 8
Horus is on a distinguished road
I use a little script that clears the polyMesh directory (except blockMeshDict), runs blockMesh and snappyHexMesh to ensure a clean start each run.

Of course I was locking at the final timestemp directory.
Horus is offline   Reply With Quote

Old   April 20, 2012, 08:03
Default
  #4
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 11
colinB is on a distinguished road
Hey

could you give us a screenshot of the
output what sHM delivers you?

regards
colinB is offline   Reply With Quote

Old   April 20, 2012, 08:19
Default
  #5
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 8
Horus is on a distinguished road
This is a screenshot with snapping disabled: http://xgm.de/upload/noSnap.png

and snapping enabled: http://xgm.de/upload/snap.png

The output of blockMesh and snappyHexMesh with snapping enabled can be found at http://pastebin.com/ixMhTPrx

thx!
Horus is offline   Reply With Quote

Old   April 20, 2012, 08:34
Default
  #6
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 11
colinB is on a distinguished road
Next try:

is the point

locationInMesh (3 0 0 )

in the part of the geometry you want to keep or not?
This point has to be within the area you want to have meshed
and here sHM seems to complain somehow:

Code:
  1. Keeping all cells in region 0 containing point (3 0 0)
  2. Selected for keeping : 1 cells.
  3. Edge intersection testing:
  4. Number of edges : 6
  5. Number of edges to retest : 0
  6. Number of intersected edges : 3
  7. Split mesh in = 0 s
point 7 split mesh in = 0 s is indicating that he is doing actually nothing
(0 seconds you only need for nothing).

Another question that came to my mind is how is the scaling of the blockMesh and the .stl file(s), are they of the same unit (m, cm or mm)?
colinB is offline   Reply With Quote

Old   April 20, 2012, 08:52
Default
  #7
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 8
Horus is on a distinguished road
Hello,

I'm pretty sure that (3 0 0) is in the mesh. It works fine using the same point with another mesher. I also tried a number of other points with no success.

Regarding the scaling of the files. I have loaded the generated blockMesh and the STL files into paraview. They are of similiar size and the STL solids fit in the blockMesh completely.

Why is it working without snapping if either the point or the scaling were wrong?

Thx!
Horus is offline   Reply With Quote

Old   April 20, 2012, 09:04
Default
  #8
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 8
Horus is on a distinguished road
Ok, I have removed the bodySmooth part entirely for now and it seems to work now (generating something that resembled the input geometry, by no way a perfect mesh).

I still got no idea what caused the problem, and why it happens only with snap enabled.

Thanks for your help!
Horus is offline   Reply With Quote

Old   April 20, 2012, 09:18
Default
  #9
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 11
colinB is on a distinguished road
Sry that I couldn't help you more specific.

Quote:

Why is it working without snapping if either the point or the scaling were
wrong?
good question, it was more or less a wild guess, I have to admit.


In the first place the problem looked much more trivial than it actually seems
to be.

regards
colinB is offline   Reply With Quote

Old   April 20, 2012, 13:12
Default
  #10
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 8
Horus is on a distinguished road
Thanks for your help!

One more question: Is there a variable that globally controls the fineness of the mesh? In my other mesher I have a base cell size and all levels of refinement are based on this value. So if the mesh is good and I just want some more cells I decrease that base cell size.

Is maxGlobalCells or maxLocalCells something like that?
Horus is offline   Reply With Quote

Old   April 20, 2012, 13:45
Default
  #11
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 464
Rep Power: 10
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
I think your sHMDict is missing something in the refinementSurfaces partů

I would rather use something like this:

Code:
geometry
{
  BPID0030_windTunnel.stl
    {
      type triSurfaceMesh;
      name windTunnel;
    }
  GOPT0960_B12_backFastback.stl
    {
      type triSurfaceMesh;
      name fastBack;
    }
  GOPT0960_A2_bodySmooth.stl
    {
      type triSurfaceMesh;
      name body;

    }
  GRWS0960_O12_frontWheel.stl
    {
      type triSurfaceMesh;
      name frWheel;
    }
};
and then:

Quote:
refinementSurfaces
{
windTunnel
{
level (2 2);
}
fastBack
{
level (2 2);
}
body
{
level (2 2);
}
frWheel
{
level (2 2);
}
}
lovecraft22 is offline   Reply With Quote

Old   April 20, 2012, 13:49
Default
  #12
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 464
Rep Power: 10
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Quote:
Originally Posted by Horus View Post
Thanks for your help!

One more question: Is there a variable that globally controls the fineness of the mesh? In my other mesher I have a base cell size and all levels of refinement are based on this value. So if the mesh is good and I just want some more cells I decrease that base cell size.

Is maxGlobalCells or maxLocalCells something like that?
Yess, is the number of divisions for your blockMesh.

Let's say you have a 10m long domain with 10 cells. That means every cell will be 10/10=1m long. That is level 0. Level 1 will be 0.5m long, level 2 0.25m and so on.
If you chose to have 20 cell, then your level 0 will be 0.5m, your level 1 0.25 and so on so the number of cells will increase. Usually this is not the way of working though, as you are probably aiming at increasing the mesh close to the body only and not everywhere on your domain.
lovecraft22 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SnappyHexMesh for internal Flow vishwa OpenFOAM Native Meshers: snappyHexMesh and Others 24 June 27, 2016 08:54
[ICEM] Generating Mesh for STL Car in Windtunnel Simulation tommymoose ANSYS Meshing & Geometry 48 April 15, 2013 04:24
engrid -> save as .stl with boundarie codes Zymon enGrid 31 August 29, 2011 13:40
SnappyHexMesh not generate mesh first time mavimo OpenFOAM Mesh Utilities 4 August 26, 2008 07:08
generate different mesh in CFX_MESH Eric CFX 0 June 23, 2006 09:09


All times are GMT -4. The time now is 02:31.