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

[snappyHexMesh] Mesh does not snap to geometry

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

Like Tree2Likes
  • 1 Post By simrego
  • 1 Post By OskarT

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 16, 2019, 05:27
Default Mesh does not snap to geometry
  #1
New Member
 
Oskar T
Join Date: Sep 2019
Posts: 8
Rep Power: 6
OskarT is on a distinguished road
I am trying to setup do aerodynamics simulation of a car using symmetry. I've exported the car as STL file from freecad.


I've used blockMesh together with snappyHexMesh but got no snapping at all as seen below.

You can see the images here: https://drive.google.com/drive/folde...Z4?usp=sharing


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

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale   1;

vertices
(
    (-4 -0.5 -2) // 0
    (11 -0.5 -2) // 1
    (11  3 -2) // 2
    (-4  3 -2) // 3
    (-4 -0.5 0) // 4
    (11 -0.5 0) // 5
    (11  3 0) // 6
    (-4  3 0) // 7

);

blocks
(
    hex (0 1 2 3 4 5 6 7) (120 30 20) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    Sym
    {
        type symmetryPlane;
        faces
        (
            (4 5 6 7)
        );
    }
    backPanel
    {
        type symmetryPlane;
        faces
        (
            (3 2 1 0)
        );
    }
    Inlet
    {
        type patch;
        faces
        (
            (4 7 3 0)
        );
    }
    Outlet
    {
        type patch;
        faces
        (
            (1 2 6 5)
        );
    }
    Ground
    {
        type wall;
        faces
        (
            (0 1 5 4)
        );
    }
    Top
    {
        type symmetryPlane;
        faces
        (
            (3 7 6 2)
        );
    }
);


// ************************************************************************* //
snappyHexMesh

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1906                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"
// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       false;


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
    Car
    {
        type triSurfaceMesh;
        file "Car.stl";
    }
};


// Settings for the castellatedMesh generation.
castellatedMeshControls
{
	// Specifies a level for any cell intersected by its edges.
    // This is a featureEdgeMesh, read from constant/triSurface for now.
    features
    (
//      { file "CAD.eMesh"; level 1; }
    );



    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies two levels for every surface. The first is the minimum level,
    // every cell intersecting a surface gets refined up to the minimum level.
    // The second level is the maximum level. Cells that 'see' multiple
    // intersections where the intersections make an
    // angle > resolveFeatureAngle get refined up to the maximum level.

    refinementSurfaces
    {
        Car
        {
            // Surface-wise min and max refinement level
            level (3 3);
        }
    }
	resolveFeatureAngle 10;
	    refinementRegions
    {
		refinementBoxA
        {
            mode inside;
            levels ((1 1)); //Le 1 n'a aucune influence pour une box //------1
        }
    }
    locationInMesh (0 0.1 -0.1); // Offset from (0 0 0) to avoid coinciding with face or edge
									 
	maxLocalCells 1500000;
    maxGlobalCells 2000000;
	minRefinementCells 10;
    nCellsBetweenLevels 6;

}



// Settings for the snapping.
snapControls
{
    nSmoothPatch 3;
    tolerance 4;
    nSolveIter 100;
    nRelaxIter 5;
}




// Settings for the layer addition.
addLayersControls
{
    layers
    {
        "Car.*"
        {
            nSurfaceLayers 6;
        } 
        bottom
        {
            nSurfaceLayers 6;
        } 
    }

    relativeSizes       false; // false, usually with firstLayerThickness
    expansionRatio      1.2;
//    finalLayerThickness 0.5;
    minThickness        1e-3;
    firstLayerThickness 0.01;

//  maxThicknessToMedialRatio 0.6;
}




// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    minTetQuality -1e+30;
}

/*writeFlags
(
//    scalarLevels
    layerSets
    layerFields
); */

mergeTolerance 1e-6;

// ************************************************************************* //
Any ideas on how to fix this?
OskarT is offline   Reply With Quote

Old   September 16, 2019, 05:55
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!

What was the command for snappyHexMesh?
You may missed the -overwrite switch, so you will find your snapped mesh at the second time step.
Also that tolerance is a bit high, you can use the "default" 2.

And as i see you have no feature snapping.
Try to put this into the snapControls:
implicitFeatureSnap true;
explicitFeatureSnap false;

Or:
implicitFeatureSnap false;
explicitFeatureSnap true;

But you will need the edge mesh for this what you are commented in the castellatedMeshControls. This is the default setup, so you can simply uncomment the features without adding these lines.


Maybe this won't solve your problem but you will need it to capture the features.
OskarT likes this.
simrego is offline   Reply With Quote

Old   September 16, 2019, 06:14
Default
  #3
New Member
 
Oskar T
Join Date: Sep 2019
Posts: 8
Rep Power: 6
OskarT is on a distinguished road
Boy do I feel stupid, haha!

It was hiding in the second time step. "snappyHexMesh -overwrite" solved my problem!

I also changed the tolerance down to 2 and opt for the implicit snapping feature but these was not the solution to my problem, my command was.

Thank you!
simrego likes this.
OskarT is offline   Reply With Quote

Reply

Tags
blockmesh, hexmesh, mesh, snap, snappyhexmesh

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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
[ANSYS Meshing] How to mesh this geometry to get best quality?(provide your suggestion) Roh ANSYS Meshing & Geometry 1 October 10, 2017 14:23
[snappyHexMesh] snappyHexMesh & Mesh around a missile sasanghomi OpenFOAM Meshing & Mesh Conversion 2 October 15, 2014 20:54
Inner geometry gets lost exporting mesh from ICEM CFD to CFX-Pre powpow CFX 3 December 20, 2012 10:14
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09


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