CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [CAD formats] Creating waterproof STL using snappyHexMesh or salome (https://www.cfd-online.com/Forums/openfoam-meshing/170210-creating-waterproof-stl-using-snappyhexmesh-salome.html)

Tobi April 26, 2016 13:20

Creating waterproof STL using snappyHexMesh or salome
 
2 Attachment(s)
Dear all,

the last few years I experienced the necessity of a good surface triangulation while using snappyHexMesh. Most people are using common CAD software packages and export single surfaces as STL files. These STL files have two big problems, if they represent a closed volume:

  • If the whole model is exported, the volume is closed, but the triangulation is very bad
  • If you export the model in several steps (several STL's), the connected edges share not the same points (never be waterproof; see image below)
  • Crazy never ending triangles that go to infinity small areas (image below)
Attachment 47017

Both (and especially the second one) influences the mesh generation in a very bad way. The good thing is that in some case it does not matter ;). The bad thing is, that you could really get unexpected results (I made a lot of tests with my collegue Dr. Alexander Vakhrushev). Some unexpected results were:
  • regionRefinement refined cells that were far away from the region (inside mode); it seems that it propagates through the never ending triangle of the surface
  • snapping problems
  • due to snap problems the layer generation was influenced too
  • other unexpeced behavior with refinement, snapping and zones
  • Finally it could happend that snappyHexMesh can not recognize which fluid domain should be used (no cells will be removed, this happen due to gaps)
To avoid this I highly recommend to use a) a nice triangulated surface for each patch and b) a water proofed STL if it represent a closed surface (that means the shared edges have to be identical for each STL). For a) + b) you could use blender and/or salome. Both software packages offer a lot of features but for engineers I think salome is the first choice. This would be the best solution in my opinion because you end up with the exact surface, nice triangulation and a waterproofed STL. This is not always a simple task but could be handled.

Not water proofed STL have a further bad behavior in the point of feature edges. STL's (or region STL) that share share a curvatured edge will end up with two feature edges due to the fact that the STL's share not the same points (and therefore not the same edge). After creating the feature edges, you will extract both feature edges. Now ask yourself, which line should be used? (Here one comment, please check your featureEdge mesh using paraview and correct it if its wrong with blender).
  • Since I use well triangulated STL's that share the same points at the interface, I always end up with the expected results while using snappyHexMesh and more over, the result is better.
If you do not want to build the closed nice triangulated STL using Salome or Blender, you can use snappyHexMesh instead. The result is not as accurate as the triangulation using Salome but finally you will end up with a waterproofed STL. To do that, you just have to use your non-closed STL and mesh it with snappyHexMesh as accurate as you can (note, that here you can get really problems). The important thing is not the mesh quality - it is the surface accuracy (all edges should be correct projected etc.). Maybe you also can unset all quality criteria for that procedure because the internal mesh is not needed. If you have the snapped mesh, you just have to use the following command:
Code:

surfaceMeshTriangulate myNewSurface.stl
The nice thing is, that all regions that you build before will stay in the new STL. The bad thing is, that the snapping could fail in some parts and therefore the new STL stores the failed surface. The good thing is, that you will end up with a 100% waterproofed STL and you can refine the surfaces and gaps as much as you want now without moving into a danger zone (cell size is small enough that snappyHexMesh will realize the gaps). One example is shown above.

Attachment 47016

The procedure is as follow (short form summarized and clear):
  • Using non-closed STL and mesh it as good as possible (castellated + snap)
  • Extract the surface with the command above
  • Use the new STL for the further proceeding
Keep in mind that the STL you will never be as accurate as you will make it with salome but you will definitly get a waterproofed STL.


My personal suggestions are:
  • using Salome and Blender for triangulation of the surface
  • always check the featureEdge mesh that you extract
If you make these steps, you will see that meshing gets easier. Some examples of triangulated surfaces can be found in my tutorials.


If you have to mesh a lot of different designs, I would prefer the generation of the STL using snappyHexMesh. You also can implement this way into a optimization loop.
So good luck and keep foaming, hope this will help somebody.

derekm May 5, 2016 18:12

So far freecad 0.16 seems to generate "waterproof " stl

vigneshTG June 11, 2016 10:40

Non -closed
 
1 Attachment(s)
Hi Tobi,

Can you tell me how to create a closed stl file when we combine individual surfaces (stl file) manually after labeling them ?

I always get "surface is not closed" when i do a surface check for the combined stl file but it does not happen for the stl file of the part. Can you tell me what i am doing wrong ?? I have attached the files

PS: I used salome for creating the solid which i exploded into individual surfaces.

Tobi June 11, 2016 10:52

Dear Vignesh,

if you have several surfaces in Salome you are not allowed to export these surfaces in the geometry module. You have to mesh the surfaces in the mesh module to make a homogeneous discretization on the lines. If you export these STL files then you end up with a waterproofed STL. That is the way I prefer for all STL's.

To check it, just load your exported STL into paraview. You will see that the contact lines will not share the same triangle points.

vigneshTG June 11, 2016 12:06

1 Attachment(s)
Quote:

Originally Posted by Tobi (Post 604415)
Dear Vignesh,

if you have several surfaces in Salome you are not allowed to export these surfaces in the geometry module. You have to mesh the surfaces in the mesh module to make a homogeneous discretization on the lines. If you export these STL files then you end up with a waterproofed STL. That is the way I prefer for all STL's.

To check it, just load your exported STL into paraview. You will see that the contact lines will not share the same triangle points.

Dear Tobi,

Thanks for the quick reply. I tried as you suggested, still i get "surfaces is not closed"
:confused:. By the way when i view the combined stl file in paraview the contact lines share same triangle points !!

Tobi June 11, 2016 13:37

1 Attachment(s)
Hi,

if you check our STL it is not closed. Each surface has different points on the interface. The interface does not share the points of both surfaces. See the picture (for you it should be obvious). Check out my STL's in my tutorials and you see that the interface (the line that is shared by both) has the same points on both surfaces.

vigneshTG June 12, 2016 06:51

Hi Tobi,

I understood the mistake that i made during meshing in salome. Thanks for pointing it out.

Now its working :D

sisetrun July 22, 2016 11:22

Hey Tobias,

I tried to reproduce your workflow:

-stl generation in salome
-created groups
-created edges of the groups
-change to mesh mode
-triangulated the geometry by meshing
-made mesh groups of the patches

BUT... when I combine the patches in in big file, I still get unconnected surfaces...
What point do I miss?
I want the stl file as input for cfMesh!

Thanks a lot for your advice!

Best regards,

Sebastian
At this point, I

vigneshTG July 22, 2016 12:06

Hi Sebastian,

Did you keep the edge length same for all faces (groups) while meshing ?

sisetrun July 25, 2016 02:28

Hey Vignesh,

Jap, I did not change any settings for the meshing!

How is your workflo9w? Which geometry parts do you use?
I am not sure if I have to use the whole geometry to mesh (how do i capture feature edges) or if a mesh the grouped geometry parts on their own with the same settings?

Just from viewing the stl in paraview, it was fine. The triangles in the areas where the patches touch each looked quite nice...

Thanks again...

Best regards,

Sebastian

vigneshTG July 25, 2016 02:44

Hi Sebastian,

My workflow in salome is

  • Generate the cad geometry
  • Explode them to faces, group them if needed
  • Mesh each face/group with same mesh size
  • export each face/group individually in STL format
  • Then modify each exported stl file (solid -> solid outlet, endsolid -> endsolid outlet) and combine them into one single file
  • perform surfaceCheck to check whether the combined stl file is closed.
So far i am working on V-groove. When you are meshing each surface make sure you take the same mesh size (do it manually), by default salome may take values which might not be the same for all faces.


Hope this helps you


Quote:

Originally Posted by sisetrun (Post 611171)
Hey Vignesh,

Jap, I did not change any settings for the meshing!

How is your workflo9w? Which geometry parts do you use?
I am not sure if I have to use the whole geometry to mesh (how do i capture feature edges) or if a mesh the grouped geometry parts on their own with the same settings?

Just from viewing the stl in paraview, it was fine. The triangles in the areas where the patches touch each looked quite nice...

Thanks again...

Best regards,

Sebastian


sisetrun July 25, 2016 02:49

Thanks a lot for your fast replay!
I will give it a try on my geometry and report the result...

sisetrun July 25, 2016 08:00

All good (for the moment :D )
Thank you so much!

Txinsoulkg July 28, 2016 12:01

1 Attachment(s)
Hi vigneshTG,
I'm using meshLab to convert text file to stl format. After that, I've used surfaceCheck to check my geometry. End of surfaceCheck, surface is not closed errors are shown no matter how I try to fix with admesh or meshLab. How should I fix that problem? Please advice me!! thanks

Tobi July 28, 2016 13:18

Then use salome to create your STL.
If you have single STL's it will not work.

Txinsoulkg August 5, 2016 05:37

Dear Tobi,
Thanks for your reply and suggest.
Can I use salome even my terrain is topography?

dscian November 29, 2016 08:32

Dear Tobi,

I was having problems for days and now that actually hits the spot. I will try Salome right quick, thanks.

Utkan

derekm December 3, 2016 09:15

The salome user interface is a little clunky, and for anything complex or repetitive you will need the script interface. This script interface can also help in understanding the work flow needed. In the attached salome python script I have created the stl files and UNV file for the snappyhexmesh tutorial for Chtmultiregion.
In this script you can see:
  • the creation of the geometry of the regions
  • the partitioning of the background box
  • creation of patches and wall groups
  • the creation of the region meshes
  • creation of the stl files
Code:

# -*- coding: utf-8 -*-

###
### This file  is salome script that shows how to create meshs sutiable for openFOAM
#    it uses the geometry from
# run/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation
# then use in
# run/tutorials/mesh/snappyHexMesh/snappyMultiRegionHeater

#######
import sys
import salome

salome.salome_init()
theStudy = salome.myStudy

import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
sys.path.insert( 0, r'/home/derekm/salwork')

###
### GEOM component
###

import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS


geompy = geomBuilder.New(theStudy)

O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)

#######
# create tutorial geometry from vertexes  as in tutorial

#######

heater_b1_p1_ = geompy.MakeVertex(-0.01, 0, -0.05)
heater_b1_p2_ = geompy.MakeVertex(0.01, 0.01, 0.05)
heater_b2_p1_ = geompy.MakeVertex(-0.01, -0.04, -0.01)
heater_b2_p2_ = geompy.MakeVertex(0.01, 0.01, 0.01)
heater_b1 = geompy.MakeBoxTwoPnt(heater_b1_p1_, heater_b1_p2_)
heater_b2 = geompy.MakeBoxTwoPnt(heater_b2_p1_, heater_b2_p2_)
left_p1_ = geompy.MakeVertex(-0.1, 0, -0.05)
left_p2_ = geompy.MakeVertex(-0.01, 0.01, 0.05)
left_c = geompy.MakeBoxTwoPnt(left_p1_, left_p2_)
right_p1 = geompy.MakeVertex(0.01, 0, -0.05)
right_p2 = geompy.MakeVertex(0.1, 0.01, 0.05)
right_c = geompy.MakeBoxTwoPnt(right_p1, right_p2)
top_p1 = geompy.MakeVertex(-0.1, 0.01, -0.05)
top_p2_ = geompy.MakeVertex(0.1, 0.04, 0.05)
top_c = geompy.MakeBoxTwoPnt(top_p1, top_p2_)
all_p1_ = geompy.MakeVertex(-0.1, -0.04, -0.05)
all_p2 = geompy.MakeVertex(0.1, 0.04, 0.05)
all = geompy.MakeBoxTwoPnt(all_p1_, all_p2)
[minXall,minYall,minZall,maxZall,maxYall,maxXall] = geompy.ExtractShapes(all, geompy.ShapeType["FACE"], True)
bottom_c = geompy.MakeCutList(all, [heater_b1, heater_b2, left_c, right_c, top_c], True)
heater_c = geompy.MakeFuseList([heater_b1, heater_b2], True, True)


##

geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( heater_b1_p1_, 'heater_b1_p1' )
geompy.addToStudy( heater_b1_p2_, 'heater_b1_p2' )
geompy.addToStudy( heater_b2_p1_, 'heater_b2_p1' )
geompy.addToStudy( heater_b2_p2_, 'heater_b2_p2' )
geompy.addToStudy( heater_b1, 'heater_b1' )
geompy.addToStudy( heater_b2, 'heater_b2' )
geompy.addToStudy( left_p1_, 'left_p1' )
geompy.addToStudy( left_p2_, 'left_p2' )
geompy.addToStudy( left_c, 'left_c' )
geompy.addToStudy( right_p1, 'right_p1' )
geompy.addToStudy( top_p1, 'top_p1' )
geompy.addToStudy( right_p2, 'right_p2' )
geompy.addToStudy( right_c, 'right_c' )
geompy.addToStudy( top_p2_, 'top_p2' )
geompy.addToStudy( top_c, 'top_c' )
geompy.addToStudy( all_p1_, 'all_p1')
geompy.addToStudy( all_p2, 'all_p2' )
geompy.addToStudy( all, 'all' )
geompy.addToStudy( bottom_c, 'bottom_c' )
geompy.addToStudy( heater_c, 'heater_c' )

##############
#  build region groups
##############

# build partition object

Partition_1 = geompy.MakePartition([all], [left_c, right_c, top_c, bottom_c, heater_c], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
#######

geompy.addToStudy( Partition_1, 'Partition_1' )



### collect face ids  for each region using the region shape
top_cfaces = geompy.GetShapesOnShapeIDs(top_c, Partition_1, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
right_cfaces = geompy.GetShapesOnShapeIDs(right_c, Partition_1, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
left_cfaces = geompy.GetShapesOnShapeIDs(left_c, Partition_1, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
heater_cfaces = geompy.GetShapesOnShapeIDs(heater_c, Partition_1, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
bottom_cfaces = geompy.GetShapesOnShapeIDs(bottom_c, Partition_1, geompy.ShapeType["FACE"], GEOM.ST_ONIN)


### create groups for each region
top = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(top, top_cfaces)
geompy.addToStudyInFather(Partition_1, top, "top")


right = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(right, right_cfaces)
geompy.addToStudyInFather(Partition_1, right, "right")


left = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(left, left_cfaces)
geompy.addToStudyInFather(Partition_1, left, "left")

heater = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(heater, heater_cfaces)
geompy.addToStudyInFather(Partition_1, heater, "heater")

bottom = geompy.CreateGroup(Partition_1, geompy.ShapeType["FACE"])
geompy.UnionIDs(bottom, bottom_cfaces)
geompy.addToStudyInFather(Partition_1,bottom, "bottom")
###########################
#patches and wall groups
###########################

#use planes to collect  patch and wall faces from the bounding object

minX_ids= geompy.GetShapesOnPlaneWithLocationIDs    (
        all,geompy.ShapeType["FACE"],OX,all_p1_,GEOM.ST_ON)       
minY_ids= geompy.GetShapesOnPlaneWithLocationIDs    (
        all,geompy.ShapeType["FACE"],OY,all_p1_,GEOM.ST_ON)
minZ_ids= geompy.GetShapesOnPlaneWithLocationIDs    (
        all,geompy.ShapeType["FACE"],OZ,all_p1_,GEOM.ST_ON)

maxX_ids= geompy.GetShapesOnPlaneWithLocationIDs    (
        all,geompy.ShapeType["FACE"],OX,all_p2,GEOM.ST_ON)
maxY_ids= geompy.GetShapesOnPlaneWithLocationIDs    (
        all,geompy.ShapeType["FACE"],OY,all_p2,GEOM.ST_ON)
maxZ_ids= geompy.GetShapesOnPlaneWithLocationIDs    (
        all,geompy.ShapeType["FACE"],OZ,all_p2,GEOM.ST_ON)

# create groups

minX = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
minY = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
minX = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
minZ = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
maxX = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
maxY = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
maxZ = geompy.CreateGroup(all, geompy.ShapeType["FACE"])
geompy.UnionIDs(minX, minX_ids)
geompy.UnionIDs(minY, minY_ids)
geompy.UnionIDs(minZ, minZ_ids)
geompy.UnionIDs(maxX, maxX_ids)
geompy.UnionIDs(maxY, maxY_ids)
geompy.UnionIDs(maxZ, maxZ_ids)

geompy.addToStudyInFather(all,minX, "minX")
geompy.addToStudyInFather(all,minY, "minY")
geompy.addToStudyInFather(all,minZ, "minZ")
geompy.addToStudyInFather(all,maxX, "maxX")
geompy.addToStudyInFather(all,maxY, "maxY")
geompy.addToStudyInFather(all,maxZ, "maxZ")
###
#
# meshing
#
##
import  SMESH, SALOMEDS
from salome.smesh import smeshBuilder
###
#  basemesh often created in blockmesh here we get salome to do it and create the patches
#
###
smesh = smeshBuilder.New(theStudy)
all_Mesh = smesh.Mesh(all)
Regular_1D = all_Mesh.Segment()
Local_Length_1 = Regular_1D.LocalLength(0.01,None,1e-07)
Quadrangle_2D = all_Mesh.Quadrangle(algo=smeshBuilder.QUADRANGLE)
Hexa_3D = all_Mesh.Hexahedron(algo=smeshBuilder.Hexa)
Local_Length_1.SetLength( 0.01 )
Local_Length_1.SetPrecision( 1e-07 )
isDone = all_Mesh.Compute()
# patches and walls
minX_1 = all_Mesh.GroupOnGeom(minX,'minX',SMESH.FACE)
minY_1 = all_Mesh.GroupOnGeom(minY,'minY',SMESH.FACE)
minZ_1 = all_Mesh.GroupOnGeom(minZ,'minZ',SMESH.FACE)
maxX_1 = all_Mesh.GroupOnGeom(maxX,'maxX',SMESH.FACE)
maxY_1 = all_Mesh.GroupOnGeom(maxY,'maxY',SMESH.FACE)
maxZ_1 = all_Mesh.GroupOnGeom(maxZ,'maxZ',SMESH.FACE)
try:
  all_Mesh.ExportUNV( r'/home/derekm/salwork/tmp/all_Mesh.unv' )
except:
  print 'ExportUNV() failed. Invalid file name?'

#
#  region meshes
#

Local_Length_2 = smesh.CreateHypothesis('LocalLength')
Regular_1D_1 = smesh.CreateHypothesis( "Regular_1D" )
MEFISTO_2D = smesh.CreateHypothesis('MEFISTO_2D')
Local_Length_2.SetLength( 0.005 )
Local_Length_2.SetPrecision( 1e-07 )


# topAir
topAir = smesh.Mesh(top)
status = topAir.AddHypothesis(Local_Length_2)
Regular_1D_2 = topAir.Segment()
status = topAir.AddHypothesis(MEFISTO_2D)
isDone = topAir.Compute()
topAir.SetName( 'topAir' )
try:
  topAir.ExportSTL( r'/home/derekm/salwork/tmp/topAir.stl', 1 )
except:
  print 'ExportSTL() failed. Invalid file name?'

#LeftSolid
leftSolid = smesh.Mesh(left)
status = leftSolid.AddHypothesis(Local_Length_2)
Regular_1D_2 = leftSolid.Segment()
status = leftSolid.AddHypothesis(MEFISTO_2D)
isDone = leftSolid.Compute()
leftSolid.SetName( 'leftSolid' )
try:
  leftSolid.ExportSTL( r'/home/derekm/salwork/tmp/leftSolid.stl', 1 )
except:
  print 'ExportSTL() failed. Invalid file name?'
 
#rightSolid
rightSolid = smesh.Mesh(right)
status = rightSolid.AddHypothesis(Local_Length_2)
Regular_1D_2 = rightSolid.Segment()
status = rightSolid.AddHypothesis(MEFISTO_2D)
isDone = rightSolid.Compute()
rightSolid.SetName( 'rightSolid' )
try:
  rightSolid.ExportSTL( r'/home/derekm/salwork/tmp/rightSolid.stl', 1 )
except:
  print 'ExportSTL() failed. Invalid file name?'

#heater
heater_1 = smesh.Mesh(heater)
status = heater_1.AddHypothesis(Local_Length_2)
Regular_1D_2 = heater_1.Segment()
status =heater_1.AddHypothesis(MEFISTO_2D)
isDone = heater_1.Compute()
heater_1.SetName( 'heater' )
try:
  heater_1.ExportSTL( r'/home/derekm/salwork/tmp/heater.stl', 1 )
except:
  print 'ExportSTL() failed. Invalid file name?'


#bottomAir
bottomAir = smesh.Mesh(bottom)
status = bottomAir.AddHypothesis(Local_Length_2)
Regular_1D_2 = bottomAir.Segment()
status =bottomAir.AddHypothesis(MEFISTO_2D)
isDone = bottomAir.Compute()
bottomAir.SetName( 'bottomAir' )
try:
  bottomAir.ExportSTL( r'/home/derekm/salwork/tmp/bottomAir.stl', 1 )
except:
  print 'ExportSTL() failed. Invalid file name?'


if salome.sg.hasDesktop():
  salome.sg.updateObjBrowser(1)


Tobi December 10, 2016 19:42

I do not agree with your statement. I am using Salomes GUI for really high complex geometries and till now I could do anything without the python interface. Of course you can get a lot of information out of the python script and it allows to use it for optimization but the necessity of python for complex geometry - no, I cannot agree.

Sent from my HTC One mini using CFD Online Forum mobile app

derekm December 11, 2016 08:30

Quote:

Originally Posted by Tobi (Post 629093)
I do not agree with your statement. I am using Salomes GUI for really high complex geometries and till now I could do anything without the python interface. Of course you can get a lot of information out of the python script and it allows to use it for optimization but the necessity of python for complex geometry - no, I cannot agree.

Sent from my HTC One mini using CFD Online Forum mobile app

Everything is relative... my current work involves over 700 basic shapes

Tobi December 11, 2016 17:19

Yes I agree :)
In my case, I am using STEP files from grabcad which are sometimes really crazy. So I just wanted to state, that the GUI can also handle complex geometries. However, I think doing everything in python is much faster but I cannot do it because I am too lazy to learn Salome + Python in a good way...

enginpower December 22, 2016 11:23

Thanks to all for this helpful discussion.

I'm a beginner, and me too I need a solution for a similar problem. Sorry to need a more deep help, but maybe it will be useful for all beginners.

The procedure you explained is the following (I'm quoting one of you):
  • Generate the cad geometry: I exported the geometry from the CAD, all ok
  • Explode them to faces, group them if needed: I import the STL file in Salome. Then I explode it in faces, and I group them as I need (inlet, wall, surface2refine, etc...). Right? Is necessary to explode, or could I create the group anyway?
  • Mesh each face/group with same mesh size: I move to Mesh section of Salome, then I create a mesh. Which algorithm? I should mesh only the surfaces? How? Only 2D meshes?Just default mesh settings? Please, could you provide more clear information?
  • export each face/group individually in STL format: Will each mesh be exported separately? Or what?
  • Then modify each exported stl file (solid -> solid outlet, endsolid -> endsolid outlet) and combine them into one single file: is there an order to follow? which part is the up-part? No mind?
  • perform surfaceCheck to check whether the combined stl file is closed: how to use this command?
Sorry if most of them are stupid questions, but it will help me a lot (I'm very newbie).



Thanks

sisetrun January 3, 2017 05:50

Hey Valentine,

to your second point:
try to export the geomerty as .step from you CAD.
Then, load the .step in salome Geometry! Make you patches with New Entity - Group - Crate Groupe!
After that, you switch to Salome Mesh by clicking on the icon. Here, you can mesh your groups. Select the geometry. Mesh type is Triangular. Then, select your 2D (Triangle Mefsto) and 1D (Wire). The 1D should be the same for contacting groups. This is important waterproof stl. You can play around with the discretisation hypothesis go get the proper result.
After you "stl-meshing" you can export the parts of your geometry as stl and continue with the steps you already have mentioned.

Hope this works for you...

Best regards

Sebastian

enginpower January 3, 2017 07:50

good explanation for that

Thanks

Is it possible that dividing a solid in stl patches like inlet, wall and outlet become huger when meshed?
What I mean is that: I meshed a solid as stl file and I succeeded, then I divided it following your procedure in three parts, that are inlet, wall, and outlet stl files, but when I meshed with the same snappyHexMesh conditions it overcomes the need of RAM.
I divided it to set the buondary conditions later in the simulation step.

Is it possible?

Vignesh2508 January 22, 2017 08:57

4 Attachment(s)
Hi Tobi,

Your post was interesting. I was trying to mesh a car stl file and the mesh I got after doing sHM seems quite bad. But i did not know if it is because of the reason you mentioned in your post. Could you take a look at the pictures i attached and give me a reply.


Thanks

Vicky

Tobi January 23, 2017 08:54

Hey Vikki,

how would you like to have a good mesh if your resolution is not good? However, you mean the small misfits of snapping? I think you can handle that with different settings, change and analyze the feature edges etc.

If someone is interested, check out this. I think there is no need for further discussions then ;)

https://www.cfd-online.com/Forums/op...e-scratch.html

Vignesh2508 January 23, 2017 10:15

Hi Tobi,

Thank you for your reply. This might be the problem. My stl file is a 3d model of a car. But I was trying to do a 2D simulation from that. My idea was to do a sHM on the model and then finally do an extrudeMesh to convert that to a 2D mesh. In my blockmesh file i tried to choose a domain of thickness 0.1m.

In this domain of 0.1m the model is not protruded straight but has an angle. This might be the reason why i got the problem on the interface between the surface and the mesh. Even if i add layers that is not properly applied on the surface.

Can you suggest me a method to do a 2D simulation of that without this problem?


Thanks


Vicky

enginpower January 30, 2017 09:59

Hello,
I followed the methods explained here to get a closed STL file but with different patches. As in the tutorial, I have different patches and I created correctly submesh to accord the mesh on common edges. It works greatly.

When I checked the surface I get this:
Code:

Surface is not closed since not all edges connected to two faces:
    connected to one face : 192
    connected to >2 faces : 0

I watched again all the model and I found that the problem is that some surfaces of the same group is not connected. How is it possible?
I have the group of inlet surfaces, the group of wall surfaces etc... and looking to the group of wall (the same mesh), I have some surfaces that are not connected. Again the problem is not between inlet surface group and wall surface group, but in the same group. How to solve that? It seems does not occur in the tutorials

Thanks for your help

silencebreak August 4, 2017 09:09

Hey there,

I'm trying to create a waterproofed STL for OpenFOAM with salome. I've created them in other cases without problems the way Tobi described.

After I created a solid out of the geometry in salome, which is done without any errors, the surfaceCheck in OpenFOAM tells me that my case isn't waterproofed. So how does it come that salome says it's waterproofed and openfoam says it isn't?
The error is that some are single and some a multiply connected. If interested I can upload the .hdf file :)

Thank you in advance :)

sisetrun August 7, 2017 02:10

Hello Oliver,

Did you mesh your solid before exporting as an stl?

have a look at Tobis screencast on youtube:

https://www.youtube.com/watch?v=NBmB...GLaiE2oL3CN4WA

Best regards

silencebreak August 10, 2017 08:11

Quote:

Originally Posted by sisetrun (Post 659705)
Hello Oliver,

Did you mesh your solid before exporting as an stl?

have a look at Tobis screencast on youtube:

https://www.youtube.com/watch?v=NBmB...GLaiE2oL3CN4WA

Best regards

Thanks for the reply. Actually I thinks it's been an error of handling Salome with an extreme case of open boundaries. So I just draw my stuff from the scratch and now it worked after creating a single solid :)

alinuman15 November 24, 2017 16:40

1 Attachment(s)
Quote:

Originally Posted by Tobi (Post 604415)
Dear Vignesh,

if you have several surfaces in Salome you are not allowed to export these surfaces in the geometry module. You have to mesh the surfaces in the mesh module to make a homogeneous discretization on the lines. If you export these STL files then you end up with a waterproofed STL. That is the way I prefer for all STL's.

To check it, just load your exported STL into paraview. You will see that the contact lines will not share the same triangle points.

Dear Tobi:-
I have struggled with exporting mesh as stl file by using Salome for a while. Look at the inserted image where when I mesh the surface in mesh module and export it as stl , I face that warning and even when I skip it, it will not produce the good waterproofed stl file.
Any clue how to handle that ?
Knowing that I installed different versions of Salome ( now Meca 2017) but the problem still there.
Thanks !

Tobi November 24, 2017 16:45

Hi,

the error message you get is normal. I got the same message too. Hmmm... actually never focused that problem. Can you upload the STL file of that particular patch? You can try exporting
Code:

LC_ALL=C
start Salome and try it again. However, Salome itself should overwrite (temporary) based on that output:
Code:

WARNING:salomeContext:Overwriting environment variable: LC_NUMERIC=C
I am using the Salome version given at Salome-Platforms.

alinuman15 November 24, 2017 19:39

1 Attachment(s)
Quote:

Originally Posted by Tobi (Post 672790)
Hi,

the error message you get is normal. I got the same message too. Hmmm... actually never focused that problem. Can you upload the STL file of that particular patch? You can try exporting
Code:

LC_ALL=C
start Salome and try it again. However, Salome itself should overwrite (temporary) based on that output:
Code:

WARNING:salomeContext:Overwriting environment variable: LC_NUMERIC=C
I am using the Salome version given at Salome-Platforms.

Thank you for replying Tobi :-)
I typed LC_ALL=C in terminal (without defining OF environment) and it defined LC_ALL environmental variable fine. But, I got the same warning when tried to export the inserted file agin on mesh module.
Waiting for your feedback
Note:- You could find the regionSTL.stl ( for the whole patches) on the following link:-
https://drive.google.com/drive/u/0/f...l82TEl6NNXJFGP

Tobi November 25, 2017 01:48

Can you dump the study as python Script and share it? The warning is common.

alinuman15 November 25, 2017 09:01

1 Attachment(s)
Quote:

Originally Posted by Tobi (Post 672802)
Can you dump the study as python Script and share it? The warning is common.

I attached the dump study and have another question ( in addition to the warning):-
As you can see the triangle and background stls together represent the bottom of the cube. If my focus is to refine them only with snappyHexMesh (knowing that all the rest stls are patches as well), is that true to include just triangle and background inside the features subdictionary of castellatedMeshControls as follows:-
features
(
{file "triangle.eMesh"; level 3;}
{file "background.eMesh"; level 3;}
);
?
Thanks again!

Tobi November 25, 2017 09:38

Hi,

if you want to refine surface this is wrong. Please check that: https://holzmann-cfd.de/training/sta...enfoam-project

You study and the export is working as expected. Maybe you are doing: File -> Export -> STL. That is wrong. Go to mesh module, right click on the object you want to export -> Export -> STL. Done.

alinuman15 November 25, 2017 12:38

Quote:

Originally Posted by Tobi (Post 672842)
Hi,

if you want to refine surface this is wrong. Please check that: https://holzmann-cfd.de/training/sta...enfoam-project

You study and the export is working as expected. Maybe you are doing: File -> Export -> STL. That is wrong. Go to mesh module, right click on the object you want to export -> Export -> STL. Done.

I did it that way but the warning is still showing up.

RANSES August 31, 2018 12:34

guidelines for Blender exporting .stl?
 
Dear all :)

I profit from the open thread for asking few questions on the same topic.
I'm working on ABL (Atmospheric Boundary Layer), simulating the flow-field around buildings or city districts (real scale), with a geometry whose dimensions can easily reach more than one kilometer in radius. Recently I tried to simulate the Shinjuku district of Tokyo in OpenFoam, facing a huge number of difficulties, starting from the construction of the mesh.
As stressed before in this thread, I use blender to create/edit the geometries and to export them in .stl, for finally meshing in snappyHexMesh.
The original .stl file on which I'm working can be easily downloaded from https://www.aij.or.jp/jpn/publish/cfdguide/index_e.htm , it is free of copyright. Since the high instability of the simulations, I also fear there could be a problem in the geometry.
In this regard I would like to ask you if Blender could still be considered as a useful/proper software for fixing these problems (from a geometry check, there are many of them: non manifold edges, bad contain. edges, intersect face, etc)....and if there are some good suggestions on how to export in the best way a .stl from blender to be finally used in OpenFOAM... e.g. the geometry should be triangulated or quadrilateral?
What I fear is that, in some conditions, there could be better software than blender for modeling the geometry to be used in CFD. Is this a legit fear?
If you could share your personal experience and suggestions, it would be much appreciated. :)

SOORYA February 1, 2019 01:57

Clarifications regarding SnappyHexMesh
 
3 Attachment(s)
Dear Sir,


I am an MTech Student from IIT Bombay. I am simulating continous casting of steel systems. I have made the geometry in SolidWorks. Have imported the .STEP file in Salome and created various groups like inlet outlet as .STL files. I have merged the various .STL files in terminal as single .STL file. While performing snappyHexMesh command on the single merged .STL file i am not getting many features similar to my SolidWorks geometry. Unable to find out the reason for the same. Kindly help.


Mail Id: sooryaprakashj@gmail.com

Regards,
Soorya Prakash


All times are GMT -4. The time now is 18:57.