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

[snappyHexMesh] With FreeCAD: creating waterproof STL files?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By robob

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2017, 14:52
Default With FreeCAD: creating waterproof STL files?
  #1
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
How to create waterproof stl files with Freecad?
See this thread for guidance how to do it with Salome.
But in Freecad you can't mesh everything and select some mesh parts for the boundaries, or can you?
robob is offline   Reply With Quote

Old   December 19, 2017, 18:30
Default
  #2
New Member
 
Daniel Norton
Join Date: Feb 2015
Posts: 17
Rep Power: 11
Dano62 is on a distinguished road
I've been creating models in Freecad then exporting them as an STP file to Salome to waterproof them and improve the surface before exporting as STL. So far it's worked fine, even if it's another step.
Dano62 is offline   Reply With Quote

Old   December 20, 2017, 05:32
Default
  #3
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
Ok, thanks for mentioning Freecad -> Salome workflow. But I`m interested to do it in Freecad alone. I have read somewhere, that for tighter cfd integration it needs first be implemented by someone. But currently in all cfd workbenches for freecad its not possible, I guess?
robob is offline   Reply With Quote

Old   December 24, 2017, 19:36
Default
  #4
Senior Member
 
Canakkale Dardanelspor
Join Date: Aug 2012
Posts: 135
Rep Power: 13
HakikiCanakkaleli is on a distinguished road
Hi,

Could you please elaborate what exactly you meant in the following?

Quote:
Originally Posted by robob View Post
But I`m interested to do it in Freecad alone. I have read somewhere, that for tighter cfd integration it needs first be implemented by someone.
To myself, a CAD program was not expected to produce adequate-quality surface meshes to be utilised in a CFD simulation, because it mainly focuses on providing solutions for improvements of a mechanical design. IMHO, CAD is inherently indifferent to challenges posed by (detailed) flow physics and its modelling.
HakikiCanakkaleli is offline   Reply With Quote

Old   April 9, 2018, 15:07
Default
  #5
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
I want to answer my own thread:

these are the links from freecad forum, which explains my problem and which give solutions:

https://forum.freecadweb.org/viewtopic.php?f=37&t=16855
https://forum.freecadweb.org/viewtop...hilit=openfoam
robob is offline   Reply With Quote

Old   April 11, 2018, 16:57
Default
  #6
Senior Member
 
Derek Mitchell
Join Date: Mar 2014
Location: UK, Reading
Posts: 172
Rep Power: 13
derekm is on a distinguished road
with freecad I create the item with part then call in a python script
Code:
             mobjs=[]                
             mobjs.append(this_obj)         #        
             Mesh.export(mobjs,tmp_dir + "/" + str(this_obj.Label)+".ast")                
             del mobjs
separate STL for each region. They appear to be watertight so far. I then use them in snappyHexMesh etc..
The combination of FreeCAD driven by python and snappy works well for me.
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET
derekm is offline   Reply With Quote

Old   April 12, 2018, 03:24
Default
  #7
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
Hi Derek Mitchell,

how do you mesh your part? Is it one mesh per part or do you mesh surfaces from this part individually? What do you mean by regions in freecad? How do you create mesh regions in freecad?

greets
robob is offline   Reply With Quote

Old   April 12, 2018, 09:35
Default
  #8
Senior Member
 
Derek Mitchell
Join Date: Mar 2014
Location: UK, Reading
Posts: 172
Rep Power: 13
derekm is on a distinguished road
Quote:
Originally Posted by robob View Post
Hi Derek Mitchell,

how do you mesh your part? Is it one mesh per part or do you mesh surfaces from this part individually? What do you mean by regions in freecad? How do you create mesh regions in freecad?

greets
regions as in chtMultiRegionSimpleFoam regions
Used it upto 35 regions so far.
The FreeCad is used to create STL files these are used in snappyHexMesh to create the mesh and cellZones. Then splitMeshRegions converts the cellZones into Regions. then changeDictionary fixes up the fields.
When I cut one region from another I get a watertight interface by using the code above.
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET
derekm is offline   Reply With Quote

Old   April 13, 2018, 07:10
Default
  #9
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
Thanks for your response Derek,

you have explained more the openFOAM side of things...
Do you have multiple parts in Freecad or one single part? Do you make some groups in freecad for naming/selecting the faces and surfaces? How do you export the stl files?

My workflow in the past, which has its problems (not really watertight) was this:
1. Create one part in Freecad
2. extract/group the wanted surfaces from this part in Freecad
3. for each group of the part mesh it -> get multiple mesh files in Freecad
4. export the mesh files to stl

thank again
robob is offline   Reply With Quote

Old   April 15, 2018, 06:07
Default
  #10
Senior Member
 
Derek Mitchell
Join Date: Mar 2014
Location: UK, Reading
Posts: 172
Rep Power: 13
derekm is on a distinguished road
To create in FreeCAD two regions shell and inside.

Using part create a volume inside another outside.
Cut the inside volume from outside volume. { select inside and outside then part>boolean>cut }
Select the resulting shell and file>export as .ast.
Select the inside volume and file>export as .ast.
Rename the .ast files as .stl.
FreeCAD uses mm, to convert metre scale use surfaceMeshConvert.
__________________
A CHEERING BAND OF FRIENDLY ELVES CARRY THE CONQUERING ADVENTURER OFF INTO THE SUNSET
derekm is offline   Reply With Quote

Old   April 15, 2018, 06:11
Default
  #11
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
thanks for answering,
I will try it someday
robob is offline   Reply With Quote

Old   April 29, 2018, 11:33
Default
  #12
New Member
 
Join Date: Apr 2016
Posts: 21
Rep Power: 10
robob is on a distinguished road
okay,

the method which derekm explained, is probably the same as in Freecad: how to prepare a mesh suitable for OpenFOAM?,
which I think again is not correct because, it is not watertight. Sorry derekm.

The color section approach, specified in the first link of my post #5 https://www.cfd-online.com/Forums/op...tml#post688163
is not very good, because it is not very scriptable, and everytime some geometry is changed in dimension and is new generated you have to set the colors again...

So I search again for another approach and now I have this:
Freecad -> export as step -> import into GMSH -> make physical groups -> mesh with gmsh -> export as default `.msh` file (or similar) -> use openfoams gmshToFoam script -> then use `surfaceMeshTriangulate` to get the stl/obj.

It seems, of course a bit tedious, to generate stl/obj like this. But it has some advantages:
  1. you can use freecad
  2. you get watertight (combined) stl/obj
  3. the exported step file can be changed in dimensions and has same boundary conditions with the gmsh script and its numbering (at least if the same object within freecad is exported and only if this object has no other faces added or removed...)
  4. most this works from command line and can be automated
  5. you can use gmsh (which is one of the best open source mesher)
  6. and, if it is sufficient and snappyhexmesh is not needed, you can directly use the gmsh mesh (because of gmshToFoam)
  7. you can visually check/validate the obj files and their groups back in freecad/paraview

I also found out, that there are gmsh groups from from within FEM workbench: https://forum.freecadweb.org/viewtop...19481&start=10
You export this mesh as FEM mesh formats (*.unv, *.med, *.stl, *.dat, *.inp, *.vtk, *.vtu), I guess, which is an "smesh" object. Unfortunately I have not found out, how to get individual stl/obj files from that.
serles likes this.

Last edited by robob; April 29, 2018 at 12:34.
robob is offline   Reply With Quote

Reply

Tags
freecad 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
Creating patch on stl surface obiscolly50 OpenFOAM Pre-Processing 17 March 3, 2020 10:23
[snappyHexMesh] Checkinf if SHM stl files are watertight fracasce OpenFOAM Meshing & Mesh Conversion 2 April 25, 2017 06:50
How to create inlet/outlet/wall STL files from a STL CAD model Gentible Mesh Generation & Pre-Processing 1 June 23, 2015 10:18
Problems in compiling paraview in Suse 10.3 platform chiven OpenFOAM Installation 3 December 1, 2009 07:21
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 20:51


All times are GMT -4. The time now is 20:35.