CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   snappyHexMesh Boundary Conditions (http://www.cfd-online.com/Forums/openfoam/89822-snappyhexmesh-boundary-conditions.html)

Cyberholmes June 23, 2011 00:07

snappyHexMesh Boundary Conditions
 
I have just managed to successfully use snappyHexMesh to mesh a geometry I made in Blender. What I'm now wondering is how I go about assigning boundary conditions to the boundaries in this mesh.

For example, I have a protrusion in my geometry that needs to have a velocity boundary condition set on the boundary at its end. How do I specify that surface?

Thank you.

Cyberholmes June 24, 2011 11:08

Can anyone shed a little light on this?

lovecraft22 June 25, 2011 03:14

I think you have to assign a different name to the protrusion and then assign the boundary condition you need to that region.

Cyberholmes June 26, 2011 01:51

What I don't know is how to assign a name to that region with snappyHexMesh. snappyHexMesh creates a meshing on its own, and it has hundreds of thousands of cells that have random names. I don't know how to specify a region out of that.

wyldckat June 26, 2011 05:19

Greetings to all!

@Cyberholmes: you've got two possible methods:
  1. Pre-define the surfaces in the STL and then associate those names to patches in snappyHexMeshDict. The usual method is to use an ASCII STL (text mode, not binary) and define solids by their names. Edit the motorBike STL example with a text editor, to see what I mean: mesh/snappyHexMesh/motorBike/constant/triSurface/motorBike.stl
  2. Or use createPatch for creating patches after the mesh is complete. An example dictionary is here: applications/utilities/mesh/manipulation/createPatch/createPatchDict
    You can find practical examples on the tutorials, simply by running this command on the tutorials folder:
    Code:

    find . -name createPatchDict
    Visit those cases and see how the Allrun scripts use createPatch and respective dictionary. Keep a look out for the command(s) before createPatch, which will define the face sets to be used by createPatch.
The rest is up to your detective skills ;)

Best regards,
Bruno

Cyberholmes June 26, 2011 13:00

Thank you so much! You don't know how much of a help you've been!

lovecraft22 June 26, 2011 14:22

Quote:

Originally Posted by wyldckat (Post 313605)
Greetings to all!

Pre-define the surfaces in the STL and then associate those names to patches in snappyHexMeshDict. The usual method is to use an ASCII STL (text mode, not binary) and define solids by their names. Edit the motorBike STL example with a text editor, to see what I mean: mesh/snappyHexMesh/motorBike/constant/triSurface/motorBike.stl

How can you do that? By editing the stl text file by hand?

wyldckat June 26, 2011 17:10

Hi lovecraft22,
Quote:

Originally Posted by lovecraft22 (Post 313647)
How can you do that? By editing the stl text file by hand?

It honestly depends on the source of your STL. Examples:
  • Some STL exporters in CAD like applications, can export selected surfaces onto a single STL file, whether ASCII or binary. They export the selection onto a single STL file.
    What we can do is a little bit of text hacking on ASCII STLs, by renaming the solid name and ending that solid with the respective name (see motorBike.stl).
    Then, after each STL has been properly fixed, manually or with a script, we can concatenate the various STL files into a single one.
    With a lot of patience, this can also be achieved with ParaView, by selecting triangles, extracting them and export the extraction to a separate STL file... but this requires a gigantic load of patience and the triangles must already be sized exactly as you want them. Keep in mind that ParaView is not a 3D CAD tool by trade!
  • Or you can use a proper geometry editing tool that can export the STL with the desired surface names. I honestly can't remember with 100% certainty of any geometry editor that does this, but I believe that MeshLab might do this. The other possibilities I can remember are Blender and SALOME. FreeCAD possibly can do this as well.
If you confirm which editor does this, feel free to tell us as well ;)

Best regards,
Bruno

mturcios777 June 27, 2011 18:19

There is a script that allows you to define boundaries in Blender and have it exported to STL. It is mentioned in the thread:

http://www.cfd-online.com/Forums/ope...cii-stlbs.html

I've used it and it works quite well.

flowris June 28, 2011 10:36

This one also shows how to define patches:
tutorials/incompressible/pimpleDyMFoam/wingMotion

The Allrun file shows you what to do.


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