CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] Regarding SnappyMesh and Stl file

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Antimony
  • 2 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 7, 2017, 04:58
Default Regarding SnappyMesh and Stl file
  #1
New Member
 
Join Date: Jul 2017
Location: Germany
Posts: 5
Rep Power: 8
naik1991 is on a distinguished road
Hi,

I am relatively new to openfoam and I have a gearPump Stl file.Till blockMesh it works fine but when I run snappyHexMesh run I am getting an error.Please find the error in the attachment.I am working on windows platform.

Thankyou
Attached Images
File Type: png Capture.PNG (41.1 KB, 54 views)
naik1991 is offline   Reply With Quote

Old   September 8, 2017, 00:31
Default
  #2
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 15
Antimony is on a distinguished road
Hi,

I am not sure, and I am taking a guess based on your error message - is your STL file in binary or ascii? If it is in binary, can you convert it to ascii and try again?

Cheers,
Antimony
Antimony is offline   Reply With Quote

Old   September 8, 2017, 04:04
Default
  #3
New Member
 
Join Date: Jul 2017
Location: Germany
Posts: 5
Rep Power: 8
naik1991 is on a distinguished road
Hi ,

I tried in both formats but still getting the same error.

Thanks
naik1991 is offline   Reply With Quote

Old   September 12, 2017, 17:56
Default
  #4
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21
kwardle is on a distinguished road
You might try to run surfaceCheck on your STL file.
kwardle is offline   Reply With Quote

Old   September 12, 2017, 19:23
Default Re: Regarding SnappyMesh and Stl file
  #5
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 10
aow is on a distinguished road
Hi naik,

Your error output is unfamiliar to me, but somehow running snappyHexMesh caused a segmentation fault (sigsegv). As pointed out in the OpenFOAM debugging webpage, this likely is caused by the program trying to access memory outside its allocated space. I've never had this occur with a successfully compiled OpenFOAM installation even when I've used a bad .stl file (open surface geometry, etc...); snappyHexMesh would just fail and generate an output saying some condition was violated and it had to terminate.

First of all, could you post your snappyHexMeshDict script for the case you're attempting to build? There may be a critical error or typo made there.

Secondly, does snappyHexMesh work for the tutorials? If it does, then I suppose it could be your .stl file, in which case you should check it to be sure it doesn't have errors. If the file isn't too detailed, I like to plot it using Matlab (see script below; note that the file must be in ascii format for it to work).

Quote:
function [vertCoord,normVec] = STLplotter(STLfileName)
tri = [1,2,3];
fID = fopen(STLfileName,'r');
fgets(fID); % skip first line "solid <solidName>"
dataLine = fgets(fID);
splitLine = strsplit(dataLine);
count = 1;
surfCount = 1;
while strcmp(splitLine{1},'endsolid') == 0 % detect end of file
if count == 1 % (for a closed solid) outward-pointing surface normal vector
normVec{surfCount} = [str2double(strsplit(splitLine{4})),str2double(strs plit(splitLine{5})),str2double(strsplit(splitLine{ 6}))];
elseif count == 3 % x,y,z coordinates of first vertice
vertCoord{surfCount}{1}(1) = str2double(strsplit(splitLine{3}));
vertCoord{surfCount}{2}(1) = str2double(strsplit(splitLine{4}));
vertCoord{surfCount}{3}(1) = str2double(strsplit(splitLine{5}));
elseif count == 4 % x,y,z coordinates of second vertice
vertCoord{surfCount}{1}(2) = str2double(strsplit(splitLine{3}));
vertCoord{surfCount}{2}(2) = str2double(strsplit(splitLine{4}));
vertCoord{surfCount}{3}(2) = str2double(strsplit(splitLine{5}));
elseif count == 5 % x,y,z coordinates of third vertice
vertCoord{surfCount}{1}(3) = str2double(strsplit(splitLine{3}));
vertCoord{surfCount}{2}(3) = str2double(strsplit(splitLine{4}));
vertCoord{surfCount}{3}(3) = str2double(strsplit(splitLine{5}));
elseif count == 7
vecBase{surfCount} = [sum(vertCoord{surfCount}{1}),sum(vertCoord{surfCou nt}{2}),sum(vertCoord{surfCount}{3})]/3;
count = 0;
surfCount = surfCount+1;
end
dataLine = fgets(fID);
splitLine = strsplit(dataLine);
count = count+1;
end
surfCount = surfCount-1; % the loop overshoots by 1
fclose(fID);
figure(); hold on
for i = 1:surfCount
trisurf(tri,vertCoord{i}{1},vertCoord{i}{2},vertCo ord{i}{3})
quiver3(vecBase{i}(1),vecBase{i}(2),vecBase{i}(3), normVec{i}(1),normVec{i}(2),normVec{i}(3))
end
hold off
This way you can easily manipulate the surface and see if any faces have incorrect coordinates, have normal vectors pointing in weird directions, etc... If everything looks fine and you're not sure how to load it into ParaView by itself (I've not tried to do such a thing myself), then see if you can successfully load it with enGrid, which is an open-source mesh generation and manipulation software.

Finally, this forum post may have a point. It's suggested there that perhaps running out of disk space may be the issue, or, you may have forgotten to clean up the case before retrying to build it, which can cause failures in building cases.

Best regards,

Andrew
aow is offline   Reply With Quote

Old   September 12, 2017, 23:11
Default
  #6
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 15
Antimony is on a distinguished road
Hi,

In which case, can you open your ASCII STL file using a text editor and see that there is a word after "solid" in the first line and then there is an "endsolid" at the end of the file?

Cheers,
Antimony
aow likes this.
Antimony is offline   Reply With Quote

Old   September 13, 2017, 04:39
Default
  #7
New Member
 
Join Date: Jul 2017
Location: Germany
Posts: 5
Rep Power: 8
naik1991 is on a distinguished road
Hi ,

thank you guys for the reply.The problem is sorted.There was some problem while exporting from the CAD software.Now its working fine.

Regards,
Anirudh
naik1991 is offline   Reply With Quote

Old   September 13, 2017, 04:58
Default
  #8
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 10
aow is on a distinguished road
If you don't mind my asking, what was the issue? I use CAD software (Autodesk's Inventor, which is free for students) to generate ascii format .stl files a lot and usually don't have issues (I try to keep the precision very high), but would like to know in case something similar pops up.

Glad you could figure out your issue!
aow is offline   Reply With Quote

Old   September 13, 2017, 05:09
Default
  #9
New Member
 
Join Date: Jul 2017
Location: Germany
Posts: 5
Rep Power: 8
naik1991 is on a distinguished road
Hi Andrew,

I use Creo.I think the file was corrupted because when i tried opening the ASCII stl file , the file was unreadable in notepad .But again we saved the stl file in ASCII format from Creo and the problem was solved.Even i dont know what exactly the problem was.

Regards
naik1991 is offline   Reply With Quote

Old   September 13, 2017, 05:27
Default
  #10
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

if you are new to FOAM and the meshing procedure, you can check this out. You might find some interesting points: http://holzmann-cfd.de/index.php/en/4-create-a-project
aow and naik1991 like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   September 13, 2017, 06:00
Default
  #11
New Member
 
Join Date: Jul 2017
Location: Germany
Posts: 5
Rep Power: 8
naik1991 is on a distinguished road
Hi Tobias,

Thank you,I am working on gear pump and the snappyHexMesh worked fine.But now i want to do snappyHesxMesh for different angular orintations of gears.My question is how do I get differnet angular orientations from the Stl file.I am doing a dynamic mesh so I am creating different base meshes.

Thank you
naik1991 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert from WaSP .map to STL .- SnappyMesh Xabi OpenFOAM 7 September 8, 2009 09:53


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