CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Help with repairing geometry (https://www.cfd-online.com/Forums/openfoam-pre-processing/189209-help-repairing-geometry.html)

fedez91 June 15, 2017 13:40

Help with repairing geometry
 
Hello everyone,

I am writing to ask for some help with geometry preparation in order to use it in snappyHexMesh

I've been following the recommendations made by Tobias Holzzman ((1),and (2)), but I am still having trouble ending with a closed STL.

Small edges, sharp faces, and probably other things that I am not aware of are always giving me problems.

For example, I've been trying to use the geometry of a submarine I got online (STEP file) and transform it into an STL. I put the STEP file in Salome, mesh it with the same size (following the procedure recommended in (2)), and then exported it to STL, but when I perform surfaceCheck I get the following message:

Quote:

Surface is not closed since not all edges connected to two faces:
connected to one face : 0
connected to >2 faces : 2
Conflicting face labels:8
Dumping conflicting face labels to "problemFaces"
Paste this into the input for surfaceSubset

Number of unconnected parts : 1

Number of zones (connected area with consistent normal) : 3
More than one normal orientation.
I would like to know if someone could help me improve this part of the pre-processing, maybe with some tutorials or something. I attach the STL and the STEP of the submarine.

Any help will be really appreciated!!!

Files: https://drive.google.com/open?id=0B4...3o0X3lMLVlucW8 (STL file is quite heavy)

(1): https://www.youtube.com/watch?v=RFJN...L3CN4WA&t=237s

(2): https://www.cfd-online.com/Forums/op...sh-salome.html

vatavuk June 20, 2017 12:21

Hi Frederico,

You could try two programs: MeshMixer and MeshLab.
Perhaps one of them can repair your surface.

Best regards,
Paulo

student666 June 20, 2017 17:06

1 Attachment(s)
Hi,

I recently encountered this problem, and the problem I had, I think it's the same as yours.
As you said you downloaded a file, you have to check that you have not any double edges defining your patches.

To explain what I'm saying, load into salome the following dumpFile (copy and paste into a new file and save it with .py extension)
Code:

import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
sys.path.insert( 0, r'/home/winuntu/Desktop')
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)
Vertex_1 = geompy.MakeVertex(0, 0, 0)
Vertex_2 = geompy.MakeVertex(0.77, 0, 0)
Vertex_3 = geompy.MakeVertex(1, 0, 0)
Vertex_4 = geompy.MakeVertex(1, 1, 0)
Vertex_5 = geompy.MakeVertex(0, 1, 0)
Vertex_6 = geompy.MakeVertex(0, -1, 0)
Vertex_7 = geompy.MakeVertex(1, -1, 0)
Line_1 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_1)
Line_2 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
Line_3 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
Line_4 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_7)
Line_1_vertex_2 = geompy.GetSubShape(Line_1, [2])
Line_5 = geompy.MakeLineTwoPnt(Vertex_7, Line_1_vertex_2)
Face_1 = geompy.MakeFaceWires([Line_1, Line_2, Line_3, Line_4, Line_5], 1)
Line_6 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_5)
Line_7 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_4)
Line_8 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_3)
Line_9 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_1)
Face_2 = geompy.MakeFaceWires([Line_6, Line_7, Line_8, Line_9], 1)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( Vertex_1, 'Vertex_1' )
geompy.addToStudy( Vertex_2, 'Vertex_2' )
geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Vertex_5, 'Vertex_5' )
geompy.addToStudy( Vertex_6, 'Vertex_6' )
geompy.addToStudy( Vertex_7, 'Vertex_7' )
geompy.addToStudy( Line_1, 'Line_1' )
geompy.addToStudy( Line_2, 'Line_2' )
geompy.addToStudy( Line_3, 'Line_3' )
geompy.addToStudy( Line_4, 'Line_4' )
geompy.addToStudyInFather( Line_1, Line_1_vertex_2, 'Line_1:vertex_2' )
geompy.addToStudy( Line_5, 'Line_5' )
geompy.addToStudy( Face_1, 'Face_1' )
geompy.addToStudy( Line_6, 'Line_6' )
geompy.addToStudy( Line_7, 'Line_7' )
geompy.addToStudy( Line_8, 'Line_8' )
geompy.addToStudy( Line_9, 'Line_9' )
geompy.addToStudy( Face_2, 'Face_2' )
import  SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
Face_1_1 = smesh.Mesh(Face_1)
Regular_1D = Face_1_1.Segment()
Local_Length_1 = Regular_1D.LocalLength(0.05,None,1e-07)
NETGEN_2D_ONLY = Face_1_1.Triangle(algo=smeshBuilder.NETGEN_2D)
Face_2_1 = smesh.Mesh(Face_2)
status = Face_2_1.AddHypothesis(Local_Length_1)
Regular_1D_1 = Face_2_1.Segment()
NETGEN_2D_ONLY_1 = Face_2_1.Triangle(algo=smeshBuilder.NETGEN_2D)
isDone = Face_1_1.Compute()
isDone = Face_2_1.Compute()
## Set names of Mesh objects
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(NETGEN_2D_ONLY.GetAlgorithm(), 'NETGEN_2D_ONLY')
smesh.SetName(Local_Length_1, 'Local Length_1')
smesh.SetName(Face_1_1.GetMesh(), 'Face_1')
smesh.SetName(Face_2_1.GetMesh(), 'Face_2')

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

, it's just an example, but as you may see even if the two faces has same dimension (1x1x0) face1 has been defined by 5 edges while face2 with 4 edges (this is correct).
Even If I set the same local lenght hypotesis, point of the triangles are not matching, where ONE edge of face2 is matching TWO edges of face1.

If you want find out where these "not matching" triangles are, you can use surfaceSubsetDict.

Cheers

student666 June 20, 2017 17:14

1 Attachment(s)
There's also a poor-man way to look for faces that give you problem.
Open the problemFaces file.
Top number is total number of faces, other numbers are numbered faces of the mesh.
Now run paraview and import your stl file. Open on the side a spreadsheet view and select to look for cellData, scroll to your faces and use filter extract selections.
This will produce an extraction of the problemFaces.

I attach a picture.

Cheers

fedez91 June 27, 2017 14:49

Thank you all for your suggestions.

I've followed your advice and I found that the problem are a few small faces that are giving me trouble.

The problem I am having right now is that if I remove them, then my solid will not be closed, but if I try to mesh them, salome gives me an error. :confused::confused:

Then.. how can I do to deal with this?

Thanks in advance!!

student666 June 28, 2017 00:02

1 Attachment(s)
Hi,

I make you note that your problem can be threated as symmetric, so you should mesh half of the volume...you will considerably reduce your computational effort.

Further more, I have not run surfaceCheck but you should reconsider your starting geometry, as you may remove your capital letters USBN 70 and there are many small fillets (slivering faces?) I think you can remove (see example in picture), these are quite hard to be captured by SHM.

I haven't try to reproduce your errors in Salome, maybe try to post the faces you would to remove and let's see if for my above suggestions these are needed or not.

Regards

pavlossemelides August 8, 2019 05:07

Quote:

Originally Posted by student666 (Post 654201)
There's also a poor-man way to look for faces that give you problem.
Open the problemFaces file.
Top number is total number of faces, other numbers are numbered faces of the mesh.
Now run paraview and import your stl file. Open on the side a spreadsheet view and select to look for cellData, scroll to your faces and use filter extract selections.
This will produce an extraction of the problemFaces.

I attach a picture.

Cheers

I was having the same issue as the poster.
I used this method and was able to identify the problem faces. I then went back to CAD and filleted the edges of the problem faces. Problem solved!

quarkz August 22, 2020 21:06

Hi, I think you can try 3D builder in the windows store. It's a 1 click repair which works for my case. Note that your output may be shifted after that, if it lies in the negative coordinates.


All times are GMT -4. The time now is 14:51.