CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

SnappyHexMesh GUI add-on for Blender

Register Blogs Community New Posts Updated Threads Search

Like Tree22Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2019, 12:34
Post SnappyHexMesh GUI add-on for Blender
  #1
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello world,


I made a SnappyHexMesh GUI add-on for Blender (https://www.blender.org/). The add-on is available at https://github.com/tkeskita/snappyhexmesh_gui. Here is short summary from the main page:


SnappyHexMesh GUI add-on for Blender ("the add-on" hereafter) is meant to aid OpenFOAM users to use Blender as a CFD pre-processing tool. The aim is to
  • Ease the workflow for updating, modifying and exporting 3D surface meshes to OpenFOAM.
  • Allow definition of most common SnappyHexMesh settings via Blender GUI, to reduce need for manual writing of OpenFOAM dictionary definitions.
  • Require minimal Blender skills. Geometry can be modelled in any 3D modelling / CAD program which exports a surface mesh format that can be imported to Blender, such as STL or Wavefront OBJ. Add-on is operated via panels in Blender's GUI.
The creation of OpenFOAM dictionary files is based on string replacements using template files located in the add-on's skel directory. The add-on is developed for Blender 2.8 (master branch) and OpenFOAM Foundation version 6 of OpenFOAM.


Enjoy!
snak, wyldckat, rmaries and 11 others like this.
tkeskita is offline   Reply With Quote

Old   April 5, 2019, 02:31
Default
  #2
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hello Lorenzo,

thanks, great to hear you find it useful!

I haven't done CHT myself, but I think it is possible, but requires some manual work: You have to generate one mesh at a time, and then copy final mesh to correct folder under your simuation case folder. You can use the "Include in Export" check box in the add-on to enable/disable geometry objects for each export, so you can still have all the geometry in same blend file if you want.
tkeskita is offline   Reply With Quote

Old   October 9, 2020, 07:30
Default
  #3
New Member
 
Simon
Join Date: Jan 2014
Location: Freiburg, Germany
Posts: 15
Rep Power: 12
Nomis is on a distinguished road
Hi Tuomo,

thanks for providing and updating this very useful blender addon. Saves a lot of time!

Greetings Simon!
tkeskita likes this.
Nomis is offline   Reply With Quote

Old   March 18, 2021, 22:01
Default
  #4
Member
 
Ndong-Mefane Stephane Boris
Join Date: Nov 2013
Location: Kawasaki (JAPAN)
Posts: 53
Rep Power: 13
S_teph_2000 is on a distinguished road
Hello Tuomo,
thank you for the awesome work!!
I made a small modification to the program to make it work with "surfaceFeatureExtractDict" used in the ESI version of openfoam.
The only problem is that now when I enable/disable the layer addition for 1 patch in the UI, it will do the same for all the other patches in the model... can you take a look please?

I am sending the following files:
- __init__.py (modified)
- op_export.py (modified)
- op_gen.py (just in case)
- op_object.py (just in case)

Kazu
Attached Files
File Type: zip pyFiles.zip (10.9 KB, 12 views)
S_teph_2000 is offline   Reply With Quote

Old   March 19, 2021, 00:53
Default Update
  #5
Member
 
Ndong-Mefane Stephane Boris
Join Date: Nov 2013
Location: Kawasaki (JAPAN)
Posts: 53
Rep Power: 13
S_teph_2000 is on a distinguished road
Hello,
After understanding the settings for the layer addition(default value for number of layers is 0), i get that the concern expressed above is not relevant.
I hope that those using SurfaceFeatureExtract out there will find this modification useful, and again, a BIG THANK YOU to TUOMO for this awesome tool.

Kazu
S_teph_2000 is offline   Reply With Quote

Old   March 19, 2021, 02:36
Default
  #6
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Quote:
Originally Posted by S_teph_2000 View Post
I hope that those using SurfaceFeatureExtract out there will find this modification useful, and again, a BIG THANK YOU to TUOMO for this awesome tool.

Kazu
Great to hear you find it useful! Your modification sounds like a good addition. Is it easy for you to submit it as a pull request on github? If not, I can take it from here.

BR,
Tuomo
S_teph_2000 likes this.
tkeskita is offline   Reply With Quote

Old   March 19, 2021, 05:27
Default
  #7
Member
 
Ndong-Mefane Stephane Boris
Join Date: Nov 2013
Location: Kawasaki (JAPAN)
Posts: 53
Rep Power: 13
S_teph_2000 is on a distinguished road
Quote:
Originally Posted by tkeskita View Post
Great to hear you find it useful! Your modification sounds like a good addition. Is it easy for you to submit it as a pull request on github? If not, I can take it from here.

BR,
Tuomo
Hey Tuomo,
Sorry, but I’d rather let you take care of the GitHub part.
One suggestion is to have both surfaceFeature dictionaries in the template directory, and add a menu in Blender that allows you to choose your dictionary.
Also, this is a great start for a future Openfoam GUI...colors for boundary patches like it’s done for Swiftblock....I will take some time to study Blender API...
S_teph_2000 is offline   Reply With Quote

Old   March 21, 2021, 07:27
Default
  #8
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Quote:
Originally Posted by S_teph_2000 View Post
Hey Tuomo,
Sorry, but I’d rather let you take care of the GitHub part.
OK I've now added a fork option (openfoam.org or openfoam.com) to snappyHexMeshGUI for this. Could you please remove old add-on, download new add-on version and test that it works OK?

Quote:
Also, this is a great start for a future Openfoam GUI...colors for boundary patches like it’s done for Swiftblock....I will take some time to study Blender API...
Well, that would be quite ambitious, considering the fast evolution rate of OF solvers. Maybe for basic solvers / basic boundary condition types it's doable if someone wants to do it. Problem is you would need to maintain it constantly to keep it working, and that might be a lot of work.
tkeskita is offline   Reply With Quote

Old   March 22, 2021, 04:17
Default Problem With the downloaded new version
  #9
Member
 
Ndong-Mefane Stephane Boris
Join Date: Nov 2013
Location: Kawasaki (JAPAN)
Posts: 53
Rep Power: 13
S_teph_2000 is on a distinguished road
Hello Tuomo,

I tried the modified version, but I get the following note when executing surfaceFeatureExtract:

Note: Feature line extraction only valid on closed manifold surfaces
and the *.e files are not created.
I checked, and the problem is indicated below:

Code:
FoamFile
{
    version         2;
    format          ascii;
    class           dictionary;
    object          surfaceFeaturesDict;
}

// Exported by SnappyHexMesh GUI add-on for Blender v1.0
// Source file: 
// Export date: 2021-03-22 17:04:37.455707

surfaces //DELETE    
(            //DELETE  
  
    In1.stl
    {
        extractionMethod extractFromSurface;
        extractFromSurfaceCoeffs { includedAngle 180; }
        writeObj yes;
    }
    In2.stl
    {
        extractionMethod extractFromSurface;
        extractFromSurfaceCoeffs { includedAngle 180; }
        writeObj yes;
    }
    Out1.stl
    {
        extractionMethod extractFromSurface;
        extractFromSurfaceCoeffs { includedAngle 180; }
        writeObj yes;
    }
    Out2.stl
    {
        extractionMethod extractFromSurface;
        extractFromSurfaceCoeffs { includedAngle 180; }
        writeObj yes;
    }
    Wall.stl
    {
        extractionMethod extractFromSurface;
        extractFromSurfaceCoeffs { includedAngle 180; }
        writeObj yes;
    }

);                             //DELETE

includedAngle   150; //DELETE
In summary, the template file for surfaceFeatureExtract needs to be corrected .

Kazu
S_teph_2000 is offline   Reply With Quote

Old   March 22, 2021, 09:35
Default
  #10
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Probably this depends on the OpenFOAM version in use but yes, the syntax changed.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 24, 2021, 12:47
Default
  #11
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
FYI Kazu sent a fix which is now applied, hope it's ok now for both openfoam.org and openfoam.com versions!
abeda likes this.
tkeskita is offline   Reply With Quote

Old   January 8, 2023, 10:28
Default SnappyHexMesh GUI add-on for Blender tutorial
  #12
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
FYI I found a nice Youtube tutorial showing how to use SnappyHexMesh GUI, highly recommended for those not so familiar with Blender! There are also other nice OpenFOAM related videos!
tkeskita is offline   Reply With Quote

Old   November 10, 2023, 08:42
Default SnappyHexMesh GUI tutorial video
  #13
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hi,

FYI I made a tutorial video series Blender for OpenFOAM users, which also now includes a tutorial for using SnappyHexMesh GUI!

BR,
Tuomo
jherb and SHUBHAM9595 like this.
tkeskita is offline   Reply With Quote

Old   December 10, 2023, 07:37
Smile Optimized boundary layer parameters in SnappyHexMesh GUI
  #14
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
FYI I've been testing the boundary layer addition parameters in snappyHexMesh, both openfoam.org and openfoam.com versions. It looks like openfoam.com version does a good job for creating boundary layers! I couldn't quite get up to 100% layer coverage, but it came close!

I've now updated the SnappyHexMesh GUI add-on to include optimized (as far as I could go now) parameter values for boundary layer generation. Please see this discussion thread for some images.
tkeskita is offline   Reply With Quote

Old   December 16, 2023, 08:11
Smile Second set of optimized boundary layer parameters in SnappyHexMesh GUI
  #15
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hi,

I just pushed a new set of layer parameter generation rules into SnappyHexMesh GUI repo. I did many tests to get something that I hope will work for most cases. Please comment below if you download the latest version of the add-on and try it to generate a mesh with layers! Would be interesting to know what kind of issues people run into. Thanks!
tkeskita is offline   Reply With Quote

Old   December 26, 2023, 06:24
Default
  #16
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
FYI I've improved the layer addition settings and parameters, here's layer addition results from a layer addition test (4 layers) using the OF motorBike geometry and openfoam.com v2312 version of snappyHexMesh! The motorBike geometry is an excellent acid test for layer addition !

Block mesh cell size 0.025 m:

motorBike_blocksize_0.0250m.jpg

Block mesh cell size 0.0125 m:

motorBike_blocksize_0.0125m.jpg

BR,
Tuomo
M.Nazrin likes this.
tkeskita is offline   Reply With Quote

Old   March 10, 2024, 12:42
Talking Updated SnappyHexMesh GUI
  #17
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hi,

FYI I made a bunch of parameter tests with SnappyHexMesh to learn about the effect of parameters on the result mesh, and as a result I have now updated the SnappyHexMesh GUI with the "optimized" Snappy parameter values. It seems that good layer addition with Snappy is in fact possible!

I have updated the SnappyHexMesh GUI docs with the things I learned about Snappy during the tests. I hope that Snappy users find the add-on useful! Here below is an example mesh from the vessel example included in the add-on.

BR,
Tuomo

example_mesh_result.jpg
Alczem likes this.
tkeskita is offline   Reply With Quote

Old   April 6, 2024, 09:15
Default issue on reading "surfaceFeaturesDict"
  #18
New Member
 
Jungpin Chen
Join Date: Mar 2024
Location: Taiwan
Posts: 6
Rep Power: 2
Jungpin is on a distinguished road
Hi, Tuomo;

Thank you for making/collecting the videos for showing how to use sanppyHexMesh addon in Blender. While I was following these videos, I met an issue of working on this addon. I copied the "content" and posted it here. I use Ubuntu 20.04 V2. Can you show me how to fix this? Thank you!

========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 11
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
Build : 11-c219200fdb8b
Exec : surfaceFeatures
Date : Apr 06 2024
Time : 19:47:25
Host : "DESKTOP-5SN441A"
PID : 2065
I/O : uncollated
Case : /mnt/d/user/Desktop/BlenderStuff/meshExamples/snappyTest
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Reading "surfaceFeaturesDict"



--> FOAM FATAL ERROR:
cannot find file "/mnt/d/user/Desktop/BlenderStuff/meshExamples/snappyTest/system/surfaceFeaturesDict"

From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::rea dStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 539.

FOAM exiting
Jungpin is offline   Reply With Quote

Old   April 8, 2024, 06:04
Default
  #19
Member
 
Tuomo Keskitalo
Join Date: Oct 2010
Posts: 57
Rep Power: 16
tkeskita is on a distinguished road
Hi,

Quote:
Originally Posted by Jungpin View Post
--> FOAM FATAL ERROR:
cannot find file "/mnt/d/user/Desktop/BlenderStuff/meshExamples/snappyTest/system/surfaceFeaturesDict"
You need to change the Fork option to openfoam.org.

https://snappyhexmesh-gui.readthedoc...rface-features

BR,
Tuomo
tkeskita is offline   Reply With Quote

Old   April 8, 2024, 06:20
Default got it with thanks!
  #20
New Member
 
Jungpin Chen
Join Date: Mar 2024
Location: Taiwan
Posts: 6
Rep Power: 2
Jungpin is on a distinguished road
Hi, Tuomo;

Thank you for the instruction and I had "adjust" the proper Fork setting at SnappyHexxMesh GUI. got it with thanks!

Jungpin
Jungpin is offline   Reply With Quote

Reply

Tags
gui, 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
ANSYS Workbench on "Uncertified" Linux Distros hsr CFX 289 April 20, 2023 10:23
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
Helyx-OS Open Source GUI for OpenFOAM eugene OpenFOAM Announcements from Other Sources 31 March 9, 2020 17:55
[Helyx OS] Helyx-OS (GUI for SnappyHexMesh elvis OpenFOAM Community Contributions 210 January 30, 2017 19:57
New CastNet Release: GUI Environment for OpenFOAM and CalculiX MartinB OpenFOAM Announcements from Other Sources 0 January 13, 2017 11:27


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