CFD Online Discussion Forums

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

Sumontro May 18, 2010 16:27

SnappyHexMesh Troubles
 
I read the snappyHexMesh guide in the User Guide, but when I tried to run it, it gave me this error,

--> FOAM FATAL ERROR:
Cannot find triSurfaceMesh starting from "/home/sumontro/OpenFOAM/run/condorcfd/icoFoam/condor/constant/triSurface/Condor_CFD_Model.stl"

From function triSurfaceMesh::checkFile(const fileName&, const fileName&)
in file searchableSurface/triSurfaceMesh.C at line 117.

FOAM exiting


I saved the CAD model in STL format, but the file extension ending is .STL not .stl. I know linux is case sensitive, but I tried saved the CAD model in STL format, and the ending is not changing to lowercase .STL. I don't know what to do, can anyone help out?

wyldckat May 18, 2010 17:10

Hello again Sumontro :)

I believe you have at least three possible solutions:
  1. Rename the archive after exporting from the CAD software, like so:
    Code:

    cd /home/sumontro/OpenFOAM/run/condorcfd/icoFoam/condor/constant/triSurface/
    mv Condor_CFD_Model.STL Condor_CFD_Model.stl

  2. Or change the extension in the snappyHexMeshDict file, where you reference the STL file from Condor_CFD_Model.stl to Condor_CFD_Model.STL.
  3. Or (and this one is a bit overkill) you can still use the normal file name exported from the CAD Condor_CFD_Model.STL, but make a symbolic link to it with the desired name, like so:
    Code:

    cd  /home/sumontro/OpenFOAM/run/condorcfd/icoFoam/condor/constant/triSurface/
    ln -s Condor_CFD_Model.STL Condor_CFD_Model.stl


Best regards,
Bruno

Sumontro May 19, 2010 00:44

Thanks for the advice. I changed the file name to the lowercase STL. The file name change worked, but then I got this error when I tried running snappyHexMesh.

word::stripInvalid() called for word ��@��k(?VPA�!�@,B
For debug level (= 2) > 1 this is considered fatal
Aborted


I don't know how to fix this. What should I do?

wyldckat May 19, 2010 05:51

Hi Sumontro,

Simple, in your CAD software you have to export in ASCII STL and not Binary STL! Hopefully it will have such option.
If not, there should be free tools for converting from one type of STL to another, but right now I can't remember about any :(

Best regards,
Bruno

louisgag May 19, 2010 11:14

Quote:

there should be free tools for converting from one type of STL to another, but right now I can't remember about any
AdMesh should be able to do that.

something like
Code:

admesh --write-ascii=yourFile.stl
-Louis

Sumontro May 19, 2010 14:21

How to Run Simulations after using snappyHexMesh
 
Thanks again for the help, it resolved the problem with the stl format. However, now I have a new one. When I tried to run icoFoam after using snappyHexMesh, I got this error.

--> FOAM FATAL IO ERROR:

patch type 'patch' not constraint type 'empty'
for patch frontAndBack of field p in file "/home/sumontro/OpenFOAM/run/condorcfd/icoFoam/condor/3/p"

file: /home/sumontro/OpenFOAM/run/condorcfd/icoFoam/condor/3/p::boundaryField::frontAndBack from line 35 to line 35.

From function emptyFvPatchField<Type>::emptyFvPatchField
(
const fvPatch& p,
const Field<Type>& field,
const dictionary& dict
)

in file fields/fvPatchFields/constraint/empty/emptyFvPatchField.C at line 101.

FOAM exiting


I think this means I haven't put the proper directories in the correct locations, but I am not sure. What should I do?

louisgag May 19, 2010 16:21

looks like a problem with your patch "empty".. Perhaps you should try running a few tutorials to get to know the basics.

Run these in a terminal

Code:

foam
cd tutorials

choose one that interests you

Code:

./Allrun
-Louis

AlanR May 19, 2010 17:17

I think you have a 2D vs. 3D problem. If your CAD geometry is 3D, then you can't have patch type empty in your mesh or in /0/p. Empty patches are only for 2D simulations. The motorBike tutorial will show you how to set things up for 3D modeling. If you're doing 2D, then look at Cavity or pitzDaily. All of the files in the /0 directory must have the same patch names, consistent types (i.e. wall, patch, inlet), along with the correct data types for each patch. The patch names and types must be consistent with what you set up in blockMesh. Snappy may run with inconsistent patch types, but the solvers (icoFoam) will not. The p file is the first one that the solver opens.
I have geometry files with upper case characters in the extension - I just rename then with 'mv.'

Alan

elvis May 20, 2010 13:27

Quote:

Originally Posted by wyldckat (Post 259431)
Hi Sumontro,

Simple, in your CAD software you have to export in ASCII STL and not Binary STL! Hopefully it will have such option.
If not, there should be free tools for converting from one type of STL to another, but right now I can't remember about any :(

Best regards,
Bruno

Hi,

if you have package "python-vtk" and the other necessary vtk packages installed you can convert very easy with this python programm
Test it ;-)

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
just point path to your STL-file and don't forget to chmod a+x the python file

elvis

J-P June 10, 2010 09:24

Quote:

Originally Posted by wyldckat (Post 259431)
Hi Sumontro,

Simple, in your CAD software you have to export in ASCII STL and not Binary STL! Hopefully it will have such option.
If not, there should be free tools for converting from one type of STL to another, but right now I can't remember about any :(

Best regards,
Bruno

You can use paraview for this: Just click File -> Save Data and then choose ASCII when saving in stl-format. Nice and easy.

s.m October 15, 2013 05:05

Quote:

Originally Posted by J-P (Post 262475)
You can use paraview for this: Just click File -> Save Data and then choose ASCII when saving in stl-format. Nice and easy.

Dear J-P
we should first open our Binary stl file with paraview, then save it with *.stl file in paraview?
i do the steps that i said above, and when i want to save data of binary stl file, i din't see where we should choose ASCII before saving, would you please attach a picture for us?
Thank you very much:)

wyldckat October 15, 2013 16:44

Quick answer: The option appears after you select the target file (i.e., after you choose the file name+location and click on the "Save" or "OK" button).


All times are GMT -4. The time now is 04:50.