[Gfs-users] STL to GTS Conversion

473 views
Skip to first unread message

Stephen Osborn

unread,
Aug 24, 2009, 2:45:42 PM8/24/09
to gfs-...@lists.sourceforge.net
I am an embedded programming guy, not a CFD specialist. However, I consult for a company that builds products for air flow measurements, and ask if I could run Gerris on one of their products.

I have the Gerris 2D tutorial running and now need to extend that knowledge to 3D. As a test I built a simple cube using Google Sketchup and a free STL exporter tool, the cube.stl file is attached. When I try to convert the cube.stl file into cube.gts I get the following error.

stephen@Ubuntu:/media/vbshare$ stl2gts -v <cube.stl > cube.gts
Input file is not a valid STL file
stdin:4:16: expecting a number (z-coordinate)

I did a quick look at the STL specifications and the file looks fine to me. Can anyone help me understand how to make simple model shapes, export them to STL, convert them to GTS and run a 3D simulation using Gerris?

Thanks.

Cube.stl

Stephane Popinet

unread,
Aug 24, 2009, 5:40:22 PM8/24/09
to GFS users discussion list
Hi Stephen,

> When I try to convert the
> cube.stl file into cube.gts I get the following error.
>
> stephen@Ubuntu:/media/vbshare$ stl2gts -v <cube.stl > cube.gts
> Input file is not a valid STL file
> stdin:4:16: expecting a number (z-coordinate)

http://gfs.sourceforge.net/wiki/index.php/FAQ#My_STL_file_looks_fine.2C_however_conversion_using_stl2gts_fails.2C_what.27s_wrong.3F

> I did a quick look at the STL specifications and the file looks fine to me.
> Can anyone help me understand how to make simple model shapes, export them
> to STL, convert them to GTS and run a 3D simulation using Gerris?

http://gfs.sourceforge.net/wiki/index.php/Using_Blender_to_create_solids_for_Gerris

cheers

Stephane

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Gfs-users mailing list
Gfs-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gfs-users

Stephen Osborn

unread,
Aug 24, 2009, 7:39:48 PM8/24/09
to GFS users discussion list
Thanks, Stephane

I got cube.gts now converted. I did the two transform steps with the -o and -t 1 options. Now when I run either gerris2D or gerris3D on cube.gfs, I get the errror message that cube.gts "is not orientable". Suggestions?

Stephen

Stephane Popinet

unread,
Aug 24, 2009, 9:11:45 PM8/24/09
to GFS users discussion list
> the errror message that cube.gts "is not orientable". Suggestions?

% stl2gts -v < Cube.stl > Cube.gts
# vertices: 8 edges: 18 faces: 36
# Connectivity statistics
# incompatible faces: 36
# duplicate faces: 36
# boundary edges: 0
# duplicate edges: 0
# non-manifold edges: 18
# edges per vertex: min: 3 mean: 4.5 | 1.5 max: 6
# faces per edge: min: 6 mean: 6 | 0 max: 6
# Geometric statistics
# face quality: min: 0.944203 mean: 0.944203 | 1.02021e-08 max: 0.944203
# face area : min: 0.5 mean: 0.5 | 0 max: 0.5
# edge length : min: 1 mean: 1.13807 | 0.195262 max: 1.41421

The problem here is:

# incompatible faces: 36
# duplicate faces: 36

The duplicate faces are probably the same as your incompatible faces.
I don't know how you created your cube but you need to get rid of the
duplicate faces. I suspect this will also ge rid of the incompatible
faces. "Incompatible faces" are faces which share an edge but which
have opposite orientations.

hope this helps

Stephen Osborn

unread,
Aug 25, 2009, 11:38:11 AM8/25/09
to GFS users discussion list
Making progress here.

I found two solutions to fixing the incompatible faces issue. Using another STL exporter for Google Sketchup removed the duplicate faces, and using the cleanup tool in the examples directory of gts-mainline on the original cube file also appears to fix the issue.

Now when I try to run gerris3D I get the following error.

Gfs-CRITICAL **: gfs_line_center: assertion `a > 0. && a < 1.' failed

The adjusted cube is attached, and is centered, but translated 1 unit along the X axis. I do not understand what the error message is trying to tell me.

Thanks for your help.

Stephen
cubea4.gts

Stephane Popinet

unread,
Aug 26, 2009, 5:24:40 PM8/26/09
to GFS users discussion list
> Now when I try to run gerris3D I get the following error.
>
> Gfs-CRITICAL **: gfs_line_center: assertion `a > 0. && a < 1.' failed
>
> The adjusted cube is attached, and is centered, but translated 1 unit along
> the X axis. I do not understand what the error message is trying to tell me.

I believe the simulation domain you have defined is entirely solid
i.e. the volume of the fluid domain is zero, which is what the cryptic
message above is trying to tell you.

Try reverting the orientation of your cube (turn it inside out).

cheers

Stephen Osborn

unread,
Sep 1, 2009, 10:16:42 AM9/1/09
to GFS users discussion list
I tried reverting the cube using the command "transform -i <cube.gts >cubei.gts"

Now when I run gerris3D, I get the same number of gfs_line_center: assertion ... errors as before plus the following warning messages


Gfs-WARNING **: file solid.c: line 1036 (): (0,0,0)/0: s[1]: 0.000244141

Gfs-WARNING **: file solid.c: line 1036 (): (0.25,-0.25,-0.25)/1: s[1]: 0.000976562

Gfs-WARNING **: file solid.c: line 1036 (): (0.375,-0.375,-0.375)/2: s[1]: 0.00390625

Gfs-WARNING **: file solid.c: line 1036 (): (0.4375,-0.4375,-0.4375)/3: s[1]: 0.015625

Gfs-WARNING **: file solid.c: line 1036 (): (0.46875,-0.46875,-0.46875)/4: s[1]: 0.0625

Gfs-WARNING **: file solid.c: line 1036 (): (0.484375,-0.484375,-0.484375)/5: s[1]: 0.25

It is just a simple cube. It should not be this hard.

Thanks

Stephen

Stephane Popinet

unread,
Sep 1, 2009, 5:32:26 PM9/1/09
to GFS users discussion list
> It is just a simple cube. It should not be this hard.

aha. things are often more complex than they seem...

Anyway, your cubea4.gts works fine with my version of Gerris. What
version are you using?

mine is:

% gerris3D -V
gerris: using 3D libgfs version 1.3.2 (090826-044718)
compiled with flags:
MPI: yes
pkg-config: yes
m4 and awk: yes

Stephen Osborn

unread,
Sep 1, 2009, 5:48:43 PM9/1/09
to GFS users discussion list
gerris3D -V returns:

gerris: using 3D libgfs version 1.3.2 (090805-153844)
  compiled with flags:
  MPI:          no

  pkg-config:   yes
  m4 and awk:   yes

When I run gerris3D cube.gfs after editing the gfs file to include cubea4.gts, I get the long list of the same critical error and if I let it sit for a few seconds I start to see output data printed.

Stephen

Stephane Popinet

unread,
Sep 1, 2009, 6:27:38 PM9/1/09
to GFS users discussion list
> When I run gerris3D cube.gfs after editing the gfs file to include
> cubea4.gts, I get the long list of the same critical error and if I let it
> sit for a few seconds I start to see output data printed.

Can you send your cube.gfs file?

Mine is attached.

Stephane

cube.gfs

Stephen Osborn

unread,
Sep 1, 2009, 6:35:31 PM9/1/09
to GFS users discussion list
Here is my cube.gfs file. I renamed it to cube_orig.gfs

Your cube.gfs file did not return any errors for me.

Stephen


cube_orig.gfs

Stephane Popinet

unread,
Sep 1, 2009, 6:56:49 PM9/1/09
to GFS users discussion list
> Here is my cube.gfs file. I renamed it to cube_orig.gfs

Ok but what you are trying to do is strange. Do you want to compute
the flow around a cube? In this case it does not make sense to have a
cube which fills the whole domain. Or do you want to compute the flow
inside a cube? In this case tou could just use the GfsBox, you don't
need a GfsSolid.

For the flow around a cube try:

GfsSolid cubea4.gts { flip = 1 scale = 0.4 }

also try first without

GfsAdaptVorticity { istep = 1 } { maxlevel = 5 cmax = 1e-2 }

and use a coarser mesh to start with

GfsRefine 5

Once you are happy with your setup, you can turn stuff back on.

cheers

Stephen Osborn

unread,
Sep 2, 2009, 12:23:30 AM9/2/09
to GFS users discussion list
At the core, I am trying to understand how to take a 3D STL model and compute the flow around it and the pressures on the exposed faces using Gerris. I chose a cube because it was a simple test case for playing with the buttons provided by Gerris.

I basically took your 2D simulation file, and imported the 3D cube instead of the half cylinder and expected to see a 3D flow around the cube. I got an error message that said that I did not need a particular line, so I removed it. Otherwise it should look like the 2D tutorial example.

I have tried reading through most of the documentation, but not being a gas dynamics expert, I understand very little of it. I would like to just be able to put in a 3D model, specify the fluid properties (usually air), specify the flow velocity, and view the output for flow turbulence and surface pressures. With a little effort, I think I can get there from here. I can see from the examples and tutorials that Gerris can do much more than what I need from it.

What would be spectacular, but not expected, is if Gerris can compute air flow effects on acoustic propagation. If I transmit an acoustic signal through the turbulence, it would be really neat to understand how the turbulence affects the acoustic propagation. Just fishing.

Thanks for your patience. I will try the changes you suggest and let you know.

Stephen
Reply all
Reply to author
Forward
0 new messages