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

[snappyHexMesh] SnappyHexMesh error: point is not inside mesh, face, or edge

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2020, 20:37
Default SnappyHexMesh error: point is not inside mesh, face, or edge
  #1
New Member
 
Join Date: Aug 2020
Posts: 11
Rep Power: 5
User100000 is on a distinguished road
Hello,

I recently tried running snappyHexMesh on a block surrounding a 3D cylinder drawn in CAD. Unfortunately, when I ran the snappyHexMesh command, I got the following error:

Code:
--> FOAM FATAL ERROR:
Point (-0.4596789 -0.4512345 -0.999999) is not inside the mesh or on a face or edge.
Bounding box of the mesh:(-0.499942742 -0.499013394 -1) (0.499942742 0.499013394 1)

    From function Foam::labelList Foam::refinementParameters::findCells(const Foam::polyMesh&) const
    in file snappyHexMeshDriver/refinementParameters/refinementParameters.C at line 103.

FOAM exiting
I searched through the forums and found one thread where people had similar issues: SnappyHexMesh Point is not inside Mesh but it is

After reading the post, I tried changing my point so that it included many decimal places, but this didn't change anything. I also went back to the OpenFOAM manual and checked the order of my points (listed below), but I couldn't find anything wrong there, and neither could checkMesh. I then tried deleting and reforming the polyMesh directory, but that didn't change anything either.

If anyone has had a similar issue and knows how to get rid of this error, I would very much appreciate the advice.

Thank you!!!

Code:
vertices
(
   (-3 -3 -1)
   (3 -3 -1)
   (-3 3 -1)
   (3 3 -1)
   (-3 -3 1)
   (3 -3 1)
   (-3 3 1)
   (3 3 1)
);

blocks
(
   hex (0 1 3 2 4 5 7 6) (60 60 10) simpleGrading (1 1 1)
);
User100000 is offline   Reply With Quote

Old   October 22, 2020, 13:37
Default
  #2
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 20
Bloerb will become famous soon enough
Your Point must be inside a cell which is fully within (or outside depending on your meshing problem) your stl file. So in your case you used as the z component basically -1. And this is likely a cell which is not fully inside your stl but cuts it. And it is pretty close to the edge of your mesh. Why not move it upwards in z?
Bloerb is offline   Reply With Quote

Old   October 22, 2020, 16:32
Default
  #3
New Member
 
Join Date: Aug 2020
Posts: 11
Rep Power: 5
User100000 is on a distinguished road
Hi, and thank you for your response! I am trying to simulate the flow around a cylinder rather than quantities within the .stl cylinder.

I did try changing my z-value so that it was well inside the box, but I got the same error:

Code:
FOAM FATAL ERROR:
Point (-0.4596789 -0.4512345 -0.3256789) is not inside the mesh or on a face or edge.
Bounding box of the mesh:(-0.499942742 -0.499013394 -1) (0.499942742 0.499013394 1)
I was wondering whether there is anything else I need to change in my code if I want to simulate the flow around an STL object rather than quantities within it. My .stl cylinder has a radius of 0.5, and I defined my bounding box in blockMesh as shown above. I'm also wondering why the bounding box isn't 6 x 6 x 2.

Thank you again!
User100000 is offline   Reply With Quote

Old   October 23, 2020, 02:15
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 645
Rep Power: 12
AtoHM is on a distinguished road
The bounding box there is obviously the one of your cylinder. Maybe you unintentionally tried with a locationInMesh which was inside the stl, then changed it to outisde (by Bloerbs suggestion) but didn't clear the old mesh and now it looks inside? Just a guess, though.


Have you checked that your blockMesh gets build correctly?
AtoHM is offline   Reply With Quote

Old   October 25, 2020, 22:43
Default
  #5
New Member
 
Join Date: Aug 2020
Posts: 11
Rep Power: 5
User100000 is on a distinguished road
Thank you, and I apologize for the late response! (I am an undergraduate, and we have midterms this week. )

All of my mesh commands (blockMesh and snappyHexMesh) pass the mesh tests with no errors.

I did try clearing the polyMesh directory and running snappyHexMesh with the point
Code:
(-0.058679 0.058679 -0.325)
. This allowed me to create a rectangular prism of a mesh. When I viewed the mesh in ParaView, though, there was no cylindrical hole in the center. I also got the following error message:
Code:
--> FOAM Warning :
    From function Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 804
    Cannot find any patch or group names matching cylinder
I checked that my STL file was indeed called cylinder.stl, and my STL object is named "cylinder" in my snappyHexMeshDict file. I was wondering whether this error could still have to do with whether the reference point chosen is inside the bounding box or not.

I also checked my boundary file under constant/polyMesh/boundary, and there was no entry for cylinder there. I'm wondering whether that file only gets updated by blockMeshDict, and if so, whether I somehow have to deal with the STL cylinder in blockMeshDict as well as in snappyHexMeshDict.

In general, when we want to describe the flow around an object, should we choose our point outside of the bounding box of the object or inside it?

Thank you again!!!
User100000 is offline   Reply With Quote

Old   October 26, 2020, 01:49
Default
  #6
Senior Member
 
M
Join Date: Dec 2017
Posts: 645
Rep Power: 12
AtoHM is on a distinguished road
Could you insert your snappyHexMeshDict? Its quite hard to tell with that little information. During the run of snappyHexMesh, do you write a log file? Have you checked that for any mentioning of cylinder.stl or cylinder? Maybe sHM ignores it for some reason (not closed stl?).
AtoHM is offline   Reply With Quote

Old   October 26, 2020, 07:28
Default
  #7
New Member
 
Join Date: Aug 2020
Posts: 11
Rep Power: 5
User100000 is on a distinguished road
Sure! I have posted my log code and snappyHexMeshDict code as attached files. (I pasted them into Word documents since they won't transfer correctly from my Windows to my Ubuntu system, and I don't have C++ on Windows. Sorry about that. )


I also noticed that each time I run blockMesh and snappyHexMesh, I get numbered directories in my case folder (see uploaded image). The first one (0) just houses my U and p files, and the second one is a polyMesh directory with a boundary file that includes cylinder as a patch. The other files only include cylinder as a patch or include just the patches from blockMesh. I was wondering which of these files I might need to delete.
Attached Images
File Type: jpg Multiple Directories.JPG (32.3 KB, 7 views)
Attached Files
File Type: docx Log_File.docx (22.0 KB, 3 views)
File Type: docx SnappyHexMeshDict.docx (14.1 KB, 7 views)
User100000 is offline   Reply With Quote

Old   October 27, 2020, 05:12
Default
  #8
Senior Member
 
M
Join Date: Dec 2017
Posts: 645
Rep Power: 12
AtoHM is on a distinguished road
Your bounding box in the beginning of snappyHexMesh should be the one of the blockMesh, as it is not, I can only assume that you have some old files when running snappy and that leads to unexpected behavior. I would really clear out the whole case folder and try everything again step by step.


Your files appear alright to me, although you have in the refinementRegion subdictionary a region called refinementBox, which is not defined in the geometry section. But I assume that is ignored by snappy.
AtoHM is offline   Reply With Quote

Old   November 7, 2020, 18:18
Default
  #9
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
Dear User100000,

Snapping failing even if the point is inside the geometry happens when the STL file is not 100% watertight and OpenFOAM is quite strict about that. If OpenFOAM finds an open crack, no matter how small, snappyHexMesh won't be able to tell inside from outside. I recommend running surfaceCheck on the STL file to make sure it is up to OpenFOAM requirements. STL output quality can vary depending on Software used and export settings. Hope this helps.

Cheers, Claudio
Ship Designer is offline   Reply With Quote

Old   December 22, 2020, 15:15
Default
  #10
New Member
 
Join Date: Aug 2020
Posts: 11
Rep Power: 5
User100000 is on a distinguished road
Thank you all for your help! I got snappyHexMesh running and wanted to share what I found in case it helps any other new users.

1) When a user runs the "snappyHexMesh" command, OpenFOAM creates three dictionaries named "1," "2," and "3." These dictionaries are located under the main test case folder and correspond to each of the three stages of refinement (castellatedMesh, snap, and addLayers). If any of these are set to false, OpenFOAM will not create a dictionary for the stage.

2) OpenFOAM treats each numbered dictionary like a timestep, so to view the fully refined mesh in ParaView, the user needs to advance the "timesteps" in ParaView as far as possible. (I wasn't doing this earlier and missed seeing the refinement because I was only looking at timestep 0.) The FOAM warning about cylinder.stl in my previous post had no effect on the final result.

3) If any of the "timestep" folders from the "snappyHexMesh" command are present, OpenFOAM will not write the timesteps from the simulation commands (such as "simpleFoam") to timestep folders, and the user can only view the refined mesh rather than the simulation results in ParaView. To fix this, the user can run the command "snappyHexMesh -overwrite" instead of just running the command "snappyHexMesh." This writes the mesh to the constant/polyMesh folder rather than a separate, numbered folder.

4) To rerun the simulation with a different mesh, the user needs to clear out the constant/polyMesh folder leaving the blockMeshDict file intact. It is also helpful to remove any numbered folders corresponding to previous simulation results.

5) A helpful tutorial mentioned that it is important to save CAD geometry files in ASCII format, not binary. The tutorial also mentioned that to simulate flow past an object, the user should choose a reference point that is outside the domain of the CAD geometry, and to simulate flow through an object, the reference point should be inside the geometry.
User100000 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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 05:38
[blockMesh] Internal walls of zero thickness anger OpenFOAM Meshing & Mesh Conversion 23 February 6, 2020 18:25
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43


All times are GMT -4. The time now is 01:59.