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

[snappyHexMesh] Problem with snappyHex: no body

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 31, 2010, 17:22
Default Problem with snappyHex: no body
  #1
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Hi;
I'm moving my first steps with OF. I'm trying to mesh a simple circular cylinder. I get no error but when I run paraFoam the only thing I can get is the whole meshed domain without any body inside of it. The cylinder height is along the z axis, diameter is 60mm and height is 180mm. Here is my blockMeshDict:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices        
(
    (-0.5 -0.5 0)
    (0.5 -0.5 0)
    (0.5 0.5 0)
    (-0.5 0.5 0)
    (-0.5 -0.5 0.5)
    (0.5 -0.5 0.5)
    (0.5 0.5 0.5)
    (-0.5 0.5 0.5)
);

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

edges           
(
);

patches         
(
   
);

mergePatchPairs 
(
);

// ************************************************************************* //
and here's my snappyHexMeshDict:

Code:
FoamFile
{
    version         2.0;
    format          ascii;

    root            "/home/penfold/mattijs/foam/mattijs2.1/run/icoFoam";
    case            "cavity";
    instance        "system";
    local           "";

    class           dictionary;
    object          autoHexMeshDict;
}

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

castellatedMesh true;
snap            true;
addLayers       false;
geometry
{
    Cilindro.stl
    {
        type triSurfaceMesh;
        name Cilindro;
    }

};




castellatedMeshControls
{

  
    maxLocalCells 1000000;

    
    maxGlobalCells 2000000;

    minRefinementCells 0;

    nCellsBetweenLevels 1;

    features
    (
    );

    refinementSurfaces
    {
        Cilindro
        {
            level (4 5);
        }
    }

    resolveFeatureAngle 60;


    
    refinementRegions
    {
    	
    }


    locationInMesh (0.3 0.3 0.3);
}



snapControls
{

    nSmoothPatch 3;

    tolerance 4.0;
    nSolveIter 30;
    nRelaxIter 5;
}

addLayersControls
{
    layers
        }
    expansionRatio 1.0;
    finalLayerRatio 0.5; 
    minThickness 0.25;
    nGrow 0;
    featureAngle 60;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 130;
    nBufferCellsNoExtrude 0;
}


meshQualityControls
{    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minFlatness 0.5;
    minVol 1e-13;
    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;
I know the domain is small and the mesh is coarse, this is just a tryout.

Thanx!
lovecraft22 is offline   Reply With Quote

Old   June 1, 2010, 02:08
Default
  #2
Member
 
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 17
AlanR is on a distinguished road
lc22,

In blockMesh you only have one cell in the z direction. Your hex cells are 50 mm square and your cylinder is only 60 mm in diameter. Try blocks (0 1 2 3 4 5 6 7) (40 40 40) simpleGrading (1 1 1). This is still a coarse mesh, but it will be easier to see what's going on than with 20 blocks. Make sure the cylinder dimensions locate it within the box defined in your blockMesh. If the origin is 0,0,0 you should be OK. In snappy, try refinementSurfaces level (1 1) to start and experiment when you refine your mesh by using more blocks.

Alan
AlanR is offline   Reply With Quote

Old   June 1, 2010, 16:54
Default
  #3
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Thank you Alan. Unfortunately that doesn't solve the problem: when I run paraFoam my cylinder is not there and the whole domain is meshed…
lovecraft22 is offline   Reply With Quote

Old   June 3, 2010, 00:59
Default
  #4
Member
 
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 17
AlanR is on a distinguished road
Try opening the cylinder in ParaView to see the geometry the way OF will see it. You will also get to see where ParaView puts the origin. After you open the mesh, use the ParaView menu or file icon and browse to the file. If it looks OK, there's a surfaceCheck utility. I think the syntax is surfaceCheck Cilindro.stl. If the surfaceCheck thinks the surface is OK, and you're generating a hexagonal domain that's completely meshed with no cylinder in it, you probably are not locating the cylinder inside the mesh for some reason. You could try expanding the block (like from -2 to 2 in all dimensions) and see if the cylinder shows up. You could also try another .stl file. Maybe one of these things will help...

Alan
AlanR is offline   Reply With Quote

Old   June 7, 2010, 16:57
Default
  #5
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
You're probably right! There's something wrong with the dimensions of the cylinder.


Thank you!!
lovecraft22 is offline   Reply With Quote

Old   June 23, 2010, 12:05
Default problem modelling surface with snappy
  #6
New Member
 
Silvia Di Francesco
Join Date: Jun 2010
Posts: 9
Rep Power: 16
gija79 is on a distinguished road
Hi everybody,
i'm trying to build a mesh with the snappyhexmesh utility.
I want to model the flow over a submerged island, but snappyhex seems to fail in snapping to island surface.
I want to use the InterFoam solver.

Maybe I did'nt prepare the dict file well, but the resulting mesh is very poor.
I prepared the background mesh with blockmesh.
This is my blockmesh file:

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

convertToMeters 1;

vertices
(
(0 0 0)//0
(300 0 0)//1
(300 85 0)
(-170 85 0)//3
(-170 0 1)
(300 0 1)//5
(300 85 1)
(-170 85 1)//7


);

blocks
(
hex (0 1 2 3 4 5 6 7) (300 85 1) simpleGrading (1 1 1)

);

edges


);

patches
(
patch inlet
(
(0 4 7 3)
)
patch outlet
(
(1 5 6 2)
)
wall bottom
(
(0 4 5 1)
)
patch atmosphere
(
(3 7 6 2)
)
);

mergePatchPairs
(
);

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

This is the snappyhex dict file:


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

refinementBox
{
type searchableBox;
min (60 20 -0.1);
max (98 27 1.1);
}
};



// Settings for the castellatedMesh generation.
castellatedMeshControls
{

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

// While refining maximum number of cells per processor. This is basically
// the number of cells that fit on a processor. If you choose this too small
// it will do just more refinement iterations to obtain a similar mesh.
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 2000000;

// 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 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 "someLine.eMesh";
// level 2;
//}
);



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

// Resolve sharp angles
resolveFeatureAngle 30;


// 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
{
coral
{
mode distance;
levels ((0.01 6)(0.1 5) (0.5 4) (1 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 (75 35 0.5);
}



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

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

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

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



// Settings for the layer addition.
addLayersControls
{
relativeSizes true;

// Per final patch (so not geometry!) the layer information
layers
{
coral_bottom
{
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.
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.
nGrow 1;


// Advanced settings

//- When not to extrude surface. 0 is flat surface, 90 is when two faces
// make straight angle.
featureAngle 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
minMedianAxisAngle 130;

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

// Overall max number of layer addition iterations
nLayerIter 50;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
//- Maximum non-orthogonality allowed. Set to 180 to disable.
maxNonOrtho 65;

//- Max skewness allowed. Set to <0 to disable.
maxBoundarySkewness 20;
maxInternalSkewness 4;

//- Max concaveness allowed. Is angle (in degrees) below which concavity
// is allowed. 0 is straight face, <0 would be convex face.
// Set to 180 to disable.
maxConcave 80;

//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;

//- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13;

//- Minimum face area. Set to <0 to disable.
minArea -1;

//- Minimum face twist. Set to <-1 to disable. dot product of face normal
//- and face centre triangles normal
minTwist 0.02;

//- minimum normalised cell determinant
//- 1 = hex, <= 0 = folded or flattened illegal cell
minDeterminant 0.001;

//- minFaceWeight (0 -> 0.5)
minFaceWeight 0.02;

//- minVolRatio (0 -> 1)
minVolRatio 0.01;

//must be >0 for Fluent compatibility
minTriangleTwist -1;


// Advanced

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


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


// ************************************************** *********************** //
and finally in attachment the stl file (in binary and ascii).
Can anybody help me?
I also tried to use gmsh to build the mesh but I'm not able to do a 2D case .
I make a 3D case but the mesh is too irregular for OpenFoam.
Thank you in advance
Silvia
Attached Images
File Type: jpg Schermata.jpg (36.6 KB, 33 views)
Attached Files
File Type: zip triSurface.zip (4.7 KB, 7 views)
gija79 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
Convergence problem in very simple body woodwax FLUENT 5 October 16, 2018 14:20
Blunt Body Problem Iqrar.Raza Main CFD Forum 0 April 27, 2016 02:04
Solid body 2-axis Rotation Problem hongsuny2333 CFX 3 December 30, 2015 05:37
convergence problem / bluff body / k omega LM4112 OpenFOAM Pre-Processing 3 June 16, 2013 07:28
[ICEM] wing body tutorials, problem zxin ANSYS Meshing & Geometry 8 March 22, 2011 02:05


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