CFD Online Discussion Forums

CFD Online Discussion Forums (
-   ANSYS Meshing & Geometry (
-   -   [ICEM] Generating Mesh for STL Car in Windtunnel Simulation (

tommymoose August 29, 2009 00:30

Generating Mesh for STL Car in Windtunnel Simulation
This will be a relatively lengthy thread, so here is some background. I'm working on a senior capstone project in the area of vehicle aerodynamics. The product I'll eventually be designing will be based largely on proving concepts and refining through CFD using Fluent. I downloaded an STL file of our test-car, a Porsche 997 GT3 RS, from a CAD data site. I'm using ICEM for pre-processing as my professor told me it is the best program we have for the job. I have quite a bit of screen-time using ANSA for surface meshing from a past internship, however working with ICEM is a completely new experience. The rest of what I'll post is questions I've had along with answers that Simon P. has been nice enough to answer. I'll continue to build on this thread as I have questions, hopefully get answers, and maybe some other students will be able to learn from it too!

Me: If I'm going to run the Octree mesher, do I need my entire model to be all red lines (connected surfaces) or can it approximate enough based on the surfaces?

Simon: No, you don't need all red lines. The mesher will still walk over gaps smaller than the mesh size even if you have yellow lines... However, having two yellow lines close together may cause the mesher to refine down and then give leakage, so I recommend deleting one of the two edges... Or just delete any curves that do not capture a feature that interests you (don't forget about points). Some items may end up with the same volume on both sides, this will cause them to disappear unless you mark them as internal walls in the params by parts popup... Marking them as internal walls will allow the mesher to keep them (like baffle surfaces) even if you car leaks...

Me: Is there a way to hide sections of the model so that its easier to view and move around? My STL file came in as one part, so I don't have the option of hiding parts yet and I'm trying to pick and choose to separate out parts.

Simon: You can blank surfaces, etc. but the easiest way is to simply put things into parts and then turn off parts you don't need to look at any more... You can group parts into assemblies to make it easier to turn off groups of parts, etc.

Me: Can you recommend a plan of attack for getting this geometry prepared to a state that I can run the Octree mesher? All I need are the exterior surfaces, and its going to be closed-grill, so no engine bay prep.

Simon:If you don't need the internal stuff (seats, etc.) just delete what ever you can. If something will cause any trouble or is difficult to delete it, then don't worry about it. The octree mesher refines and fits to all the geometry before it does the flood fill to determine what you want to keep, so... Set large sizes on interal items so it won't waste time refining for them. Removing items saves both the hassle of refining and the time to fit to the geometry... Then, if it looks more or less closed and you are near the end of the day, may as well set it off meshing when you go home... In the morning it may be done... If parts are missing, try the "internal wall" setting. If you get a leakage message, you can usually see where it is happening. It may be something you will want to fix or perhaps you just need to delete a curve or make the mesh size bigger.

My usual plan of attack is just to break the geometry up into parts (wheels, hub, windows, mirrors, bumpers, etc.) Along the way you are investigating the model, deleting bits you don't need, etc. If you see holes, close them. I acutally tend to convert the geometry to mesh and use the mesh editing tools to close holes because they are just a bit faster than the faceted repair tools, then I delete the geometry and convert the mesh back to facets (geometry). THis is all under the edit menu. I get the geometry more or less closed... (If you are starting with the nice mesh you got out of ANSA, you have already done this work and can probably just go right to meshing). Then I build a box around it, intersect the tires with the road, create a material point, double check my Part and Global parameters, and mesh it... Then I often delete the octree volume mesh and check the surface mesh for multiple edges, single edges, etc. It is easier to edit without the volume mesh, plus the Octree mesh isn't my favorite. Then I close and repair anything that I find. Then smooth like crazy with the laplace option. Then I do a tetra fill with deLaunay (I like the TGlib beta option). Then I run prism. Then I smooth with prisms frozen... Run final diagnostics and checks... Out to solver.

tommymoose August 29, 2009 00:36

Me: I spent a few hours simplifying and grouping the geometry. Since it all came from an STL file, it came in as one part and I couldn't separate out different surfaces. I had to run the "build diagnostic topology". Once I did this it added curves and broke up the surfaces enough to sort. I have more time than I do troubleshooting skills, so I went ahead and deleted pretty much all of the interior geometry. The wheels were a mess, so I deleted them and will remake a simplified version of them in solidworks and re-import as an iges (as I understand octree can handle STL and IGES in the same project).

I was deleting surfaces all along, and I'm not sure if I'm supposed to go through and delete all of the curves and points too. I was thinking I could delete all of them, and then re-make the important ones via "extract curves from surface"... would you recommend this?

Simon: Doing the wheels in IGES and importing them is a good idea, and yes, it is no problem to combine geometry formats in ICEM CFD.

Also, now that you have deleted all the interior surfaces, you can go to the geometry tab and delete curves, select all. Then delete points, select all. Then recreate these with the build topology tool. Build topo tool will create one curve between surfaces. Extract curves from surface will create a curve around the perimeter of each surface which usually means 2 curves between adjacent surfaces... Therefore, Build diagnostic topology is better.

Me: I'd like to simplify the geometry a bit... for example I deleted the emblem on the hood and now there is a hole so I want to fill it. However, there are no curves on the hood surface because they all belong to the original import part still, and I can't convert to a mesh to clean up the geometry (because I'm already in STL). Should I recreate curves on the surface like I mentioned above, then fill? What would you do?

Simon: For operations like closing the hole in the hood, you have lots of options. You could build topology and try to close the hole after it extracts curves. You could also go to the geometry tab and look for the faceted repair tools. There is one that lets you select the facet edges and fill to close the hole. If I had only a few issue, and I had already sorted out a bunch of sizes, etc. that is what I would do. If I had a ton of faceted repair work to do and didn't mind giving up on any geometry settings, I would use the Edit menu to convert facets to mesh... then I would use the edit mesh options (with surface projection off for closing that hole) to repair a bunch of issues. Then, you deleted the faceted geometry and go back to the Edit pull down to convert the mesh back to facets. During this process, it will ask if you want to build in sharp features, this is like build topo, so say yes. Then it will ask to merge close nodes, I usually say no.

Me: In PowerFLOW, I believe the volume mesh generation and simulation are all completed after the job is submitted to the cluster. In contrast, in ICEM, I generate the volume mesh first and then submit the simulation. Does this lead to memory issues when generating the volume mesh on a big file like this if I'm working on my home computer? I have access to a cluster and realize I may need to use it for the simulation, but is it common to use it for the mesh generation? For reference, I have a 2.4gHz Quad-Core processor w/ 4GB of RAM... a decent machine but I'm not sure what its capable of doing in ICEM.

Simon: If your machine is 32 bit, then it can really only use about 2Gigs of memory for any operation... With ICEM CFD, that would limit you to about 12 million cells (uncut) by the time you toss out all the junk, etc. that is about 6 to 10 million... If you need much more, you can chop the model up and mesh it in sections...

If your machine is 64 bit, then you have access to more of the 4 gigs and your model size goes up linearly.

You may also benefit by using ICEM CFD hexa to mesh the tunnel and then just having tetra in a smaller region around the vehicle. You could then merge the two zones...

tommymoose August 29, 2009 00:42

Just a quick question on the geometry preparation before I get into the meshing questions. After converting facets to mesh, cleaning up the mesh, then converting mesh back to facets, do you delete the mesh so that all you have left going into the mesh computation is surfaces, curves and points? During the conversion process, it leaves a shell mesh on my screen which I'm not sure I want.

<Simon>Right, I convert the facets to mesh, fix the mesh, then delete the geometry. Then convert the mesh to facets and delete the mesh… then apply mesh parameters to the geometry, etc. and generate a mesh on the geometry. The exception is if your surface mesh from the facets looks better than you would get if you generated it in ICEM CFD… In that case, just use it as a surface mesh and generate the volume mesh “from existing mesh” with a bottom up method like DeLaunay Tetra.

I have 4GB of RAM on my 64-bit Vista OS, so I should be able to make use of all of it (whatever Vista isn't hogging that is :p ). I ran an initial mesh which came out to about 12.5MM elements. During the process of making it, I developed some questions. Because I have no idea really what my max element size or height, or width, or deviation, etc. should be, I set the maximum to 0 so that the program could decide what is best (per tutorial). I would have expected the mesh elements to get larger the farther from the surfaces, but it seems to be the same throughout. I didn't specify anything for any surfaces, mainly because I don't know whats important. Do you have any rules of thumb for choosing global and surface mesh parameters on a car? I know that in PowerFLOW, separate parts would be made of peices of surfaces that we would want higher resolution (I.E. windshield-cpillar-glass transition). Should I make areas like this (front lip) its own part so that I can assign a more fine surface mesh, or does that not really matter?

<Simon>I usually set the Max size to something large (and a power of 2) like 512 or 1024. Setting it to 0 should have worked if you had set sizes somewhere else, but if you don’t set any sizes, it probably poped up something asking if you wanted to set an auto size? This would divide the distance between Min XYZ and Max XYZ by 1000 and use that for the Max size. And yes, breaking the model up into parts is a good first step. Then you can easily adjust the mesh size to refine that front lip part, etc.

You said that you like to delete the octree volume mesh (essentially using it as a surface mesher?), and then do a Delauny off of that surface mesh. To save time, would you make the bounding box very tight around the vehicle so the computer doesn't have to spend time meshing the full volume of a "tunnel"? Then once you delete the volume mesh, you could create the tunnel you'll be using to solve with and then use Delauny or Advancing Front to fill in the volume?

<Simon>That depends… If the car were not touching the tunnel, then yes, I would do that. But if it were touching, then you would have the hassle of connecting all the surface elements where the wheels meet the road. Often I would just set a really big max size in the tunnel so it doesn’t waste time doing a fine mesh. I suggest a method for dealing with tunnels using the merge option.

Meshing a very large tunnel has its drawbacks in the time it takes to mesh and also solver. PowerFLOW would mesh progressively larger zones the farther from the vehicle, so that the outer regions would only compute every 64 times or something like that. Is there something like this in ICEM/Fluent?

<Simon>If you have access to TGrid, I could recommend taking the surface mesh of the vehicle from ICEM CFD and sending it to TGRID to use their “Hexa Core” option. This is a common process with our racing customers… And actually, I heard recently that UAV was doing it that way also. This will create the hanging nodes that you want and actually can give Cartesian hexas right to the wall in many cases.

As you can tell from the image, I got some leaking. I'll check for holes/gaps and close it up better before next try. I can't seem to find the internal wall option though. I would like to make the front lip jut down as a single layer surface, or a thin one at the most, but I imagine that without a setting like single-sided-wall or internal wall the mesh will ignore it and mesh right through it?

<Simon>Right, without the internal wall option, that front lip will just disappear (the mesher will think the surface was a mistake and do you a favor by removing it.) The solution is to look again for that internal wall option ;^). Go to the Mesh tab, 2nd Icon is “Params by Parts”. This menu allows you to set Mesh parameters by parts (as the name implies). Move over to the right and you will see checkbox options for “int wall” and “split wall”. I think you want “int wall”.

tommymoose August 29, 2009 00:46

Me: I'm having some trouble with the mesh, so I'll explain what I did. I converted the facets to mesh, cleaned it up and made it air-tight as far as I can tell. Then I converted back to facets and deleted all of the mesh shells, lines and points. At this point all I have left is the facets, and the iges geometry I imported (wing and wheels). When converting back to facets I built in the sharp features which left green curves all over the part. I followed your guidance and kept the tunnel full-size, put max element size to 512, and specified smaller sizes on the individual parts. I pretty much put 0.25 on all of the critical areas and 1 on the rest. When I meshed, the only thing it ended up meshing were the wheels, wing, and front-lip (which was set to interior wall), along with some random facets scattered around.

On a second try, I did the same thing, except this time I ran topology first so that it deleted the green/non-associated curves and replaced them with yellow and red curves. I experimented with different tolerance settings, but curves keep showing up where I wouldn't expect. I went ahead and meshed with the same parameters.

On a third try, I increased the global mesh size to 10, hoping it might mesh over any holes I could have left. I got similar results.

Simon: I can guess that you have the same volume material on both the inside and outside (you have an opening some where) and octree tetra is just ignoring the surface mesh on those parts because they are within the same volume.

1) You could force it to show you the hole by putting an ORFN material point in the CAR. When the flood fill runs and finds the inside, it will give a message about "Fluid.0 can reach ORFN.1" It will show a jagged line connecting the elements along the path between these two material points... THe line wil go right thru your hole. You will be able to close the hole or just keep the surface mesh...

2) Or you can trick it into keeping the surface mesh by going into the mesh tab => Params by parts, and turning on the "int wall" option for everything.

tommymoose August 29, 2009 00:49

Me: That first method worked to show me the hole! I meshed it overnight and when I woke up the jagged line went right through the seam between the tail light and quarter panel. If there are more than one hole will it show me that or does it only do one at a time? It's hard to detect this prior to volume meshing... Is there a way to show open holes before hand? Certain build topology settings?

Simon: The first method will show you only one jagged line (the first path of leakage)... but all the single edge holes will be outlined in yellow (single edges diagnostic). You can also turn on this diagnostic at any time by right clicking on "shells" in the model tree and choosing "diagnostic", then check the "single edges" box. (Note; don't leave this on all the time since it also limits selection to single edges...) I guess it can miss holes with double edges (like if you were running a model full of 3D parts and a whole 3D part (like the door) was missing, but it doesn't sound like you have that situation.

Me: Am I better off closing the hole or keeping the surface mesh? I'd guess for what I'm doing (deleting volume then delauny) I could just fix the surface mesh manually after I delete the volume... Yeah?

Simon: The decision about closing the hole (geometry level) or fixing the surface mesh is very subjective. If I have just one little issue or just a few issues with the mesh and regeneration would take over night, I would probably just fix the mesh (not remesh the whole thing). I might also fix the geometry if I thought there was a chance of remeshing later (refinement study or somthing). But if you see a bunch of problems that would be easier to fix at the geometry level, or missing important geometry detail, or mesh editing would take too long relative to remeshing, then I would work on the geometry level...

Me: I feel like there has to be some consequences of option number two. It seems too easy to just set everything as an interior wall? It may generate a nice surface mesh but the holes will still be intact... Is that a problem with delauny-ing from it?

Simon: Number two isn't awful... You end up with fluid inside and outside. This is a lot closer to real life and you will see that there is not much motion of the fluid in the vehicle unless you have an interesting gap that rams air inside... I guess you would be wasting computational time solving that space... Delaunay also doesn't mind it... (Delauany hates holes in the envelope, but holes inside are just baffles.)

But if I did #2, it would just be an intermediate step, like keeping only the surface mesh after floodfill. ICEM CFD mesh editing has lots of ways for me to diagnose and fix up my mesh... Sort out single edges, investigate multiple edges (make sure they are appropriate), sort out non-manifold verts, etc. and then run delaunay...

PSYMN August 29, 2009 10:27

Thanks for posting this email conversation for others...


tommymoose August 29, 2009 14:31

1 Attachment(s)
Thanks for all the help!

I plan on using the car for multiple runs, so I closed up those holes at the geometry level and remeshed last night. It all looks pretty good so far! I'd like to delete the volume mesh and work with the surface mesh to make sure its fully sealed like you said. After that I'll create a Delauny mesh from it. I was planning on turning shells off, volume on, then deleting visible. I'm having trouble deleting the volume mesh though... only because when I go to turn on the volume mesh the application just thinks. I gave it an hour with no results. Is there a way to delete the volume mesh (without deleting the surface mesh) without actually turning it on to view?

Here is an image of the shells in wireframe... anything that looks solid is really just meshed at 0.25. The rest at 1, with the tunnel set to 0 (max global size = 512).

PSYMN August 29, 2009 15:01

I almost never turn on the volume mesh in ICEM CFD...

Instead, go to Edit mesh => Delete

It will say "select elements" and a tool bar will pop up...

The last icon in the tool bar is "all volume elements".

Click it.


PSYMN August 29, 2009 15:02

Fun with Prism...
Next will be fun with Prism... ;)

tommymoose September 2, 2009 23:05

That sure worked... Thanks!

When inspecting the mesh, I check off single edges in the diagnostic menu, but it's still hard to see... The yellow doesn't jump out because all the parts and curves are different colors. What's the best way to go about this and clean the surface mesh up? If I'm going to do a Delauny mesh off of this surface mesh, it should be a closed shell right?

If I want to have the part of the tunnel my tires intersect be a sliding surface, do I need to do anything different at this stage? Tunnel labeling? Also, should I put a symmetry plane in now? I could utilize the symmetry on some runs but will also have asymmetrical runs. Thanks!

PSYMN September 3, 2009 10:45

Using Shell => Diagnostics or using Edit Mesh => Check Mesh, you can get to a situation where you only see single edge shells. I usually do it thru Check mesh, create a subset and then add a couple layers to the subset so I can understand the problem.

Delaunay can handle openings within the envelope. It will treat those as internal baffle walls and add volume mesh on both sides. It cannot accept holes in the envelope. It will fail and should create an error subset to show you why.

I would create a curve of intersection between the tires and the road (Geometry tab => Create curves.) You may even want to take it a step further (and use the geometry tools in ICEM CFD or perhaps modify the original IGES wheel before importing) to remove any cusp features where the tire meets the road… This will save meshing hassle later on.

Even if you plan to run asymmetrically, you can take advantage of symmetry while meshing. This makes everything faster because you are only meshing half the model. In the end, you can easily copy-mirror the mesh if you needed a full model for the solver.

tommymoose September 7, 2009 20:33

I'm cleaning up the surface mesh I have now before Delauny meshing... I imagine having a clean surface mesh will lead to a cleaner volume mesh?

What is an acceptable level of quality in the histogram? I've heard people say nothing less than 0.3, but for complex geometry this would be difficult.

When cleaning up the worst elements, I'm going "mesh -> shells -> color by quality" then taking care of the worst ones I can see. I can't find a way to have it display elements of quality < X though... Its hard to spot the tiny/thin bad elements manually, so is this possible?

Thanks alot!... I'm moving through this slowly but surely...

PSYMN September 8, 2009 10:17

Sure, there is definitly a better way.
Yes, of course, a better surface mesh leads to a better volume mesh.

I go to the smooth or mesh quality and run my check… This creates a histogram in the bottom right corner. You can adjust the range of the histogram if it is too hard to see the lowest columns. Left click on columns to display the mesh from each column on the screen (track lightly as this may be memory/display intensive). Right click on the histogram to create a subset of the elements in the highlighted columns… Then go over to the model tree. Under the mesh branch, you will find a subset branch. Turn off the shells and other ways mesh is displayed and just display the subset. These are the elements of that histogram bar (or however many bars were highlighted when you created the subset). Right click on the subset and “add to subset”, this will add attached surface elements. You can have other options if you chose to "modify" the subset. "Add to subset" a few times until you get enough elements to understand the situation. Most can be fixed by either adjusting node projection, merging away sliver nodes, splitting edges, or swapping edges. Move nodes may also help.

After fixing up an area, right click on subset again and choose "remove from subset", then remove the area you repaired. This just helps to clean up what you are looking at so you can focus on the remaining clumps.

Removing a subset does not delete the mesh, it is just a display trick.

I usually also use Check mesh and create subsets to find single and multiple edges, non manifold verts, etc.

After you have made all your fixes, run the smooth again and create another histogram...

This may be a somewhat iterative process, but don't let it make you crazy. There is always a worst element and you may need to say, "that is just the best element that will fit in there due to my geometry constraints". Your solver can handle it (most of the time). If 0.3 is the goal for Fluent, you can probably handle a few between 0.01 and 0.3.

Also, when you get to Prisms, expect they will have lower quality, but down to 0.01 is usually fine for Fluent.

tommymoose September 8, 2009 12:12

Thanks for the detailed explanation Simon!

tommymoose September 9, 2009 17:32

There are ducts in my front-lip that I want to be open on the initial simulation, however I created and surface meshed a surface so that I can make them closed on later runs. How can I get the mesher to ignore this surface when I run the Delauny volume mesh?

I unchecked the part so it was hidden and changed it back from int-wall to a regular surface in the part mesh setup. I was hoping it would just mesh through it, but in the summary in the text-area it said a certain number of volume elements belonged to it or something. I tried to turn on the volume mesh to see how it turned out, but it was taking forever (then my computer auto-restarted... stupid windows updates). Just wondering if there is an easy way to have the mesher ignore certain parts :) Thank you!

PSYMN September 10, 2009 13:22

I can't think of a good title
Once you get to Delaunay, you are just meshing from the surface mesh. If you want it to ignore a certain surface mesh area while meshing, the only thing I can think of is to simply delete the surface mesh in that part…

On the other hand, you could keep that surface mesh for Delaunay, it would force nodes to line up across the opening which is not a bad thing. Then set up the bocos to tell the solver that the surface is just for post processing (not a wall) or make it a wall to simulate blocking the hole without needing a remesh. You could also delete the surface tris before running in the solver if you would prefer.

Also, never turn on all the volume mesh for a model this big… Unless you are in cut plane mode…

tommymoose September 14, 2009 21:45

I've created prisms now. I decided to go with the standard settings and 4-layers worth. After that, I froze them and smoothed the rest of the mesh with 25 iterations up to 0.5. I still had about 3500 elements between 0.0 and 0.05 when that was done so I unfroze the prisms and re-smoothed 5 iterations worth up to 0.2. This got it down to ~900 elements between 0.0 and 0.05. Overall though there are thousands below 0.3, but it makes up about 0.5% of my elements.

Does the specific number of low quality elements matter, or just the percentage of them to overall? Will the simulations fail, or can I just expect some diminished accuracy when I have a lower quality volume mesh?

Assuming I can get through that, I'm now trying to setup the boundary conditions for the output to Fluent. There is the symmetry wall which I'll be using. I notice now however that I just have a part "Tunnel" but it is not broken up into the floor, inlet and outlet. Can I do this retroactively or must it be done before the volume mesh?

The tutorials don't have much specifics on setting up the boundary conditions. How would I go about setting up the sliding floor? Also, I think that standard practice is to use a pressure differential between the inlet and outlet, but how do I determine what differential gives me the fluid speed I want? Thank you very much for answering these uber-noob questions :o

PSYMN September 16, 2009 16:30

1)You may be able to get better quality, so perhaps you shouldn’t give up, but rather look to see where and why you are getting these poor elements. But yes, they are not the end of the world. Rather than focus on quantity or percentage, I look at how bad they are and where they are. If they are in an area of critical interest or where a lot is going on, they could reduce your accuracy or cause divergence.
2)Yes, you can get the mesh to change to match geometry… The first step is to adjust the geometry parts. Put the inlet surface into the INLET part, etc. Setup your geometry the way you should have in the first place. Then go to Edit Mesh tab => Repair Mesh => Associate Mesh. Use the select items in a Part option to select the TUNNEL part, or use the Select all surface mesh elements… This will use a normal ray from the center of each selected element to the nearest surface and take the part from that surface. Then you can proceed to apply bocos.
3)For the moving floor, set it up as a viscous wall, but then apply a velocity to it in Fluent. I usually use a velocity inlet and a pressure outlet which makes it relatively easy to match the inlet velocity to the moving wall floor. Others in the CFD-Online community may have other suggestions for how to best setup Fluent bocos for external aero. Ask that question separately in the Solver users section.

tommymoose October 10, 2009 15:47

1 Attachment(s)
I've read on here that for improved accuracy, you want to keep the volume mesh very fine in the wake-zone behind the car. For the zones around critical parts of the car (lip, a-pillars, wing, etc) I can just set the mesh parameters to be finer (0.25 compared to 1 for the rest), however when there is no part that the area corresponds to, I'm not sure what to do.

One thing I'm trying is to "adjust mesh density" along the symmetry wall right behind the car. I'm hoping the fine volume mesh that is created from that surface will carry around that whole area. Its hard to verify what the volume mesh looks like though, as the computer is unable to display it.

Any ideas? I'm attaching a picture of what I have right now. I'm going to run my Delauny mesh off of this (octree mesh with volume deleted). Can you comment on how the density behind the car looks? Should it be finer? Thanks!

PSYMN October 10, 2009 20:04

Create Mesh Density...
You could work with the surface width parameter, etc.

But what you really want to do is "Mesh tab => Create mesh density". Once there, look into the help or search the tutorials for instructions, but basically, this lets you create a density region and then set the "max size" within that 3D volume region. you can create boxes or lines (cylinders) or points (spheres). You can use points to help you place it (easier to select geometry) or you can place it around an existing geometry and move it into place (right click on density in the model tree to modify). Some people put several nested density boxes to help the mesh transition in the wake or combine it with a "width" setting of 3 on the surface of the vehicle.

You may also want to look at my hints and tips pdf...

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