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

[snappyHexMesh] very bad quality snapped mesh

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By federicabi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2016, 10:35
Default very bad quality snapped mesh
  #1
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi everyone!
I'm trying to create a mesh with snappyHexMesh in OF 3.0.1 and I'm having lots of troubles with the snapping procedure. The mesh I obtain has a very poor quality, it isn't snapped at all and I don't know why. I used the same settings on other geometries and they worked.
I attach my stl geometry, the dictionary used and the images of the result.
SnappyHexMeshDict
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
{
    meshInteraNeww.stl
    {
        type triSurfaceMesh;
        name meshInteraNeww;

        patchInfo
        {
            type wall;
        }
    }

    refinementBox1
    {
        type searchableBox;
        min (-0.4 0 -2.4);
        max (27.2 3.8 4.8);
    }

 /*   refinementBoxI1
    {
        type searchableBox;
        min (0 0 -0.4);
        max (60 5 0.4);  
    }

    refinementBoxS
    {
        type searchableBox;
        min (-10 0 -1.5);
        max (1 5 0.5);
    }
*/
};



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

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

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

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



    // 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 "meshInteraNeww.eMesh";
             level 6;  // 5 3
         }
    );



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

    resolveFeatureAngle 25;

    
    // 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
    {
        refinementBox1
        {
            mode inside;   // inside;
            levels ((1E15 6));  //1E15 4
        }

  /*      refinementBoxI1
        {
            mode inside;   // inside;
            levels ((1E15 6));  //1E15 4
        }

        refinementBoxS
        {
            mode inside;   // inside;
            levels ((1E15 6));  //1E15 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 (-4.5 30 0.5);


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

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

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

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

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

        //- 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
    {
        meshInteraNeww
        {
            nSurfaceLayers 3;  // 3

        }
    }

    // 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.
    // See relativeSizes parameter.
    finalLayerThickness 0.1;  // 0.7

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // See relativeSizes parameter.
    minThickness 0.001;       // 0.25

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

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

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

    // Max number of iterations after which relaxed meshQuality controls
    // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
    // after nRelaxIter it uses the values in meshQualityControls::relaxed.
    nRelaxedIter 20;
}



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


// Advanced

// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;


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


// ************************************************************************* //
SurfaceFeatureExtractDict
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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

meshInteraNeww.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   175;
    }

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

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


    // Write options

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


// ************************************************************************* //
Can you help me to understand what's wrong please?

Best regards

Federica
Attached Images
File Type: png castellatedMesh.png (44.6 KB, 733 views)
File Type: png snappedMesh.png (97.4 KB, 710 views)
File Type: png stlSurface.png (42.8 KB, 653 views)
federicabi is offline   Reply With Quote

Old   July 11, 2016, 22:21
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25
me3840 is on a distinguished road
I would turn way down the number of relaxation iterations to 30-50. Your tolerance is also really high, I would try lowering that to 1 or 2. Don't use both implicit and explicit feature snapping, I'd only use the later.

You didn't attach the STL.
me3840 is offline   Reply With Quote

Old   July 12, 2016, 04:03
Default
  #3
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Sorry, my bad. The STL is too big to be uploaded, this is the link to my Drive where there is the STL
https://drive.google.com/file/d/0B4r...w?usp=drivesdk
If you have any problem to visualize it, tell me and I'll send it to you by mail.
However, I did what you said but the result didn't change, it seems the snapping process stops before its natural end with this warning

--> FOAM Warning :
From function autoSnapDriver::doSnap(..)
in file autoHexMesh/autoHexMeshDriver/autoSnapDriver.C at line 3138
Did not succesfully snap mesh. Continuing to snap to resolve easy
surfaces but the resulting mesh will not satisfy your quality constraints

Any idea?

Last edited by federicabi; July 12, 2016 at 05:06.
federicabi is offline   Reply With Quote

Old   July 12, 2016, 10:19
Default
  #4
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Update: I tried also to make a finer STL and the result looked exactly as the previous one.
I really don't know how to solve it.

If you have any idea, I will appreciate.

Best regards

Federica
federicabi is offline   Reply With Quote

Old   July 27, 2016, 09:49
Question
  #5
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi everyone!
After lots of attempts I managed to obtain a smooth surface, increasing nSmoothPatch iterations and the refinement on the surface and on the feature edges. Anyway I have a problem with the edges that aren't sharp (see the attached picture).
I tried to increase the refinement level of the feature edges but this generates a bad quality surface in the zones near the edges and it doesn't resolve the problem too.
Here I post my snappyHexMeshDict and my surfaceFeatureExtractDict.
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       true;


// 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
{
    meshInteraFine.stl
    {
        type triSurfaceMesh;
        name meshInteraFine;

        patchInfo
        {
            type wall;
        }
    }
    

    /*refinementBox1
    {
        type searchableBox;
        min (-1 0 -3);
        max (28 3.8 5);
    }*/
  refinementBoxI1
    {
        type searchableBox;
        min (0 0 -0.4);
        max (60 5 0.4);  
    }

    refinementBoxS
    {
        type searchableBox;
        min (-10 0 -1.5);
        max (1 5 0.5);
    }
    
    refinementBoxM
    {
      type searchableBox;
      min (-20 0 -1);
      max (60 26.704 1);
    }
};



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

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

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

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



    // 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 "meshInteraFine.eMesh";
             level  7;  // 5 3
         }
        
    );



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

    resolveFeatureAngle 15;

    
    // 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
    {
      /*refinementBox1
        {
            mode inside;   // inside;
            levels ((1E15 5));  //1E15 4
        } */
      refinementBoxI1
        {
            mode inside;   // inside;
            levels ((1E15 5));  //1E15 4
        }
        refinementBoxS
        {
            mode inside;   // inside;
            levels ((1E15 4));  //1E15 4
        }

        refinementBoxM
        {
            mode inside;   // inside;
            levels ((1E15 2));  //1E15 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 (-4.50006489 30.01113553 0.511579);


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

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

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

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

    nFeatureSnapIter 15;
    // 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
    {
        meshInteraFine
        {
            nSurfaceLayers 3;  // 3

        }
        
    }

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


    // Wanted thickness of final added cell layer. If multiple layers
    // is the thickness of the layer furthest away from the wall.
    // See relativeSizes parameter.
    firstLayerThickness 1;  // 0.7

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // See relativeSizes parameter.
    minThickness 0.001;       // 0.25

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


    // Advanced settings

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

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

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

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

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

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

    // Max number of iterations after which relaxed meshQuality controls
    // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
    // after nRelaxIter it uses the values in meshQualityControls::relaxed.
    nRelaxedIter 20;
}



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


// Advanced

// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;


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


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

meshInteraFine.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   170;
    }

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

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


    // Write options

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


// ************************************************************************* //
I haven't tried the layer addiction yet, because checkMesh gives me one failure about maxSkewness.

Do you have any suggestion for me to improve the quality of the mesh?
Thank you in advance

Federica
Attached Images
File Type: png edges.png (110.3 KB, 466 views)
federicabi is offline   Reply With Quote

Old   July 28, 2016, 07:43
Default
  #6
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 10
Illmatic is on a distinguished road
Can you post your blockMeshDict too?
Illmatic is offline   Reply With Quote

Old   July 28, 2016, 09:10
Default
  #7
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi Illmatic, thank you for your reply!
Here is my blockMeshDict

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


convertToMeters 1;

vertices        
(
    (-60 0  -60)
    ( 60 0  -60)
    ( 60 60 -60)
    (-60 60 -60)

    (-60 0  -2)
    ( 60 0  -2)
    ( 60 60 -2)
    (-60 60 -2)
 
    (-60 0  -0.4)
    ( 60 0  -0.4)
    ( 60 60 -0.4)
    (-60 60 -0.4)
    
    (-60 0  0.4)
    ( 60 0  0.4)
    ( 60 60 0.4)
    (-60 60 0.4)
    
    (-60 0  2)
    ( 60 0  2)
    ( 60 60 2)
    (-60 60 2)

    (-60 0  50)
    ( 60 0  50)
    ( 60 60 50)
    (-60 60 50)
);

blocks          
(
    hex (0 1 2 3 4 5 6 7)   (30 15 23) simpleGrading (1 1 0.2)
//    hex (0 1 2 3 4 5 6 7)   (60 20 30) simpleGrading (1 1 0.1)
    hex (4 5 6 7 8 9 10 11)   (30 15 2) simpleGrading (1 1 1)
//    hex (4 5 6 7 8 9 10 11)   (60 20 16) simpleGrading (1 1 1)
    hex (8 9 10 11 12 13 14 15)   (30 15 2) simpleGrading (1 1 1)
//    hex (8 9 10 11 12 13 14 15)   (60 20 23) simpleGrading (1 1 10)
    hex (12 13 14 15 16 17 18 19)   (30 15 2) simpleGrading (1 1 1)
    
    hex (16 17 18 19 20 21 22 23)   (30 15 19) simpleGrading (1 1 5)
);

edges           
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (1 2 6 5)
            (5 6 10 9)
            (9 10 14 13)
        (13 14 18 17)
        (17 18 22 21)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (0 4 7 3)
            (4 8 11 7)
            (8 12 15 11)
        (12 16 19 15)
        (16 20 23 19)
        );
    }

    top
    {
        type patch;
        faces
        (
            (20 21 22 23)
        );
    }

    bottom
    {
        type symmetry;
        faces
        (
            (0 3 2 1)
        );
    }

    sym
    {
        type symmetry;
        faces
        (
            (0 1 5 4)
            (4 5 9 8)
            (8 9 13 12)
        (12 13 17 16)
        (16 17 21 20)
        );
    }

    side
    {
        type symmetry;
        faces
        (
            (3 7 6 2)
            (7 11 10 6)
            (11 15 14 10)
        (15 19 18 14)
        (19 23 22 18)
        );
    }


);




mergePatchPairs 
(
);


// ************************************************************************* //
federicabi is offline   Reply With Quote

Old   July 28, 2016, 10:23
Default
  #8
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 10
Illmatic is on a distinguished road
Hi Federica,
is it possible, that your STL file is not converted to meters? It seems to me like it is in mm. Did you convert it before creating your mesh?
Illmatic is offline   Reply With Quote

Old   July 28, 2016, 10:31
Default
  #9
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Quote:
Originally Posted by Illmatic View Post
Hi Federica,
is it possible, that your STL file is not converted to meters? It seems to me like it is in mm. Did you convert it before creating your mesh?
You're right, my STL is in mm but I used the utility surfaceTransformPoint to scale it in meters, since my blockMesh is in meters. I also traslated and rotated the STL to make it close to the steady state.
federicabi is offline   Reply With Quote

Old   July 28, 2016, 11:23
Default
  #10
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 10
Illmatic is on a distinguished road
Ok so could you provide the modified STL file?
Illmatic is offline   Reply With Quote

Old   July 28, 2016, 11:35
Default
  #11
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
I'm sorry if I didn't realize myself that I should share with you the correct STL. As the previous one, it is too big to be attached here, I give you the link to my google drive where I put the STL named meshInteraFine.stl

https://drive.google.com/file/d/0B4r...w?usp=drivesdk


Let me know if you have any difficulties to open it and I'll send it to you by mail.
Thank you for your help, I really appreciate!


Federica

Last edited by federicabi; July 28, 2016 at 11:35. Reason: typo
federicabi is offline   Reply With Quote

Old   July 29, 2016, 05:53
Default
  #12
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 10
Illmatic is on a distinguished road
Hi Federica,

I just ran your blockMesh and your surfaceFeatureExtract and then displayed both together with your STL in Paraview to observe the blockMesh. It seems like the blockMesh is very large and doesn't cover the whole STL. Is that intended and if why?

Best regards,
Axel
Attached Images
File Type: jpg blockMeshBiano.jpg (166.9 KB, 487 views)
Illmatic is offline   Reply With Quote

Old   July 29, 2016, 06:11
Default
  #13
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi Illmatic!
What I would like to do is to calculate the hull resistance, so I chose a such big domain to avoid interferences with the boundaries (especially in the inlet zone) and to be able to observe the wave pattern behind the hull. The blockMesh covers only half domain just because of the symmetry of the geometry, so also the cells number is less ( and consequently the computational effort is too).
I use the grading in z-direction to have a more refined zone near the free surface, and, if you look at the refinement boxes I used in snappyHexMesh, they are essential to have a more accurate solution in terms of spray in the sprayrails zone, in terms of wake behind the hull and to avoid ventilation in the inlet zone. Although the shape, the structure and the cells dimension of the entire mesh, should not be changed, because my goal is to reproduce a mesh created with star CCM+ and then compare the results.

Do I ask too much to snappyHexMesh?
federicabi is offline   Reply With Quote

Old   July 31, 2016, 12:21
Default
  #14
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 10
Illmatic is on a distinguished road
Hi Federica,
Unfortunatly I did not find time to run your case myself. However what I would recommend is, that you increase the number of cells in your blockMesh in the region where the ship hull is. Then you should also be able to decrease the refinement in the snappyHexMeshDict and the snapping should still work. Also you should be able to turn the snapping controls a little back to the default values.

Edit: And I would turn off the layer addition as long as the snapping does not work properly.

Last edited by Illmatic; August 1, 2016 at 04:06.
Illmatic is offline   Reply With Quote

Old   August 1, 2016, 05:45
Default
  #15
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi!
Thank you for your tips, I will try to modify the blockMesh to obtain smaller cells with aspect ratio close to 1 near the hull.
I will let you know the results!

(In the meantime I tried cfMesh and it gave me very good results)

Best regards

Federica
federicabi is offline   Reply With Quote

Old   August 3, 2016, 11:51
Default Update
  #16
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi everyone!
As I said in my previous post, I tried with a different blockMesh, but unfortunately the result didn't change.
Here is the blockMesh used
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


convertToMeters 1;

vertices        
(
    (-60 0 -60)
    ( -5 0 -60)
    ( -5 7 -60)
    (-60 7 -60)

    (25 0  -60)
    (25 7  -60)
     
    ( 60 0 -60)
    ( 60 7 -60)
     
    (-60 60 -60)
    
    (-5 60 -60)
    
    (25 60 -60)
     
    ( 60 60 -60)
    
        
    (-60 0 -5)
    ( -5 0 -5)
    ( -5 7 -5)
    (-60 7 -5)

    (25 0  -5)
    (25 7  -5)
     
    ( 60 0 -5)
    ( 60 7 -5)
     
    (-60 60 -5)
    
    (-5 60 -5)
    
    (25 60 -5)
     
    ( 60 60 -5)
    
    
    (-60 0 8)
    ( -5 0 8)
    ( -5 7 8)
    (-60 7 8)

    (25 0  8)
    (25 7  8)
     
    ( 60 0 8)
    ( 60 7 8)
     
    (-60 60 8)
    
    (-5 60 8)
    
    (25 60 8)
     
    ( 60 60 8)
    
    
    (-60 0 50)
    ( -5 0 50)
    ( -5 7 50)
    (-60 7 50)

    (25 0  50)
    (25 7  50)
     
    ( 60 0 50)
    ( 60 7 50)
     
    (-60 60 50)
    
    (-5 60 50)
    
    (25 60 50)
     
    ( 60 60 50)
    
    
);

blocks          
(
    hex (0 1 2 3 12 13 14 15)   (26 11 26) simpleGrading (0.125 1 0.125)

    hex (1 4 5 2 13 16 17 14)   (48 11 26) simpleGrading (1 1 0.125)

    hex (4 6 7 5 16 18 19 17)   (16 11 26) simpleGrading (8 1 0.125)

    hex (3 2 9 8 15 14 21 20)   (26 25 26) simpleGrading (0.125 8 0.125)
    
    hex (2 5 10 9 14 17 22 21)   (48 25 26) simpleGrading (1 8 0.125)
    
    hex (5 7 11 10 17 19 23 22)   (16 25 26) simpleGrading (8 8 0.125)
    
    hex (12 13 14 15 24 25 26 27)   (26 11 21) simpleGrading (0.125 1 1)
    
    hex (13 16 17 14 25 28 29 26)   (48 11 21) simpleGrading (1 1 1)
    
    hex (16 18 19 17 28 30 31 29)   (16 11 21) simpleGrading (8 1 1)
    
    hex (15 14 21 20 27 26 33 32)   (26 25 21) simpleGrading (0.125 8 1)
    
    hex (14 17 22 21 26 29 34 33)   (48 25 21) simpleGrading (1 8 1)
    
    hex (17 19 23 22 29 31 35 34)   (16 25 21) simpleGrading (8 8 1)
    
    hex (24 25 26 27 36 37 38 39)   (26 11 20) simpleGrading (0.125 1 8)
    
    hex (25 28 29 26 37 40 41 38)   (48 11 20) simpleGrading (1 1 8)
    
    hex (28 30 31 29 40 42 43 41)   (16 11 20) simpleGrading (8 1 8)
    
    hex (27 26 33 32 39 38 45 44)   (26 25 20) simpleGrading (0.125 8 8)
    
    hex (26 29 34 33 38 41 46 45)   (48 25 20) simpleGrading (1 8 8)
    
    hex (29 31 35 34 41 43 47 46)   (16 25 20) simpleGrading (8 8 8)
);

edges           
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (6 7 19 18)
            (7 11 23 19)
            (18 19 31 30)
        (19 23 35 31)
        (30 31 43 42)
        (31 35 47 43)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (0 3 15 12)
            (3 8 20 15)
            (12 15 27 24)
        (15 20 32 27)
        (24 27 39 36)
        (27 32 44 39)
        );
    }

    top
    {
        type patch;
        faces
        (
            (36 37 38 39)
        (37 40 41 38)
        (40 42 43 41)
        (39 38 45 44)
        (38 41 46 45)
        (41 43 47 46)
        );
    }

    bottom
    {
        type symmetry;
        faces
        (
            (0 1 2 3)
        (1 4 5 2)
        (4 6 7 5)
        (3 2 9 8)
        (2 5 10 9)
        (5 7 11 10)
        );
    }

    sym
    {
        type symmetry;
        faces
        (
            (0 1 13 12)
            (1 4 16 13)
            (4 6 18 16)
        (12 13 25 24)
        (13 16 28 25)
        (16 18 30 28)
        (24 25 37 36)
        (25 28 40 37)
        (28 30 42 40) 
        );
    }

    side
    {
        type symmetry;
        faces
        (
            (8 9 21 20)
            (9 10 22 21)
            (10 11 23 22)
        (20 21 33 32)
        (21 22 34 33)
        (22 23 35 34)
        (32 33 45 44)
        (33 34 46 45)
        (34 35 47 46)
        );
    }


);




mergePatchPairs 
(
);


// ************************************************************************* //
I also reduced the levels in snappyHexMesh, as suggested by Illmatic.
I attach also a couple of figures, just to help you to understand the problem.

However, I think I will carry on with the mesh created with cfMesh but if anyone have a hint, I will appreciate!

Federica
Attached Images
File Type: png meshglobale.png (10.6 KB, 360 views)
File Type: png superficie.png (92.0 KB, 304 views)
federicabi is offline   Reply With Quote

Old   August 5, 2016, 10:59
Default
  #17
Member
 
Federica Biano
Join Date: Feb 2016
Location: Genova, Italy
Posts: 39
Rep Power: 10
federicabi is on a distinguished road
Hi!
I would like to update you: eventually the solution to my problem came out!
I used these parameters
Code:
nSmoothPatch 1;
tolerance 1;
nSolveIter 50;
nRelaxIter 5;
nFeatureSnapIter 10;
implicitFeatureSnap false;
explicitFeatureSnap true;
multiRegionFeatureSnap false;
The mesh was perfect, the surface was smooth and the edges were perfectly sharp.
Now I'm moving a step forward and I'm trying to add the prism layer.
I managed to do it with all the meshQualityControls disabled (otherwise the adding layer process leads to a 0.8% prism layer extension with lots of bad cells) but of course the final mesh has the prism layer but the edges are bad again
This is driving me crazy.

Could you please help me to find out where is the problem?
Thanks in advance

Federica
WaterHammer1985 likes this.
federicabi is offline   Reply With Quote

Old   August 9, 2016, 07:50
Default
  #18
Member
 
Axel
Join Date: May 2016
Location: Augsburg, Germany
Posts: 46
Rep Power: 10
Illmatic is on a distinguished road
What settings are you using for the layer addition in the shmDict?
Illmatic is offline   Reply With Quote

Old   September 26, 2018, 11:33
Default
  #19
New Member
 
Join Date: Dec 2012
Posts: 3
Rep Power: 13
nimrod is on a distinguished road
Nice work. Can you share the solution setup portion of the model also? Or please point to a tutorial where I can find more details. I am interested in learning how to assess the hull resistance in OpenFOAM.
nimrod is offline   Reply With Quote

Reply


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
[snappyHexMesh] Bad quality mesh at external corners Bollonga OpenFOAM Meshing & Mesh Conversion 2 October 31, 2017 14:42
von Karman effect imbalance frossi CFX 7 July 4, 2016 21:08
[ICEM] How to improve bad quality elements that are obtained after creating prism layers? Rohith Giridhar ANSYS Meshing & Geometry 2 July 11, 2015 19:04
early stall, poor convergence, and mesh quality everest CFX 2 May 12, 2010 17:27
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 16:46.