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] Couldn't get snappy to generate a mesh (https://www.cfd-online.com/Forums/openfoam-meshing/100100-couldnt-get-snappy-generate-mesh.html)

Horus April 20, 2012 07:28

Couldn't get snappy to generate a mesh
 
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;


colinB April 20, 2012 07:49

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

Horus April 20, 2012 07:54

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.

colinB April 20, 2012 08:03

Hey

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

regards

Horus April 20, 2012 08:19

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!

colinB April 20, 2012 08:34

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)?

Horus April 20, 2012 08:52

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 April 20, 2012 09:04

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!

colinB April 20, 2012 09:18

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

Horus April 20, 2012 13:12

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?

lovecraft22 April 20, 2012 13:45

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 April 20, 2012 13:49

Quote:

Originally Posted by Horus (Post 355879)
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.


All times are GMT -4. The time now is 01:38.