CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] snappyHexMesh Boundary Conditions

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By Cyberholmes
  • 2 Post By wyldckat
  • 1 Post By wyldckat
  • 2 Post By Hillie

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 23, 2011, 00:07
Default snappyHexMesh Boundary Conditions
  #1
New Member
 
Join Date: Jun 2011
Posts: 29
Rep Power: 14
Cyberholmes is on a distinguished road
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.
permeseo likes this.
Cyberholmes is offline   Reply With Quote

Old   June 24, 2011, 11:08
Default
  #2
New Member
 
Join Date: Jun 2011
Posts: 29
Rep Power: 14
Cyberholmes is on a distinguished road
Can anyone shed a little light on this?
Cyberholmes is offline   Reply With Quote

Old   June 25, 2011, 03:14
Default
  #3
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
I think you have to assign a different name to the protrusion and then assign the boundary condition you need to that region.
lovecraft22 is offline   Reply With Quote

Old   June 26, 2011, 01:51
Default
  #4
New Member
 
Join Date: Jun 2011
Posts: 29
Rep Power: 14
Cyberholmes is on a distinguished road
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.
Cyberholmes is offline   Reply With Quote

Old   June 26, 2011, 05:19
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
hwangpo and Cagatayemre like this.
__________________
wyldckat is offline   Reply With Quote

Old   June 26, 2011, 13:00
Default
  #6
New Member
 
Join Date: Jun 2011
Posts: 29
Rep Power: 14
Cyberholmes is on a distinguished road
Thank you so much! You don't know how much of a help you've been!
Cyberholmes is offline   Reply With Quote

Old   June 26, 2011, 14:22
Default
  #7
Senior Member
 
lore
Join Date: Mar 2010
Location: Italy
Posts: 460
Rep Power: 18
lovecraft22 is on a distinguished road
Send a message via Skype™ to lovecraft22
Quote:
Originally Posted by wyldckat View Post
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?
lovecraft22 is offline   Reply With Quote

Old   June 26, 2011, 17:10
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi lovecraft22,
Quote:
Originally Posted by lovecraft22 View Post
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
skuznet likes this.
__________________
wyldckat is offline   Reply With Quote

Old   June 27, 2011, 18:19
Default
  #9
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
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.
mturcios777 is offline   Reply With Quote

Old   June 28, 2011, 10:36
Default
  #10
Senior Member
 
Join Date: Apr 2010
Posts: 151
Rep Power: 16
flowris is on a distinguished road
This one also shows how to define patches:
tutorials/incompressible/pimpleDyMFoam/wingMotion

The Allrun file shows you what to do.
flowris is offline   Reply With Quote

Old   July 10, 2017, 21:05
Default
  #11
Member
 
Hilbert
Join Date: Aug 2015
Location: Australia
Posts: 50
Rep Power: 10
Hillie is on a distinguished road
Dear Foamers,

I know that this thread is old, but I wanted to add my solution, since I still had to Google for a good couple of hours to figure out how to name the surfaces, and this might help some people.

As has been discussed in this thread you can put in multiple stl files into SHM or name the patches after the meshing. Naming surfaces in the stl didn't work for me. I have tried splitting them in Salome, but my geometry is quite complex, and so i had a huge amount of separate faces which didn't make that solution that great.

The solution that worked for me is the following:
Mesh the part in SHM.

Them use Toposet to make faceSet of the faces of interest.
Below are my actions in for toposet.
i.e I make a box around the faces of interest and then refine by just selecting the faces with a certain normal.

Code:
actions
(
    {
        name    setname;
        type    faceSet;
        action  new;
        source  boxToFace;
        sourceInfo
        {
            box  (-0.15 0 -0.081)(-0.145 0.0346751670140271 -0.0805);
        }
     }
     {  
        name    setname;
        type    faceSet;
        action  subset;
        source  normalToFace;
        sourceInfo
        {
            normal (0.243182556589797 0.00832132403345907 0.94); 
            cos 0.01;
        }

      }
);
After generating this topoSet you can use createPatch to enerate the patch.

Code:
pointSync false;

patches
(
    {
        // Name of new patch
        name patchname;

        // Type of new patch
        patchInfo
        {
            type patch;
        }

        // How to construct: either from 'patches' or 'set'
        constructFrom set;

        // If constructFrom = patches : names of patches. Wildcards allowed.
        set setname;
    }
   
);
When running createPatch it complained that my faceSet contained a number of internal faces. After removing those by hand (There were 3 in my case) createPatch ran beautifully.

I hope this helps some people.
Tkjeong and hdotyao like this.
Hillie is offline   Reply With Quote

Reply

Tags
boundaries, boundaryfield, snappyhexmesh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Centrifugal fan j0hnny CFX 13 October 1, 2019 13:55
CFD analaysis of Pelton turbine amodpanthee CFX 31 April 19, 2018 18:02
Domain Imbalance HMR CFX 5 October 10, 2016 05:57
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15


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