CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   How to set up a windtunnel in an OpenFOAM solver (http://www.cfd-online.com/Forums/openfoam-pre-processing/124784-how-set-up-windtunnel-openfoam-solver.html)

TommiPLaiho October 13, 2013 03:47

How to set up a windtunnel in an OpenFOAM solver
 
Hi,

I would like to test the aerodynamics of this car project. Its my design. :) It can be downloaded from
GRABCAD here:

https://grabcad.com/library/michelin...contest-2014-1

You need to login and register there in order to download the model. There is now also EnGrid file format and it should open correctly in EnGrid. Also an old .blend file is included.

I am a total newbie to CFD. I also do not have a formal education for CFD. I have a designer background.

I have understood that I need to setup the model inside a box in 1:1 scale. Furthermore the wind tunnel box has front as an inlet and back as an outlet. The other parts - also the car - are walls in most preprosessors like enGRID. But that's all what I know. In other words I do not know a lot.

Please help me with this project. I would like to make a video about streamlines and also get a valid CD figure for the car. All help appreciated. A good tutorial link might be good.

Few questions...

1. What kind of preprosessor is best for this kind of project?
2. How do I calculate CD value in OF?
3. How do I set up streamline analysis for this kind of model in OF?
4. What books/tutorials/links do you recommend to me which enlighten how to do this kind of test?

I am using CAELinux 2011. I like the release although GEEKOCFD might be more updated. I hope you can advice in many ways. Thanks in advance.

TommiPLaiho October 13, 2013 09:20

Hello again...

I decided to use Discretizer for my car analyze. I have been following this tutorial and trying to conclude how to apply these settings to car analyze.

http://www.discretizer.org/node/21

However when I press the run snappyHexmesh button the analyze locks ups as follows:

Quote:

Added patches in = 7.36 s

Selecting decompositionMethod hierarchical


--> FOAM FATAL IO ERROR:
keyword allowFreeStandingZoneFaces is undefined in dictionary "/home/tommi2/dis/system/snappyHexMeshDict::castellatedMeshControls"

file: /home/tommi2/dis/system/snappyHexMeshDict::castellatedMeshControls from line 65 to line 155.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting
I will also add this OpenFOAM file here:


Quote:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

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

class dictionary;
object autoHexMeshDict;
}

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

// Which of the steps to run
castellatedMesh true; // true;
snap false; // true;
addLayers false; // 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
{
surfacemesh.stl
{
type triSurfaceMesh;
name stlSurface;
}

refinementBox
{
type searchableBox;
min (0 0 0);
max (0.2 0.2 0.2);
}
};



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



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

// Resolve sharp angles
resolveFeatureAngle 15; // 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
{
refinementBox
{
mode inside; // inside;
levels ((1.0e+15 4)); //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 (1.05934 -0.0239827 -0.00447819);
}



// Settings for the snapping.
snapControls
{
//- 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;
}



// Settings for the layer addition.
addLayersControls
{
relativeSizes true; //true; // v 1.6
// Per final patch (so not geometry!) the layer information
layers
{
//minZ
//{
// nSurfaceLayers 3;
//}
stlSurface_patch0 // a_surface_name
{
nSurfaceLayers 5;
}
}

// Expansion factor for layer mesh
expansionRatio 1.4; // 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.
//finalLayerRatio FINALLAYERRATIO; // 0.3;
finalLayerThickness 0.6; // 0.3; // v 1.6

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


// Advanced settings

//- When not to extrude surface. 0 is flat surface, 90 is when two faces
// make straight angle.
featureAngle 179; // 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 // v 1.6
nLayerIter 50; // v 1.6
}



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


// ************************************************** *********************** //
Now do you have any clue what kind of settings I should have in order to analyze this car. All help appreciated and thanks in advance.

cfdivan October 13, 2013 09:59

Hi Tommi,

As soon as you have a good *stl of your model, I'll recomend you to follow the Motorbike tutorial in OpenFOAM.

You should be able simulate your model quite straightforward just by pasting your stl model in the folder Trisurface. Some adjustments will be needed, but not that complicated.

As you might start to change your files you can end up making mistakes...for safety reasons make a copy of the original tutorial folder and work on that one.

Regards,

elvis October 14, 2013 03:43

Hi,

there is some training material
Generic external aerodynamic simulation training; T. Grahs
http://sourceforge.net/projects/open...ningSlides.tgz

http://sourceforge.net/projects/open...ngMaterial.tgz

TommiPLaiho October 14, 2013 13:16

Thank you for help! :)

TommiPLaiho October 23, 2013 12:19

2 Attachment(s)
Hi,

Many thanks for help, I have progressed and I have been able to do at least some kind of wind tunnel analyze. Please look the images included.

However I would like to see much more streamlines in the paraview. So please let me know how add the amount and accuracy of the streamlines. Furthermore I would like to know where I find the Cd value of this tested car of my design in paraview if that is possible. Also lift value is a curiosity.

In general I would also like to see the coloured car where I can see the pressure points of the airflow. I hope you understand what I mean. I also would like to animate the streamlines in Blender and create such an image where streamlines are like real smoke in a wind tunnel.

Also if you have some ideas how to improve the realism and accuracy of the analyze please tell. All critics is most welcome without that I cant improve in the art of aerodynamics.

Jake87 November 17, 2014 07:56

Which adjustments does I need?
 
Quote:

Originally Posted by cfdivan (Post 456664)
Hi Tommi,

As soon as you have a good *stl of your model, I'll recomend you to follow the Motorbike tutorial in OpenFOAM.

You should be able simulate your model quite straightforward just by pasting your stl model in the folder Trisurface. Some adjustments will be needed, but not that complicated.

As you might start to change your files you can end up making mistakes...for safety reasons make a copy of the original tutorial folder and work on that one.

Regards,

Hi cfdivan,

i'm working with openFoam since a few weeks and made a few tutorials. Now i'd like to include my own geometry as a .stl file. I copied my "geo.stl" file into triSurface, changed the file name in snappyHexMeshDict from motorBike.obj to geo.stl and made a comment # in the .Allrun file in front of
"cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/"

What else does i need to change to make it work?

Because at the moment, if i try to run ./Allrun or just blockMesh it ignores my .stl-file. Maybe i'm completely on the wrong way, because i'm still beginner and don't understand all steps.

Thanks

btw: os: Ubuntu 13.10, openFoam 2.3.0


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