CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing Format & General Technical (http://www.cfd-online.com/Forums/openfoam-meshing-technical/)
-   -   Hexahedral meshing of CAD files - Which free software? (http://www.cfd-online.com/Forums/openfoam-meshing-technical/71058-hexahedral-meshing-cad-files-free-software.html)

Wolle December 14, 2009 10:08

Hexahedral meshing of CAD files - Which free software?
 
Hi all,

I read a lot in this forum and elsewhere on the internet, trying to obtain as much information on what would be the best software to achieve the following:

How to get a (preferrably pure) hexahedral mesh, compatible to OpenFOAM, out of (standardized) CAD files (let's say STL, STEP, IGES)?

This is, what I tried:

0. blockMesh. As we have somewhat complicated geometry, I don't think, that this is a good solution. We would like to have something that is associative to our CAD models, that undergo changes of course...

1. Netgen. Only tetrahedral meshes, as far, as I could manage to find out.

2. Gmsh. I could only produce tetrahedral meshes, though I found out, that there should be a possibility to generate hexahedral meshes with Gmsh. I found out, there's an option "Options > Mesh > General > Subdivision algorithm", that can be set to "all hexa". I don't know how to proceed from there on (next step should be some kind of refinement by subdivision of the tets, I think). On the other hand, I found a mailing list contribution by the author (or host of the project), stating, that there isn't something like a working "automatic hex mesh routine" and that there are possibilities similar to blockMesh techniques, that might work. That's not an option (as it seems) like described for blockMesh.
( http://www.geuz.org/pipermail/gmsh/2007/002421.html )

3. IA-FEMesh. I managed to create a mesh of my imported CAD model, though it would need some more tweaking. Unfortunately, IA-FEMesh can only export to vtk or Abaqus and I couldn't find a way to convert any of those to OpenFOAM formats (Threads in forum exist, but don't include answers.)...

4. Salome. I read, that only Netgen is supported as a built-in mesher (Salome seems to be a frontend) and other meshers would need licencing of commercial products.

5. CalculiX. There are screenshots that show poly or hexahedral meshes. But I'm not sure, whether they have been made wit CalculiX or whether CalculiX is only a frontend like Salome...?

6. snappyHexMesh. The tutorial in the User Guide shows a 2D case, did I get that right? Also most of the screenshots I saw related to snappyHexMesh seem to deal with 2D cases, although written statements say that 3D is possible. Is that true (is there an applicable tutorial)?

7. Discretizer. No CAD import...

8. Others?


As you can see, I'm at a point, where I have to decide, which software to use. I'm willing to take tutorials to get along with an applicable software. But first, I would like to know, which software can do, what I would like to do... Otherwise I would have to undergo several tutorials to every software, just to find out, what's not going to be a solution...

Thanks in advance
Wolle

olesen December 15, 2009 02:53

Quote:

Originally Posted by Wolle (Post 239947)
6. snappyHexMesh. The tutorial in the User Guide shows a 2D case, did I get that right? Also most of the screenshots I saw related to snappyHexMesh seem to deal with 2D cases, although written statements say that 3D is possible. Is that true (is there an applicable tutorial)?

looking through the tutorials directory
Code:

$ find tutorials/ -name snappyHexMeshDict
reveals these
  • tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict
  • tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict
  • tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict
Perhaps one of them might help you further. And no, snappy is definitely not 2D.

Wolle December 15, 2009 03:55

Hi Mark,

Thank you very much for your directions. Especially the motorBike tutorial I found by myself earlier, but didn't know, whether this would fit my case. So I'm going to make my way through these tutorials...

Cheers
Wolle

olesen December 15, 2009 04:18

Quote:

Originally Posted by Wolle (Post 240033)
Especially the motorBike tutorial I found by myself earlier, but didn't know, whether this would fit my case. So I'm going to make my way through these tutorials...

Hi Wolfram,

You can use snappy for internal or external flows. Which region gets retained is determined from the start point. I haven't found a way to get nice crisp feature edges, but I haven't worked on it much either.

Wolle December 22, 2009 05:28

Hi Mark,

I'm at the point of working with the motorbike tutorial right now.

First question: Do the tutorials (except the first three ones) consist of only the case files or is there a description available to each? I get along with most of the case files (concerning geometry (not the automatic generated files though, but I think, I don't need to understand them perfectly... do I?) and process control) and even seem to understand sHM, but especially the turbulence modelling settings (trubulenceProperties) are too much for me. Basically I understand how the files are set up... I suppose it's the CFD background knowledge and its implementation in OpenFOAM I'm lacking of...

Do you have any hints, where to learn something more about the turbulence modelling (i.e. "What model is appropriate in which case / under what circumstances?")?


Second question: In order to set up a case for internal flow, is there a tutorial? When there isn't, do I still need the surrounding box, as in the motorBike tutorial? If I position my STL geometry in such a bounding box for an internal flow... what would the external mesh be useful for? I would like to have the boundary conditions applied directly to the STL geometry (resp. the corresponding mesh / patch), but will have to set up BCs for the surrounding box as well, wouldn't I? Or has the surrounding box have to share some faces with the inlet/outlet regions of my STL geometry (Don't suppose so, as how I understand sMH procedures...)?

Cheers
Wolle

johannes January 8, 2010 13:33

Hi Wolle,

I'm trying to answer at least a few of your numerous questions... ;)

Quote:

Originally Posted by Wolle (Post 240729)
First question: Do the tutorials (except the first three ones) consist of only the case files or is there a description available to each?

Since the list of tutorial descriptions in the wiki is far away from being complete, I would say no. But have a look at the Programmers Guide, where you'll find a few more tutorials with additional explanations.

Quote:

Originally Posted by Wolle (Post 240729)
Do you have any hints, where to learn something more about the turbulence modelling (i.e. "What model is appropriate in which case / under what circumstances?")?

Did you check the CFD Books Guide here on CFD-Online? This reference includes general CFD books as well as literature on special topics like turbulence or free surface flows.

Quote:

Originally Posted by Wolle (Post 240729)
Second question: In order to set up a case for internal flow, is there a tutorial? When there isn't, do I still need the surrounding box, as in the motorBike tutorial? If I position my STL geometry in such a bounding box for an internal flow... what would the external mesh be useful for?

Yes, you'll need the surrounding box, since this base mesh created by blockMesh is used to create your final mesh of the STL geometry. The only difference to an external flow case is that you choose the internal mesh to be kept, instead of the external part like in the motor bike tutorial.

Quote:

Originally Posted by Wolle (Post 240729)
I would like to have the boundary conditions applied directly to the STL geometry (resp. the corresponding mesh / patch), but will have to set up BCs for the surrounding box as well, wouldn't I?

The surrounding box needs BCs, otherwise blockMesh will fail. But since you're using the internal mesh created by snappy, they're not used. Instead, you'll have to delete them in the 'boundary' file of your final snappy mesh, since there won't be any of these faces left.

Regarding BCs with snappy, you may check some of the forum threads on this topic. To make it short: There are two alternatives - using STL files with named sections like in the motor bike tutorial - or using multiple STL files where each file includes one BC surface. Choose whatever you find easier to prepare since it strongly depends on the geometry creation software.

Quote:

Originally Posted by Wolle (Post 240729)
Or has the surrounding box have to share some faces with the inlet/outlet regions of my STL geometry (Don't suppose so, as how I understand sMH procedures...)?

No, although possible, it's not recommended.

Best regards,
Johannes

//edit: typo...

Wolle February 2, 2010 04:34

Hi all,

right now, I've come to the following point.

1. Export geometry as IGES.
2. Open new study in Salome.
3. Python script for importing IGES, exploding to faces and exporting faces to STL, also reporting geometrys bounding box measurements, also lets you select faces in order to determine their name by which they will be addressed for BC application later on
4. Bash script for manipulating STL-files (adding names to solids) and joining them together to one STL file
5. Editing blockMeshDict with geometry bounding box data

Everything works fine until now. (I even carried out a first rough internal flow case, which seemed to work. But by now, I'm trying to get things working more sorted, less confused, with lots of comments and as automated as possible).

Now, for proceeding with snappy, I've got the following question:

As far, as I understood: for an internal flow, the patches of the external mesh created by blockMesh are dismissed...

What BCs do I specify (for the patches, that blockMesh creates and that are later on dismissed) in the different files in the 0 directory? In blockMeshDict I use patch. What do I use in 0/k, 0/p, 0/U, 0/omega, 0/nut files? Can I use simply anything? What would give the least computing time? Or should I even set no BCs at all for the outer blockMesh box?

Cheers
Wolle

P.S.: I read the UG section about boundary types. Well, I think I will have to go back there and read again, when it comes to the real BCs for calculating the case. However, for the usage of snappyHexMesh I didn't find anything...

johannes February 2, 2010 13:15

Quote:

Originally Posted by Wolle (Post 244544)
What BCs do I specify (for the patches, that blockMesh creates and that are later on dismissed) in the different files in the 0 directory? In blockMeshDict I use patch. What do I use in 0/k, 0/p, 0/U, 0/omega, 0/nut files? Can I use simply anything? What would give the least computing time? Or should I even set no BCs at all for the outer blockMesh box?

As I wrote in my previous post: Just delete the "dismissed" patches in the 'boundary' file and you won't have to set any BCs for them at all.

Best regards,
Johannes

Wolle February 2, 2010 13:56

Hi Johannes,

Thanks for your replies. I read what you wrote. That is:

Quote:

Originally Posted by johannes (Post 241912)
The surrounding box needs BCs, otherwise blockMesh will fail.

So I still need to specify some at first, right? Which ones? OF provides numerous types of BCs. For example I could just set all of them to a random fixedValue or maybe zeroGradient. Would there be any difference (e.g. concerning computing time) between those (examplary) different types? Are there BC types that I should not use at all in order to avoid any conflicts?

Quote:

Originally Posted by johannes (Post 241912)
But since you're using the internal mesh created by snappy, they're not used. Instead, you'll have to delete them in the 'boundary' file of your final snappy mesh, since there won't be any of these faces left.

Processing the boundary file in order to delete any "0 faces"-patches is clear to me and will be automated with another script as one of my next tasks.

Cheers
Wolle

johannes February 4, 2010 03:26

Quote:

Originally Posted by Wolle (Post 244659)
So I still need to specify some at first, right? Which ones? OF provides numerous types of BCs.

You only need 'Base type' BCs for blockMesh, e.g. patch, wall, symmetry, etc... And if you got an internal flow case you don't need to care about them at all, since you're going to delete them anyway in your final snappy mesh.

If your case is an external flow you have to choose the right Base type BCs depending on your application and geometry. However, you don't have to specify the final BCs in the 'boundary' file for blockMesh because you still can edit the final 'boundary' file creating by the snappyHexMesh process.

Hope things got a bit clearer now.

Best regards,
Johannes

Wolle February 4, 2010 05:15

Hi Johannes,

Quote:

Originally Posted by johannes (Post 244882)
You only need 'Base type' BCs for blockMesh, e.g. patch, wall, symmetry, etc... And if you got an internal flow case you don't need to care about them at all, since you're going to delete them anyway in your final snappy mesh.

Hope things got a bit clearer now.

Indeed. In fact, I guessed it would work this way, but simply wanted to know, whether there could be side effects or the like.

Thank you very much, I'm getting closer to my goals step by step. I'm thinking about setting up a tutorial for internal flows based on snappyHexMesh and for mesh generation out of standardized CAD file formats, as those seem to be very frequently asked questions, for which there aren't any tutorials available at the moment (to my knowledge). Sadly, at the moment my hardware seems to be outdated and insufficent for proceeding... we'll see.

Thanks again for your help!

Cheers
Wolle

johannes February 4, 2010 12:32

Hi Wolle,

you're welcome!

I totally agree with you that such a tutorial would be very useful.
If you haven't yet planned to put the tutorial and/or some similar explanations about this topic on the wiki, I'd encourage you to do so, because users could easily contribute, e.g. in form of a 'best practics' section. Maybe I even got something worth adding there, too.

Best regards,
Johannes

Wolle February 5, 2010 02:17

Hi Johannes,

well, the wiki would be alright for me. Nevertheless I would prefer to set it all up and running perfectly prior to publishing it.

At the moment I'm facing a lack of virtual memory while snappyHexMeshing (works good with smaller geometries though!), on the other hand I don't know, whether my method/scripts produce a closed volume or whether there are gaps that lead to unintentional sHM behaviour. If so, there are still possibilities of curing/healing/stitching the faces together. Another possibiliy for the behaviour observed, is that snappy itself might create those gaps due to cell removement after just a low refinement level. This would then be a result of my efforts on coping with too few memory... :rolleyes:

And another serious issue is, that I'm going to need help on setting up the correct simulation parameters as I do not intend to publish working, but finally senseless examples. But one at a time...

Cheers
Wolle

elvis March 23, 2010 07:39

Hi Wolfram,

did you have a look at engrid http://engits.eu/cms/index.php?id=5 http://engits.eu/cms/index.php?id=3 ?

what about using polyDualMesh http://www.idurun.com/?p=367
for working with the mesher you mentioned before?


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