CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing & Mesh Conversion (
-   -   Mesh generation for Wind Tunnel (

terrybarnaby May 2, 2008 16:15

Hi, I am trying to use Open

I am trying to use OpenFOAM/paraview to implement a simple virtual wind tunnel for testing a Greenpower electric racing car. I have got a simple 3D case to work from a 3D example with a cube in the airflow from and example in an OpenFOAM forum.
Now I need to be able to create a suitable mesh from a CAD packages STL file. I have created some simple meshes using netgen however I need to generate and "inverted" mesh, ie one with a hole where the STL surface is.
Does any one know of a simple way I can achieve this ?



fra76 May 3, 2008 12:20

That's a good question. You n
That's a good question.
You need a meshing tool that fits your needs/experiences. There are a lot of commercial softwares, like ANSA, Tgrid or Harpoon, for example. On the free software side, I don't know anything really complete yet.
What I can say is that OpenFOAM is a really good tool for this kind of applications!


terrybarnaby May 3, 2008 14:53

I need to do this on the cheap
I need to do this on the cheap as the Greenpower electric car racing is for secondary schools in the UK where pupils and the parents design, build and race electric cars.

I was hoping I could create a mesh as follows:
1. Create a simple car design using Pro/Designer CAD or Blender and export the design as an STL file.
2. Use blockMesh to generate a basic wind tunnel mesh with inlet and outlet with an appropriate number of blocks.
3. Use the cellSet utility to remove the cells from the wind tunnel inside the CAD STL surface.
4. Use cellSet ? to create a named patch (wall ?) from internal STL surface.
5. Use this resulting mesh with the turbFoam solver.

I am new to this. Is this sort of approach likely to work (I only need basic results, accuracy is not required) ?
If so any pointers on how to do this ? I have managed to generate the wind tunnel mesh and have removed the inside of the STL surface. The documentation for the mesh utilities seems very spartan ... I am unclear on:

1. How to set the default mesh from the mesh and the cell sets created. I have used subsetMesh and then copied the "0.005" directory created over "0". Is there a correct way to do this ?

2. How to create the named patch/walls for the internal STL surface.



mattijs May 6, 2008 16:19

1. Yes. Or just set system/con
1. Yes. Or just set system/controlDict to latestTime. It will read the mesh from 0.005 instead of constant.

2. Not terribly easy. For simple geometries use autoPatch. Determines regions closed by feature edges (based on feature angle) and puts every region into a different patch.

Alternatively create a single surface (e.g. STL) with multiple regions ('solid' for STL). Use surfaceToPatch to take over the region information as patch information.

terrybarnaby May 7, 2008 04:36

Thanks for the info. I have m
Thanks for the info.
I have managed to create a basic block mesh and
have created a single wall for the entire STL surface using the "oldInternalFaces" boundary generated by cellSet and changing its type to "wall" renaming it to "car" using simple text editing. This appears to work and I see some results from my OpenFOAM VWT simulation although the blockMesh is very coarse ...

For other peoples information my current case (although probably wrong ) is at:

I am now trying to refine this mesh using autoRefineMesh. Issues with this are in the "Recommended way of generating mesh from cad" thread ...



jaswi May 7, 2008 04:57

Hi Terry Thanks for provid
Hi Terry

Thanks for providing the test case for others to learn. I have downloaded your case and will go through the steps you have executed.

Might lead to some questions ;-).

Thanks once again !!


terrybarnaby May 7, 2008 05:08

Hi Jaswi, Don't thank me ye
Hi Jaswi,

Don't thank me yet. I am a complete novice and what I have done could be completely wrong ...



terrybarnaby May 7, 2008 06:05

Hi Jaswi, I have placed my
Hi Jaswi,

I have placed my current test case for the VWT for simulating our car at:

It is setup to use a cube as the default object although there is also an STL file for our car in the test case as well that can be used.

This provides a more reasonable test case than my meshTest2 example that might be of more use to

It is still probably completely wrong though ...



markc May 9, 2008 18:13

Terry/ Foamers, You might b
Terry/ Foamers,

You might be a newbie but you brought me to fresh ideas regarding creating meshes.
I tried your case, am specially interested in the method of cutting some form in a full blockMesh using (e.g.) a stl file.
Your case: cellSet failed on my computer. I have OF 1.4.1. Did it actually succeed on your computer (I mean: using surfaceToCell and a stl file)?
First I get a warning:cannot find bounding box for zero sized pointFieldreturning. Next a lot of errors:
Foam fatal error ===> could not find (0 0 0) in octree and next a lot of #0... #1..., without any clues for me.
So I am curious whether you actually succceed?
Compliments for your work already and for sharing it,


terrybarnaby May 10, 2008 03:11

Yes, I believe I have succeede
Yes, I believe I have succeeded in creating a basic VWT. Mattijs Janssens helped in the "Recommended way of generating mesh from cad" forum subject by fixing a problem in the autoRefineMesh program. This source needs to be compiled within the OpenFOAM tree. I am using the OpenFOAM-1.4.1_patch SVN sources although I think it worked with the standard OpenFOAM-1.4.1 sources as well.
My test STL files and there Blender sources are in the following test case. Note that the VWT is sized (-4, -2, 0) (4, 2, 3) and that the object has to be within that space. Also, I suspect, that there should be one STL volume with no holes or breaks. I guess you error message relates to a very small sized bit of STL surface on its own somewhere in your CAD STL file ...

My current test case is at:

Note that this could be completely wrong (but it does give nice pictures (in the test case archive) ! ...

markc May 10, 2008 12:44

Hi Terry, Thanks for the repl
Hi Terry,
Thanks for the reply. I got those errors on your testcase and on ny testcase. I get them both using the cellset and autorefine, exactly the same. Unfortunately I do not know how to copy the error messages here. However it seems it has something to do with toposetsource.
The final error message is: From function octreeDataTriSurface::getSampleType(octree<octreed atatrisurface>&, const point&)
in file triSurface/octreeData/octreeDataTriSurface.C at line 348.
I will try your recommendation regarding OF patch. This seems as a reasonable explanation about what went wrong.



markc May 10, 2008 15:15

Update: I tried the autoRefine
Update: I tried the autoRefineMesh patch but without result. I got the same errors with respect to octreeData.
Any ideas?


terrybarnaby May 12, 2008 05:37

Hi, I notice that in my vwt

I notice that in my vwtTest2.tar.gz example I had set the default STL file to car-2.stl. This is the
STL file I am having problems with at the moment.
If you edit the Makefile to use cube.stl or car-1.stl it works Ok here. I have updated the vwtTest2.tar.gz test case to use cuve.stl as the default STL object.

My current status is that with a more complex STL file (car-2.stl) I get "multiply connected surface"/"Writing 12 conflicting points to set nonManifoldPoints" warnings/errors? from checkMesh. When this happens a run of the solver will crash.
This error seems to be introduced when subSetMesh is run ...

terrybarnaby May 12, 2008 16:52

Although I have got a mesh gen
Although I have got a mesh generated for a virtual wind tunnel with a simple STL object in it, I am having problems with a slightly more complex object.
In my vwtTest2.tar.gz example, when meshing the car-2.stl object, I get a warning or error? in checkMesh: "multiply connected surface" followed by "Writing xxx conflicting points to set nonManifoldPoints". Running the simpleFoam solver results in a crash. The mesh error seems to get introduced when I use subsetMesh to remove the cells within the STL object. This creates a set of faces and patch for the boundary between the wind and STL object. I have been playing around with the original blender object, with autoRefineMesh settings and other things with no success.

1. Can anyone enlighten me what these errors mean and where to look for the problem ?
2. Is there a better way to take out the STL objects cells and create the wall patch for the STL object ?
3. Is there a good tool to look at the resulting mesh and the "nonManifoldPoints" ?



terrybarnaby May 13, 2008 06:13

I have managed to get my mesh
I have managed to get my mesh better, simply by making autoRefineMesh refine the blocks more.
I have changed the solver parameters and the turbulence model and now I get results.
If these are reasonable, I have no idea as yet.

For peoples info my current test case is at:



fabrizio December 11, 2008 04:38

Hi dear foamers I'm also wo
Hi dear foamers

I'm also working on a wind tunnel project, and I use snappyHexMesh to create the mesh starting from BlockMesh and the stl geometry.
I must use icoFoam and all is fine. My problem is how to extract the pressure insisting on the wall that represents my object.

Can you help me?

Thanks to all


lhcamilo December 11, 2008 11:34

Hi fabrizio, I am working
Hi fabrizio,

I am working on a similar project, I have been trying to build a windtunnel for a car model, with a moving "road" patch underneath the model.

What sort of wind tunnel are you building?

As for your question, I have been trying to do something similar, I guess you should take a look at the sampleDict function(eg present at the User manual's stress plate case). That means that you may have to create extra patches from your geometry. The easiest way I have found so far was to use salome-meca (ready to use at the CAE Linux live CD).

It is able to import igs and step then can use the explode feature to separate them surfaces or cut them yourself, assemble them in a group and then export them as a separate .stl, which you can then associate as a patch which you may extract the pressure from (Also add different boundary conditions to).

There may be an easier way but so far this is the way I have found.

good luck


fabrizio December 12, 2008 11:13

Hi Leo, I found all I need
Hi Leo,

I found all I need after converting all the simulation in Paraview; the converter create a .vtk file for each patch including points, cells and pressure. Infact Snappy add automatically a patch related to the stl geometry. I'm studying the deformation due to the interaction of fluid-structure for an object invested by a flux.

Thank you


a_yoshi November 12, 2009 02:32

vwtTest1,vwtTest2 and vwtTest4 in OpenFOAM 1.6
Dear Sir,

I 'Ve tried to run vwtTest1,vwtTest2,vwtTest4 in OpenFOAM 1.6.
But I got the errors to run both programs.

If anyone know the final version of these program,
I'm very appriciated.

Regards, yoshi

mahaputra November 12, 2009 04:13


Originally Posted by a_yoshi (Post 235937)
Dear Sir,

I 'Ve tried to run vwtTest1,vwtTest2,vwtTest4 in OpenFOAM 1.6.
But I got the errors to run both programs.

If anyone know the final version of these program,
I'm very appriciated.

Regards, yoshi


Hi Yoshi

as it mentioned by Terry

he run the cases by OpenFOAM-1.4.1.



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