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

[snappyHexMesh] SHM addLayers doesnt work on the small surface

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 29, 2018, 14:37
Post SHM addLayers doesnt work on the small surface
  #1
New Member
 
arash
Join Date: Dec 2017
Posts: 10
Rep Power: 8
handicraft is on a distinguished road
Hello,

I just tried to make a simple mesh on a car geometry with snappyHexMesh.
everything worked quite well except addlayer. actually addlayer, add layers on all surface except small ones. I changed various paramters but did not answer,how can i fix this?


Here is my SHMDict:


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

// Which of the steps to run
castellatedMesh false;
snap            false;
addLayers       true;


geometry
{
    //main {type triSurfaceMesh;file "main.obj";}
    left {type triSurfaceMesh;file "left.obj";}
    right {type triSurfaceMesh;file "right.obj";}
    roof {type triSurfaceMesh;file "roof.obj";}
    fhood {type triSurfaceMesh;file "fhood.obj";}
    rhood {type triSurfaceMesh;file "rhood.obj";}
    fbumper {type triSurfaceMesh;file "fbumper.obj";}
    rbumper {type triSurfaceMesh;file "rbumper.obj";}
    floor {type triSurfaceMesh;file "floor.obj";}
    tire {type triSurfaceMesh;file "tire.obj";}
    refinementBox {type searchableBox;min (-1000 0 -1000);max (5000 1000 1000);}
    refinementCylinder {type searchableCylinder;point1 (-1000 500 -1000);point2 (-1000 500 1000);radius 500;}
    
};
castellatedMeshControls
{

    maxLocalCells 100000; //max cell per cpu core
    maxGlobalCells 2000000; //max cells to use before mesh deletion step
    minRefinementCells 10; //zero means no bad cell are allowed during refinement stage
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 7; //expension factor between each high & low refinement zone
    
    features //taken from stl from each .emesh file created by "surfaceFeatureExtract" command
    (
        //{file "main.eMesh";level 3;}
    {file "left.eMesh";level 5;}
    {file "right.eMesh";level 5;}
    {file "roof.eMesh";level 5;}
    {file "fhood.eMesh";level 5;}
    {file "rhood.eMesh";level 5;}
    {file "fbumper.eMesh";level 5;}
    {file "rbumper.eMesh";level 5;}
    {file "floor.eMesh";level 5;}
    {file "tire.eMesh";level 5;}
    );
    refinementSurfaces
    {
    //main {level (3 3);patchInfo {type wall;inGroups (sedanGroup);}}        
    left {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    right {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    roof {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    fhood {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    rhood {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    fbumper {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    rbumper {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    floor {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    tire {level (5 5);patchInfo {type wall;inGroups (sedanGroup);}}
    }

    // Resolve sharp angles
    resolveFeatureAngle 15;


    // Region-wise refinement    
    refinementRegions
    {
        refinementBox {mode inside;levels ((1E15 2));}
    refinementCylinder {mode inside;levels ((1E15 2));}
    }


    // Mesh selection
    // ~~~~~~~~~~~~~~

    // After refinement patches get added for all refinementSurfaces and
    // all cells intersecting the surfaces get put into these patches. The
    // section reachable from the locationInMesh is kept.
    // NOTE: This point should never be on a face, always inside a cell, even
    // after refinement.
    locationInMesh (-500 200 0);//(1000 500 0)


    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces true;
}



// Settings for the snapping.
snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 10;//3

    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    tolerance 3    ;//2

    //- Number of mesh displacement relaxation iterations.
    nSolveIter 100;

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
    nRelaxIter 5;//5

    // Feature snapping

        //- Number of feature edge snapping iterations.
        //  Leave out altogether to disable.
        nFeatureSnapIter 10;

        //- Detect (geometric only) features by sampling the surface
        //  (default=false).
        implicitFeatureSnap false;

        //- Use castellatedMeshControls::features (default = true)
        explicitFeatureSnap true;

        //- Detect points on multiple surfaces (only for explicitFeatureSnap)
        multiRegionFeatureSnap false;
}



// Settings for the layer addition.
addLayersControls
{
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes false;

    // Per final patch (so not geometry!) the layer information
    layers
    {
        //"(main).*" {nSurfaceLayers 5;}
    roof {nSurfaceLayers 4;}
    fhood {nSurfaceLayers 4;}
    rhood {nSurfaceLayers 4;}
    fbumper {nSurfaceLayers 4;}
    rbumper {nSurfaceLayers 4;}
    left {nSurfaceLayers 4;}
    right {nSurfaceLayers 4;}
    floor {nSurfaceLayers 4;}
    tire {nSurfaceLayers 4;}
    }

    // Expansion factor for layer mesh
    expansionRatio 1.5;//1.5

    // Wanted thickness of final added cell layer. If multiple layers
    // is the thickness of the layer furthest away from the wall.
    // Relative to undistorted size of cell outside layer.
    // See relativeSizes parameter.
    finalLayerThickness 2.5;//0.3

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // Relative to undistorted size of cell outside layer.
    minThickness 0.0001;//00.1s

    // If points get not extruded do nGrow layers of connected faces that are
    // also not grown. This helps convergence of the layer addition process
    // close to features.
    // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
    nGrow 0;//0

    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 160;//150
    //mergePatchFacesAngle 45;
    
    // At non-patched sides allow mesh to slip if extrusion direction makes
    // angle larger than slipFeatureAngle.
    slipFeatureAngle 30;
    
    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 3;

    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 0;//0

    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 3;//3

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;//10

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;//0.05

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
    minMedianAxisAngle 90;


    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;


    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 30;//30
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    #include "meshQualityDict"

    maxBoundarySkewness 20;
    maxInternalSkewness 6;
    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 4;
    //- Amount to scale back displacement at error points
    errorReduction 0.75;
}


// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    layerFields     // write volScalarField for layer coverage
);


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;


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

and blockMeshDict:


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

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

convertToMeters 1000;

vertices
(
    (-3 0 -3)
    (9 0 -3)
    (9 3 -3)
    (-3 3 -3)
    (-3 0 3)
    (9 0 3)
    (9 3 3)
    (-3 3 3)
);
blocks
(
    hex (0 1 2 3 4 5 6 7) (48 12 24) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    frontAndBack
    {
        type patch;
        faces
        (
            (4 5 6 7)
            (3 2 1 0)
        );
    }
    inlet
    {
        type patch;
        faces
        (
            (0 4 7 3)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (2 6 5 1)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 1 5 4)
        );
    }
    upperWall
    {
        type patch;
        faces
        (
            (2 3 7 6)
        );
    }
    
);


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

thanks
Attached Images
File Type: png 3.png (15.7 KB, 39 views)
File Type: png 4.png (31.8 KB, 48 views)
handicraft is offline   Reply With Quote

Old   September 30, 2018, 04:32
Default
  #2
Senior Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17
matejfor is on a distinguished road
Shm is doing it’s best to avoid layers there, it seems. Very stupid question: the surface is part of patch on which you prescribe 4 layers and you checked twice? (Experience). I have not spotted anything strange otherwise. Is it only here or does it occur elsewhere in your mesh?
matejfor is offline   Reply With Quote

Old   September 30, 2018, 07:14
Default
  #3
New Member
 
arash
Join Date: Dec 2017
Posts: 10
Rep Power: 8
handicraft is on a distinguished road
hi,
thank you for your reply.
yes, this face is part of patch with 4 layer and it occur in some faces(for example in behind of car, in rear bumper). Does the level value have any relation to this? I mean, the increase in the amount of level can solve the problem?
thanks
handicraft is offline   Reply With Quote

Old   October 1, 2018, 02:14
Default
  #4
Senior Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17
matejfor is on a distinguished road
Hi, it should not help. If the whole small patch is not captured, it is probably because the mesh shrinking, when the mesh is pushed away from wall to make space for the layers, was not successful. I would try refining the mesh along those places. To see if brings any difference. Also try to study log. You may also print out timedirs with intermediate steps to see where the process failed.
matejfor is offline   Reply With Quote

Old   October 5, 2018, 04:50
Default
  #5
New Member
 
arash
Join Date: Dec 2017
Posts: 10
Rep Power: 8
handicraft is on a distinguished road
sorry for delay. I did't have access to the net.
I'll do that.
thank you very much
handicraft is offline   Reply With Quote

Reply

Tags
addlayer, addlayers, 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
Work Bench GUI very small font shrek ANSYS 2 February 23, 2023 12:27
[snappyHexMesh] snappyHexMesh generates not planar surface krzychu111 OpenFOAM Meshing & Mesh Conversion 2 April 23, 2020 17:38
[snappyHexMesh] sHM too many cells Knapsack OpenFOAM Meshing & Mesh Conversion 2 July 8, 2017 08:41
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 04:21
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan OpenFOAM Meshing & Mesh Conversion 3 October 22, 2015 12:05


All times are GMT -4. The time now is 17:06.