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] Problem with Sanpper, surface still Rough (https://www.cfd-online.com/Forums/openfoam-meshing/143607-problem-sanpper-surface-still-rough.html)

Zephiro88 October 29, 2014 05:19

Problem with Sanpper, surface still Rough
 
1 Attachment(s)
Hi, i'm a new OpenFOAM user end i have some trouble meshing an airplane with snappyHexMesh, the problem is the same if i try to mesh a single part (like the canard).

The surface is not smooth but remain rough like a golf ball, LE and TE are the most affected part.

The stl file is smooth and doesn't have any problem.

Someone can help me? I want also to know wich parameter in the snappyHexMesh Dict i have to change to improove the performance of the mesh, some comand are unclear, like the relative tolerance or the feature angle..

Code:

*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.0                                |
|  \\  /    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 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
{
    LiMoRANS.stl
    {
        type triSurfaceMesh;
        name LiMoRANS;
    }

    refinementBox
    {
        type searchableBox;
        min (-10.0 -10 -3);
        max ( 10  5 3);
    }
};



// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    // Refinement parameters
    // ~~~~~~~~~~~~~~~~~~~~~

    // If local number of cells is >= maxLocalCells on any processor
    // switches from from refinement followed by balancing
    // (current method) to (weighted) balancing before refinement.
    maxLocalCells 1000000;

    // Overall cell limit (approximately). Refinement will stop immediately
    // upon reaching this number so a refinement level might not complete.
    // Note that this is the number of cells before removing the part which
    // is not 'visible' from the keepPoint. The final number of cells might
    // actually be a lot less.
    maxGlobalCells 8000000;

    // The surface refinement loop might spend lots of iterations refining just a
    // few cells. This setting will cause refinement to stop if <= minimumRefine
    // are selected for refinement. Note: it will at least do one iteration
    // (unless the number of cells to refine is 0)
    minRefinementCells 50;

    // Allow a certain level of imbalance during refining
    // (since balancing is quite expensive)
    // Expressed as fraction of perfect balance (= overall number of cells /
    // nProcs). 0=balance always.
    maxLoadUnbalance 0.10;


    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 4;



    // Explicit feature edge refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies a level for any cell intersected by its edges.
    // This is a featureEdgeMesh, read from constant/triSurface for now.
    features
    (
        {
            file "LiMoRANS.eMesh";
            level 6;
        }
    );



    // 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
    {
        LiMoRANS
        {
            // Surface-wise min and max refinement level
            level (4 5);

            // Optional specification of patch type (default is wall). No
            // constraint types (cyclic, symmetry) etc. are allowed.
            patchInfo
            {
                type wall;
                inGroups (LiMoRANSGroup);
            }
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 90;


    // Region-wise refinement
    // ~~~~~~~~~~~~~~~~~~~~~~

    // Specifies refinement level for cells in relation to a surface. One of
    // three modes
    // - distance. 'levels' specifies per distance to the surface the
    //  wanted refinement level. The distances need to be specified in
    //  descending order.
    // - inside. 'levels' is only one entry and only the level is used. All
    //  cells inside the surface get refined up to the level. The surface
    //  needs to be closed for this to be possible.
    // - outside. Same but cells outside.

    refinementRegions
    {
        refinementBox
        {
            mode outside;
            levels ((1E13 4));
        }
    }


    // 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 (0 0 -2);


    // 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 60;

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

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

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

    // Feature snapping

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

        //- 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 true;

    // Per final patch (so not geometry!) the layer information
    layers
    {
        "(lowerWall|motorBike).*"
        {
            nSurfaceLayers 1;
        }
    }

    // Expansion factor for layer mesh
    expansionRatio 1.0;

    // 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.
    // is the thickness of the layer furthest away from the wall.
    // See relativeSizes parameter.
    finalLayerThickness 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.1;

    // 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;

    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 60;

    // 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 1;

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

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

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

    // 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 50;
}



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


    // Advanced

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


// Advanced

// Write flags
writeFlags
(
    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;


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

Here ther'is the stl file.

Ruli October 29, 2014 05:41

Hi Zephiro,

got any images of the problem?

I suggest, try to increase snapping refinement

Code:

level (4 5)
to

Code:

level (4 6)
or even higher.

There is a lot of other possibilites, but without clear description of the problem it is hard to help.

Best regards
Julian

Zephiro88 October 29, 2014 08:03

2 Attachment(s)
Ok, this is a screenshot of the meshed canard. I hope it's enough to understand what is the problem.

In the SHM dict i have post above there is an error, the refinment region in the correct dict is set Inside..

My pc have 8GB of RAM and i7 8core processor.

Sorry if i don't write wery well but I'm not english..

Zephiro88 November 5, 2014 06:30

I have increase the snapping refinment to (4 8) but the result is the same.

vonboett November 5, 2014 07:36

Hi Francesco,

How do you generate your .eMesh?
There is the key for right edge snapping.

// Explicit feature edge refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// Specifies a level for any cell intersected by its edges.
// This is a featureEdgeMesh, read from constant/triSurface for now.
features
(

{ //for better snapping
file " LiMoRANS.eMesh";
levels ((0.0 2) (0.002 1));
}
);

So to find options that may help, try
surfaceFeatureExtract -help

Zephiro88 November 5, 2014 09:18

This is the SurfaceFeature extract dict that i use:

Code:

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

LiMoRANS.stl
{
    // How to obtain raw features (extractFromFile || extractFromSurface)
    extractionMethod    extractFromSurface;

    extractFromSurfaceCoeffs
    {
        // Mark edges whose adjacent surface normals are at an angle less
        // than includedAngle as features
        // - 0  : selects no edges
        // - 180: selects all edges
        includedAngle  180;
    }

    subsetFeatures
    {
        // Keep nonManifold edges (edges with >2 connected faces)
        nonManifoldEdges      no;

        // Keep open edges (edges with 1 connected face)
        openEdges      no;
    }


    // Write options

        // Write features to obj format for postprocessing
        writeObj                yes;
}


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

Can you explain youre hint? I did not understand why you use those numbers

Zephiro88 November 5, 2014 09:30

I try to set the explicit edge refiniment to the value that you suggest but the result is an error message

Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.3.0-f5222ca19ce6
Exec  : snappyHexMesh -parallel -overwrite
Date  : Nov 05 2014
Time  : 15:23:55
Host  : "ubuntu"
PID    : 3109
Case  : /home/francesco/OpenFOAM/francesco-2.3.0/run/LiMo/LiMoRANSCanard
nProcs : 8
Slaves :
7
(
"ubuntu.3110"
"ubuntu.3111"
"ubuntu.3112"
"ubuntu.3113"
"ubuntu.3114"
"ubuntu.3115"
"ubuntu.3116"
)

Pstream initialized with:
    floatTransfer      : 0
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Create mesh for time = 0

Read mesh in = 0.02 s

Overall mesh bounding box  : (-20 -25 -10) (20 5 10)
Relative tolerance        : 1e-06
Absolute matching distance : 5.38516e-05

Reading refinement surfaces.
Read refinement surfaces in = 0.02 s

Reading refinement shells.
Refinement level 2 for all cells inside refinementBox
Read refinement shells in = 0 s

Setting refinement level of surface to be consistent with shells.
Checked shell refinement in = 0 s

Reading features.
Read edgeMesh LiMoRANS.eMesh
    points      : 1203
    edges      : 3597
    boundingBox : (-8.09 -1.96649 -0.0834526) (8.09 0.540291 0.176185)

[1]
[1]
[1] --> FOAM FATAL IO ERROR:
[1] [2]
[2]
[2] --> FOAM FATAL IO ERROR:
[2] wrong token type - expected int, found on line 0 the punctuation token '('
[2]
[3]
[3]
[3] --> FOAM FATAL IO ERROR:
[3] wrong token type - expected int, found on line 0 the punctuation token '('
[3]
[3] [4]
[4]
[4] --> FOAM FATAL IO ERROR:
[4] wrong token type - expected int, found on line 0 the punctuation token '('
[4]
[4] file: IOstream.castellatedMeshControls.features.level at line 0.
[4] [6]
[6]
[6] --> FOAM FATAL IO ERROR:
[6] wrong token type - expected int, found on line 0 the punctuation token '('
[6]
[6] file: IOstream.castellatedMeshControls.features.level at line 0.
[6]
[6]    From function operator>>(Istream&, int&)[7]
[7]
[7] --> FOAM FATAL IO ERROR:
[7] wrong token type - expected int, found on line 0 the punctuation token '('
[7]
[7] file: IOstream.castellatedMeshControls.features.level at line 0.
[7]
[7] [0]
[0]
[0] --> FOAM FATAL IO ERROR:
[0] wrong token type - expected int, found on line 95 the punctuation token '('
[0]
[0] file: /home/francesco/OpenFOAM/francesco-2.3.0/run/LiMo/LiMoRANSCanard/system/snappyHexMeshDict.castellatedMeshControls.features.level at line 95.
[0]
[0]    From function operator>>(Istream&, int&)
[0]    in file primitives/ints/int/intIO.C at line 68.wrong token type - expected int, found on line 0 the punctuation token '('
[1]
[1] file: IOstream.castellatedMeshControls.features.level at line 0.
[1]
[1]    From function operator>>(Istream&, int&)
[1]    in file primitives/ints/int/intIO.C at line 68.
[1]
FOAM parallel run exiting
[1]
[2] file: IOstream.castellatedMeshControls.features.level at line 0.
[2]
[2]    From function operator>>(Istream&, int&)
[2]    in file primitives/ints/int/intIO.C at line 68.
[2]
FOAM parallel run exiting
[2]
file: IOstream.castellatedMeshControls.features.level at line 0.
[3]
[3]    From function operator>>(Istream&, int&)
[3]    in file primitives/ints/int/intIO.C at line 68.
[3]
FOAM parallel run exiting
[3]

[4]    From function operator>>(Istream&, int&)
[4]    in file primitives/ints/int/intIO.C at line 68.
[4]
FOAM parallel run exiting
[4]

[6]    in file primitives/ints/int/intIO.C at line 68.
[6]
FOAM parallel run exiting
[6]
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 7 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
    From function operator>>(Istream&, int&)
[7]    in file primitives/ints/int/intIO.C at line 68.
[7]
FOAM parallel run exiting
[7]

[0]
FOAM parallel run exiting
[0]
[5]
[5]
[5] --> FOAM FATAL IO ERROR:
[5] wrong token type - expected int, found on line 0 the punctuation token '('
[5]
[5] file: IOstream.castellatedMeshControls.features.level at line 0.
[5]
[5]    From function operator>>(Istream&, int&)
[5]    in file primitives/ints/int/intIO.C at line 68.
[5]
FOAM parallel run exiting
[5]
--------------------------------------------------------------------------
mpirun has exited due to process rank 6 with PID 3115 on
node ubuntu exiting without calling "finalize". This may
have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
[ubuntu:03108] 7 more processes have sent help message help-mpi-api.txt / mpi-abort
[ubuntu:03108] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages


vonboett November 5, 2014 12:05

Sorry, my mistake. One can define how many times cells should be splitted at the edges using levels, the levels specification I copied was from refinementRegions mode distance and does not belong there. You run OpenFOAM 2.3 right? Maybe you can try setting the feature angle to 179 due to this thread: http://www.cfd-online.com/Forums/ope...ain-edges.html


All times are GMT -4. The time now is 10:52.