CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   refinementBox in snappyHexMesh (

Ivanet October 29, 2010 10:23

refinementBox in snappyHexMesh
I am new to OpenFoam and snappyHexMesh. I am trying to do my first grid with sHM and have the following problem: I define the limits of my refinementBox in the snappyHexMeshDict file, then run sHM and then see the grid in ParaView. The refinement is done correctly but only in the directions X and Y. In the Z direction I can not see any refinement. Is this a problem of sHM or of ParaView or something different?
Thanks a lot for your advices.

subhkirti October 29, 2010 10:43

refinementBox in snappyHexMesh
Can you post the snappyHexMeshDict file?

Ivanet October 29, 2010 11:08

refinementBox in snappyHexMesh
Hi Subhkirti,
I am working with the motorbike tutorial. You can find bellow the snappyHexMeshDict file. As you see, at the moment I am only trying to refine the zone of the refinementBox (without the motorbike).
Thanks for your help.

// Which of the steps to run
castellatedMesh true;
snap false;
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
type triSurfaceMesh;
name motorBike;

type searchableBox;
min (-1.0 -1.0 0.0);
max ( 8.0 1.0 3.0);

// Settings for the castellatedMesh generation.

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

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

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

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

// {
// Surface-wise min and max refinement level
// level (3 4);
// }

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

mode inside;
levels ((1E15 1));

// 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 (3 3 0.43);
locationInMesh (1 0 0.5);

// Settings for the snapping.
//- Number of patch smoothing iterations before finding correspondence
// to surface
nSmoothPatch 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 4.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;

ziad October 30, 2010 15:12

why is this section commented out:

// {
// Surface-wise min and max refinement level
// level (3 4);
// }

by the way it is better to upload files as zipped attachments or wrap them in code tags. makes for a much cleaner and easier to read post.

Ivanet May 25, 2011 08:14

Upps, sorry. I had completely forgotten to update this post. Dear ziad, I commented out the motorbike in refinementSurfaces because I was only trying to see how the refinementRegions work. The reason why I could not see at that time the refinement in Z direction is that I did not do any slice with Paraview. Without the slice, it is not possible to see it. Well, it was just a beginners problem but I hope this can help someone else starting now with OpenFoam. Best regards Ivan

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