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

[snappyHexMesh] New on OpenFoam and already lost...

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Phizz82

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2013, 11:48
Default New on OpenFoam and already lost...
  #1
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Hallo everyone!
I' m a very beginner in CFD, OpenFoam and Linux!

I have to analyze the air flow around a Foil (NACA 0010 ) as part of my thesis.

The aim is to write a numerical model to study the airflow around the foil and then compare the results (cl,cd,cm etc.) with the experimental ones...the matter is that i don't know where to begin since i've never done anything like that!

i thought i could start drawing the foil with a cad software (Catia...?) using these points :

http://airfoiltools.com/airfoil/deta...il=naca0010-il

Than import the part as an .stl file, and try to mesh it crating a block with blockMesh and than refine it with snappyHexMesh...Unfortunately I have no idea how to compile the bloskMeshdict and the snappyHexMeshdict....

Does anybody has any suggestion? I'm lost and any help would be greatly appreciated!
Paolo.F is offline   Reply With Quote

Old   August 29, 2013, 08:46
Default
  #2
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17
markusrehm is on a distinguished road
Hi Paolo,

so start learning OpenFOAM with the tutorials and the users guide. Check the Allrun-scripts which show you what to do step by step.

An example for an airfoil you can find in

tutorials/compressible/sonicFoam/ras/nacaAirfoil

the procedure for using snappyHexMesh is well presented in the motorBike example.

Good Luck. Markus
markusrehm is offline   Reply With Quote

Old   August 29, 2013, 09:47
Default
  #3
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Dear Paolo,

Besides the hints you got from Markus I have some advise
for you concerning meshing a NACA Profile:

This can be easily done with excell and
blockMesh once you have an offset table
(Assuming you are working in 2D)

For further hints see here:
http://www.cfd-online.com/Forums/ope...tml#post333767

in post five you find an example blockMesh from me
but the whole discussion should be fruitful for your work.

Using snappyHexMesh and Catia is way to complicated in my opinion
for such a simple task.

I hope I could help you

regards
Colin
colinB is offline   Reply With Quote

Old   August 29, 2013, 11:12
Default
  #4
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Dear Markusrehm and colinB,
Thanks a lot for your responses you have been very helpful!

At the moment i'm studying the official user guide to try to understand how OF in structured...it seems to be quite complicated! I will surely try the tutorials you have suggested me!

Colin, my analisys is supposed to be done in 3D. Do you think it is useful to make it in 2D to understand the procedure and than repeat it in 3D? Or they are two different, and not related, things?

Thanks again

regards,
Paolo
Paolo.F is offline   Reply With Quote

Old   August 30, 2013, 04:33
Default
  #5
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Hey Paolo,

concerning 2 or 3D:

the results will differ of course, but as you mentioned it might be a good
starting point to begin with a 2D calculation and piecewise adjust
all parameters until you have a fully developed 3D calculation.
This helps to understand OF and to insure the right boundary settings.
e.g. in 2D you don't have to focus on wall effects but can purely focus
inlet and outlet (at least when you are calculating with an inclined flow).

I'm also not sure whether your profile is changing its cross-section
in the third dimension, dependant on that the step from 2D to 3D is
easy or not (a constant cross section can easily be done in blockMesh).

I hope my explanations are clear
regards
Colin
colinB is offline   Reply With Quote

Old   August 30, 2013, 05:51
Default
  #6
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Hi Colin,
Your explanation was great! This week I ll try to follow your suggestions and than i ll pass to the nacaAirfoil and motorbike tutorials as Markus suggested.

Thanks a lot guys!

Regards,
Paolo
Paolo.F is offline   Reply With Quote

Old   August 30, 2013, 06:17
Default
  #7
New Member
 
Philip Brown
Join Date: Jun 2013
Posts: 25
Rep Power: 13
Phizz82 is on a distinguished road
When getting used to aerofoils, I found this tutorial quite useful. I've been using GMsh rather than the other meshers suggested thus far. Hope this helps.
tareqkh and fportela like this.
Phizz82 is offline   Reply With Quote

Old   August 31, 2013, 05:07
Default
  #8
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Hi Phizz82,
Thanks a lot for the tutorial! It's going to be very useful to me.
There is still something i can't understand...if i don't draw the foil with a cad software (2 or 3D) how can I get the geometry?

Thanks again to everyone!
Paolo.F is offline   Reply With Quote

Old   August 31, 2013, 05:35
Default
  #9
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hallo,

This website is also pretty helpful for the creation of the computational mesh. There are a few number of control variables, and the user have to specify a set of coordinates along the airfoil.

http://www.hvirvel.dk/airfoilmesher/

Kind regards

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   August 31, 2013, 05:40
Default
  #10
New Member
 
Philip Brown
Join Date: Jun 2013
Posts: 25
Rep Power: 13
Phizz82 is on a distinguished road
I don't know how snappyHexMesh work so I've used Gmsh to make my aerofoils. I started by putting in all the points from a .dat file provided and splined them all together. I the made a box around the foil, made a plane surface with the aerofoil as a hole boundary before extruding that boundary. I then made the surfaces into a volume before labelling my physical surfaces amd volume. Seemed to give some reasonable answers.
Phizz82 is offline   Reply With Quote

Old   September 1, 2013, 05:44
Default
  #11
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Dear Niels and Philip,

thanks for your hints! I hope that next week i'll be able to do something....(I can't use the college computers during the weekend)

regards,
Paolo
Paolo.F is offline   Reply With Quote

Old   September 3, 2013, 07:25
Default
  #12
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Hallo everyone!

I have decided to make the analisys in 3D since i've been able to draw the airfoil in Catia.
This is my blockMeshDict file:

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

convertToMeters 100;

vertices
(
(-10 -40 -10) // 0 il punto 0 è l'origine degli assi
(10 -40 -10) // 1
(10 40 -10) // 2
(-10 40 -10) // 3
(-10 -40 10) // 4
(10 -40 10) // 5
(10 40 10) // 6
(-10 40 10) // 7
);

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

edges
(
);

boundary
(
inlet
{
type patch;
faces
(
(0 1 5 4)
);
}

outlet
{
type patch;
faces
(
(2 3 7 6)
);
}

top
{
type patch;
faces
(
(4 5 6 7)
);
}

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

right
{
type patch;
faces
(
(2 6 5 1)
);
}

left
{
type patch;
faces
(
(3 0 4 7)
);
}
);

mergePatchPairs
(
);


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


I had to set covertToMeters to 100 to obtain a block big enough to contain my foil...this is strange because i'm sure my foil is approximately 1mx1m. Why it becomes that big ?!


At the moment i've set all the boundaries as "patch" in the blockMeshDict. Is it necessary to set them properly ( in terms of boundary conditions. for exampre " wall" if I want to lay down a no-slip condition ) in the blockMeshDict or I can change them in the P,U files?

I hope I have been clear...

thanks a lot,


Paolo

Last edited by Paolo.F; September 3, 2013 at 12:05.
Paolo.F is offline   Reply With Quote

Old   September 3, 2013, 09:46
Default
  #13
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Dear Paolo,

your question is very unspecific so it is very unlikely that anybody
can help you.

We would at least require an error message or problem description
in order to help you.

Here is a link to a thread which gives you some ideas on how
to properly formulate your questions:

http://www.cfd-online.com/Forums/ope...-get-help.html

I hope it inspires you

regards
Colin
colinB is offline   Reply With Quote

Old   September 3, 2013, 10:47
Default
  #14
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Sorry for that! I will write it properly

paolo
Paolo.F is offline   Reply With Quote

Old   September 4, 2013, 03:20
Default
  #15
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 19
colinB is on a distinguished road
Dear Paolo,

1) concerning convertToMeters:

If you have specified your profile in mm even when it is
1m x 1m you would have to write the points in a magnitude
of 1000 x 1000 to fit it in.

2) the base patch types are: patch, wall, symmetryPlane, empty etc.
for more details see here:

http://www.openfoam.org/docs/user/boundaries.php

To understand how blockMesh works in detail I can recommend
you to read the users documentation (see link below):
http://www.openfoam.org/docs/user/bl...#x25-1420005.3
where all the parameters of a blockMeshDict file are explained very
good.

kind regards
Colin
colinB is offline   Reply With Quote

Old   September 4, 2013, 07:41
Default
  #16
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Dear colin,
thanks for your reply! So I need to draw something in meters instead of in mm to get the right dimentions...
thanks again for the hints!

regards,
Paolo
Paolo.F is offline   Reply With Quote

Old   September 6, 2013, 10:18
Default
  #17
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Hallo everyone!

i'm trying to mesh properly my airfoil using snappyHexMesh, but I'm not able to add the layers...

I've created a cube ( I know it's not the proper shape for simulating the airflow around the foil, but I will change it...) around my foil with blockMesh with not to many cells; this is my blockMeshDict:

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

convertToMeters 1000;

vertices
(
(-2 -2 -2) // 0 il punto 0 è l'origine degli assi
(2 -2 -2) // 1
(2 2 -2) // 2
(-2 2 -2) // 3
(-2 -2 2) // 4
(2 -2 2) // 5
(2 2 2) // 6
(-2 2 2) // 7
);

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

edges
(
);

boundary
(
inlet
{
type patch;
faces
(
(0 1 5 4)
);
}

outlet
{
type patch;
faces
(
(2 3 7 6)
);
}

top
{
type symmetryPlane;
faces
(
(4 5 6 7)
);
}

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

right
{
type symmetryPlane;
faces
(
(2 6 5 1)
);
}

left
{
type symmetryPlane;
faces
(
(3 0 4 7)
);
}
);

mergePatchPairs
(
);


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





Than I tryed to refine the mesh with snappy, using also a refinement box around the foil.
here is my snappyHexMeshDict:





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

NACA0010-2.stl
{
type triSurfaceMesh;
name NACA;
}

//inlet.stl
// {
// type triSurfaceMesh;
// name inlet;
// }

//outlet.stl
// {
// type triSurfaceMesh;
// name outlet;
// }

//ground.stl
// {
// type triSurfaceMesh;
// name ground;
// }

refinementBox
{
type searchableBox;
min (-650 -250 -350);
max ( 650 1250 350);
}

};



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

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

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


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


//galleria
//{
// Surface-wise min and max refinement level
// level (1 2);
//}

//ground
//{
// Surface-wise min and max refinement level
// level (1 2);
//}

//inlet
//{
// Surface-wise min and max refinement level
// level (1 2);
//}

//outlet
//{
// Surface-wise min and max refinement level
// level (1 2);
//}
}

// Resolve sharp angles
resolveFeatureAngle 30;//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 inside;
levels ((1E15 3));
}
}


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

allowFreeStandingZoneFaces false;

}



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

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

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

nFeatureSnapIter 10;

}



// 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
{
NACA
{
"flange_.*" {nSurfaceLayers 100;}
}
}

// Expansion factor for layer mesh
expansionRatio 1.2;

//- 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.2;//0.2

//- 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;//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;//90,180

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

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

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

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

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

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

// Angle used to pick up medial axis points
minMedianAxisAngle 80;//80

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

// Overall max number of layer addition iterations
nLayerIter 50;//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 90;//90

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

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

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

//- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minVol 1e-17;
minTetQuality 1e-30;


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

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

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

//- minFaceWeight (0 -> 0.5)
minFaceWeight 0.02;//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;


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


this is what i get (third step):

http://imageshack.us/a/img821/9537/rujm.png
http://imageshack.us/a/img580/6283/0d0h.png
http://imageshack.us/a/img801/8845/6ryk.png
http://imageshack.us/a/img607/5206/b0lm.png
http://imageshack.us/a/img838/73/vvpu.png
http://imageshack.us/a/img13/2606/xho7.png


I have set the parameters following the OF Guide and a tutorial about another naca.

Does anybody has any suggestion? any help would be greatly appreciated!

Paolo
Paolo.F is offline   Reply With Quote

Old   September 16, 2013, 06:48
Default
  #18
New Member
 
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13
Paolo.F is on a distinguished road
Hallo everyone!
I've finally been able to manage the problem..now I have a decent mesh with 6 layers around my foil ( I still have a gross mesh near the tail...and I don't know how to refine it).

At the moment i'm trying to improve the results I get from simpleFoam ( they're not so bad anyway).

Does anyone can suggest my any article where I can read about the SST k-omega model and learn to set the k - omega parameters for the solver?

thanks a lot,
Paolo
Paolo.F 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



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