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/)
-   -   [Netgen] Import stl file netgen writes segmentation faulterror (https://www.cfd-online.com/Forums/openfoam-meshing/61964-import-stl-file-netgen-writes-segmentation-faulterror.html)

unoder September 28, 2005 18:02

Import stl file netgen writes segmentation faulterror
 
Hi,

I've been struggling in order to import a stl-geometry into foam and after what can be read on this forum then netgen should be able to do the task. I tried tetgen with no luck:

martin@linux:~/tetgen1.3.4> ./tetgen -pqAz ascii_r50.stl
Opening ascii_r50.stl.
Constructing Delaunay tetrahedrization.
Delaunay seconds: 0.38
Creating surface mesh.
Jettisoning redundants points.
Perturbing vertices.
Delaunizing segments.
tetgen: tetgen.cxx:16986: void tetgenmesh::delaunizesegments(): Assertion `0' failed.
Aborted

Since netgen writes something about a "segmentation fault/error", then I can't convert this stl file I want to convert...

http://www.cfd-online.com/OpenFOAM_D...s/mime_zip.gif zip_compressed_stl.zip

Any hints/recommendations? netgen isn't exactly the most user-friendly software package to install I think... Had to compile a lot and download and read a lot of instructions for first installing tcl/tk, setting environment variables etc... Perhaps the windows version is easier to install than the linux version?

mattijs September 29, 2005 05:11

I just ran surfaceCheck on you
 
I just ran surfaceCheck on your geometry. It consists of three disconnected parts and I guess this is the problem. I can run tetgen on the individual parts without problems.

I suppose netgen has the same constraints. Might have better error messages though ;-)

unoder September 29, 2005 06:56

1) Thanks for the info. I can'
 
1) Thanks for the info. I can't even start netgen because it comes with this "segmentation fault/error" after I type ./ng, so it has nothing to do with the part being disconnected. I guess something is wrong with the installation of tix-8.1.1.tar.gz...

2) surfaceCheck? Is that from inside netgen?

3) How did you manage to run tetgen on the three individual parts? From inside pro/Engineer it looks to me like if it's one part, but I just got this file from somebody else so I don't know how it was made...

mattijs September 29, 2005 13:11

2) OpenFOAM app. 3) check the
 
2) OpenFOAM app.
3) check the output of surfaceCheck. Use surfaceConvert to convert back to stl.

unoder September 30, 2005 13:29

Hello, there Thanks a lot.
 
Hello, there

Thanks a lot. That was helpful. surfaceCheck and surfaceConvert looks like some really great tools for a lot of extensions: '.ftr', '.stl', '.stlb', '.gts', '.obj', '.vtk', '.off', '.dx', '.smesh', '.ac' and '.tri'?

However, now I'm struggling with tetgenToFoam once again... I never found out how one should do the conversion from tetgen to Foam mesh, but I guess I just hoped I would be luckier with this geometry than the last time I tried to convert a geometry from a stl-file to Foam:

Exec : tetgenToFoam -startAt0 . r25 /home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0. 1
Date : Sep 10 2005
Time : 23:31:11
Host : linux
PID : 27614
Root : /home/martin/OpenFOAM/martin-1.2/run
Case : r25
Nprocs : 1
Create time

Files:
nodes : "/home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0 .1.node"
elems : "/home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0 .1.ele"
faces : "/home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0 .1.face"

Reading .file for boundary information

Numbering in files starts at 0

Read .node header:
nodes : 689
nDims : 3
nAttr : 0
hasRegion : 0

Read .ele header:
tets : 2258
pointsPerTet : 4
nAttr : 0

Segmentation fault

Did you or anyone else have an easy solution for me in this case, so that I could do a simulation on this geometry?

I would appreciate any suggestions for bringing me closer to a solution a lot. For instance: Does a forum for netgen-related installation problems exist, so I perhaps could try to see what netgen can do here, if netgen is able to export the mesh into something usable?

unoder September 30, 2005 14:04

Ok, I inserted a lot of info-s
 
Ok, I inserted a lot of info-statements and found out that the place where this Segmentation fault occurs, is close to this loop (around line 280-285 in tetgenToFoam.C):

if (startAt1)
{
--elemI;
}

for (label i = 0; i < 4; i++)
{
label nodeI;

eleLine >> nodeI;

However, I can' t see what's happening here since I don't really understand this program code.

mattijs September 30, 2005 14:18

Hi Martin, last time you ca
 
Hi Martin,

last time you came across an error in:

cells[elemI] = cellShape(tet, tetPoints);

According to the printout you have 2258 tets and 689 points/vertices/nodes in your file.

So does your tet numbering in your file go from 0..2257 (0..688 for points) or from 1..2258?

If so use the startAt1 flag since all Foam numbering starts at 0.

unoder September 30, 2005 16:20

Hi, The .ele file: 2258 4
 
Hi,

The .ele file:
2258 4 0
1 11 292 2 233
--------- cut a lot
2257 44 42 424 285
2258 285 42 424 45
# Generated by /home/martin/tetgen1.3.4/tetgen -f samlet_indloeb_r25_0.stl

The .node file:
689 3 0 0
1 3.78254 57.274900000000002 -0.94767500000000005
------------ cut a lot ------
688 -3.482773518325156 -25.063109137128237 -0.85637047580471404
689 -3.4406803462507036 -25.06484817786512 -0.94766313573558147
# Generated by /home/martin/tetgen1.3.4/tetgen -f samlet_indloeb_r25_0.stl

Just to be sure that the format of the data files are correct:
The .face file:
1374 0
1 1 234 233
------- cut a lot -----
1374 364 367 689
# Generated by /home/martin/tetgen1.3.4/tetgen samlet_indloeb_r25_0.stl


The .smesh file:
# samlet_indloeb_r25_0.1.smesh. TetGen's input file.

# part 1: node list.
689 3 0 0
1 3.78254 57.274900000000002 -0.94767500000000005
------ cut a lot -----
689 -3.4406803462507036 -25.06484817786512 -0.94766313573558147

# part 2: facet list.
1374 0
3 233 234 1
------- cut a lot ----
3 364 689 367

# part 3: hole list.
0

# part 4: region list.
0
# Generated by /home/martin/tetgen1.3.4/tetgen samlet_indloeb_r25_0.stl


So I guess this would mean that it's correct to start with the startAt1 flag, which should be the default but this doesn't work (and that's why I tried the startat0-option):

Exec : tetgenToFoam . r25 /home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0. 1
Date : Sep 11 2005
Time : 02:01:44
Host : linux
PID : 31733
Root : /home/martin/OpenFOAM/martin-1.2/run
Case : r25
Nprocs : 1
Create time

Files:
nodes : "/home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0 .1.node"
elems : "/home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0 .1.ele"
faces : "/home/martin/OpenFOAM/martin-1.2/run/r25/constant/polyMesh/samlet_indloeb_r25_0 .1.face"

Reading .file for boundary information

Numbering in files starts at 1

Read .node header:
nodes : 689
nDims : 3
nAttr : 0
hasRegion : 0



--> FOAM FATAL ERROR : point numbering not consecutive for node 1 or numbering starts at 0 or 1. Perhaps rerun w/o -startAt0 option?

I haven't got a clue, since I would assume that Foam is able to read the output from tetgen, but perhaps I need to pass some special arguments to tetgen other than -f (and sometimes I ran it without arguments, still same result).

unoder October 2, 2005 10:26

Solution to the problem - HOWT
 
Solution to the problem - HOWTO:

1)
follow this proposal by Stefan

2)
Use:
tetgenToFoam <root> <case> <file> -noFaceFile

3)
Use: patchTool - if it doesn't show the right geometry, I do a: PatchToolServer <root> <case> and then it works.

Result:
http://www.cfd-online.com/OpenFOAM_D...ges/1/1198.jpg

Then there should be no confusion about importing .stl files anymore, I hope?


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