CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   SnappyHexMesh .stl (http://www.cfd-online.com/Forums/openfoam/76706-snappyhexmesh-stl.html)

Jochem June 2, 2010 03:34

SnappyHexMesh .stl
 
Hi,

I am a new user of OpenFoam. I've runned the motorBike tutorial without any problems. For my case i can use this tutorial just using an other .stl file. I've tried to do this but there are some problems that occur.

When i do a blockMesh there are some errors, but it seems to work :

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time


Creating block mesh from
********/constant/polyMesh/blockMeshDict"


Creating blockCorners

Creating curved edges

Creating blocks

Creating patches

Creating block mesh topology
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 129
zero or negative pyramid volume: -333333 for face 0
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 129
zero or negative pyramid volume: -333333 for face 1
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 129
zero or negative pyramid volume: -333333 for face 2
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 129
zero or negative pyramid volume: -333333 for face 3
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 129
zero or negative pyramid volume: -333333 for face 4
--> FOAM Warning :
From function cellModel::mag(const labelList&, const pointField&)
in file meshes/meshShapes/cellModel/cellModel.C at line 129
zero or negative pyramid volume: -333333 for face 5
--> FOAM Warning :
From function blockMesh::createTopology(IOdictionary&)
in file createTopology.C at line 398
negative volume block : 0, probably defined inside-out

Default patch type set to empty

Check block mesh topology

Basic statistics
Number of internal faces : 0
Number of boundary faces : 6
Number of defined boundary faces : 6
Number of undefined boundary faces : 0

Checking patch -> block consistency

Creating block offsets

Creating merge list .

Creating points with scale 1

Creating cells

Creating patches

Creating mesh from block mesh

Default patch type set to empty

There are no merge patch pairs edges

Writing polyMesh

End


When i do the snappyHexMesh there are some fatal errors that occur :

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Read mesh in = 126.09 s

Overall mesh bounding box : (-100 -50 0) (100 200 40)
Relative tolerance : 1e-06
Absolute matching distance : 0.000322645

Reading refinement surfaces.
Read refinement surfaces in = 0 s

Reading refinement shells.
Refinement level 4 for all cells inside refinementBox
Read refinement shells in = 0 s

Setting refinement level of surface to be consistent with shells.
Checked shell refinement in = 0 s


Determining initial surface intersections
-----------------------------------------

Edge intersection testing:
Number of edges : 48272000
Number of edges to retest : 48272000
Number of intersected edges : 11148
Calculated surface intersections in = 98.93 s

Initial mesh : cells:16000000 faces:48272000 points:16272981
Cells per refinement level:
0 16000000

Adding patches for surface regions
----------------------------------

Patch Region
----- ------
ErasmusSketch2:

5 ErasmusSketch2_ascii

Added patches in = 1.17 s

Selecting decompositionMethod hierarchical

Refinement phase
----------------



--> FOAM FATAL ERROR:
Point (3 3 0.43) is not inside the mesh or on a face or edge.
Bounding box of the mesh:(-100 -50 0) (100 200 40)

From function refinementParameters::findCells(const polyMesh&) const
in file autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C at line 122.

FOAM exiting


Maybe there is some problem with my .stl file, i've used inventor to make this file. But i've runned a surfaceCheck and there were no 'illegal triangles'.

Another thing i wonder is that i don't see the .stl file in Paraview. I guess you normally can see the file without doing a block or snappyHexMesh, or can't you do this?

Can someone help me?

Regards,

Jochem

elvis June 2, 2010 09:17

Quote:

Originally Posted by Jochem (Post 261310)
Another thing i wonder is that i don't see the .stl file in Paraview. I guess you normally can see the file without doing a block or snappyHexMesh, or can't you do this?

Can someone help me?

I have a workaround for your Paraview problem.

Convert your ASCII-type STL into a BINARY-Type STL file this helps me.

PHP Code:

#!/usr/bin/env python
import vtk
reader 
vtk.vtkSTLReader()
# path to binary or ascii stl file to be converted
reader.SetFileName("/home/elvis/motorBike.stl")
reader.Update()
write vtk.vtkSTLWriter()
#uncomment unnecessary 2Ascii or 2Binary 
#write.SetFileTypeToASCII()
write.SetFileTypeToBinary()
 
write.SetInput(reader.GetOutput())
# path to 
write.SetFileName("/home/elvis/my_ascii_or_binary.stl")
write.Write() 

this script converts Binary.STL -> ASCII.STL
and ASCII.STL-> Binary.STL
it really worked in both directions for me
But you need "python-vtk" on your computer (apt-get install python-vtk) for debianbased distributions

So put the python code in a "file", edit the input and output path, do not forget "chmod a+x file"
and run ./file

now paraview or meshlab should show the Binary-STL-File.

elvis

elvis

Jochem June 2, 2010 11:24

Hi Elvis,

Thanks a lot for the help, i will try to use your "workaround" to solve my problem. I will let you know when i've succeed in solving my problem.

Regards,

Jochem

bigphil June 2, 2010 13:20

Hi Jochem,

Could you post your blockMeshDict too?
Having negative volume cells is not a good thing, and could cause many problems.

Philip C

Jochem June 2, 2010 16:24

Hi,

I've been abled to find a solution for my problem. The dimension of my .stl file where to large. The convertion from mm in inventor to meters gave the error. The .stl file was bigger then the blockMesh i did, i guess that's why i have some negative values.

Another issue was that i've saved the .stl file using another name. I thoughtthat i've change this trough all files of the case but apparently this was not so. So i've saved my .stl file to motorBike.stl.

Anyway thanks for the quick responses and the help.

Regards,

Jochem

roman.gaspar August 3, 2012 04:29

Hello guys. I have similar problem.
I make a cube with blockMeshDict (check it->Mesh OK) and I open it in ParaFoam. After that i open my .stl file (see pic.)
http://home.zcu.cz/~gaspar/cube.png

It seem to be everithing fine. In next step I make a surfaceCheck and there are no illegal triangles.

I run the snappyHexMesh and...

Refinement phase
----------------
--> FOAM FATAL ERROR:
Point (3 3 0.43) is not inside the mesh or on a face or edge.
Bounding box of the mesh:(-0.5 -0.4 -0.5) (1.5 0.4 0.5)


no other errors...

BUT!!!! in .stl file is no coordinate (3 3 0.43)

do you have any suggestions?

thanks a lot for reading my reply
Roman

wyldckat August 3, 2012 05:25

Greetings Roman and welcome to the forum!

Try this coordinate: (3.2412 3.25345 0.431351234)
This way it's a lot harder to fall right on top of a cell face or edge!

Best regards,
Bruno

roman.gaspar August 3, 2012 06:20

Thanks for help and welcome :) but I solved the problem by myself :)
in "snappyHexMeshDict" is a part

// Mesh selection
// ~~~~~~~~~~~~~~

// After refinement patches get added for all refinementSurfaces and
// all cells intersecting the surfaces get put into these patches. The
// section reachable from the locationInMesh is kept.
// NOTE: This point should never be on a face, always inside a cell, even
// after refinement.

locationInMesh (0 0 0)
; <---- Here is default (3 3 0.43) and you must use coordinates which are inside your cube (in my case is (0 0 0) ) !!!! and it will works :)


All times are GMT -4. The time now is 11:10.