CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ...

ccm26toFoam double free or corruption

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 17, 2016, 06:10
Default ccm26toFoam double free or corruption
  #1
Member
 
Join Date: Apr 2015
Location: EU
Posts: 38
Rep Power: 3
roadRunner is on a distinguished road
Hi,

im using ccm26toFoam to convert starccm+ meshes to OF, and it works perfectly. However, when I try to import a very big mesh, ~70mil cells, it reports this (double free or corr.) and crashes. This is the first time I ever had a problem with this.

I assume this is a problem related to ccm plugin. From what I found online, it seems that it's a memory management problem, which is strange since this program usually works perfectly except in this case.

Also i'm sure that file isn't corrupted and that the mesh is valid, since it has several regions, from which small ones are imported with no problems, only the biggest fails.

I work in science, and I have all the licences for all the stuff.

Is there a newer version of the ccm plugin?

I was thinking, maybe I'm supposed to increase maximum array size or something like that, that seems plausible explanation...

Its extremely frustrating to have the mesh ready and unable to access it....

Is it possible to import ccm mesh to fluent? Without using OF? Or some other format? VTK?
__________________
beep-beep
roadRunner is offline   Reply With Quote

Old   April 17, 2016, 09:10
Default
  #2
Member
 
Join Date: Apr 2015
Location: EU
Posts: 38
Rep Power: 3
roadRunner is on a distinguished road
As I compile libccmio, I get these warnings:

libccmio/ccmioutility.c:302:10: warning: attempt to free a non-heap object ‘dims’ [-Wfree-nonheap-object]
free(dims);
^

and:

ccmioutility.c.text+0xbcf): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'


is this relevant?
__________________
beep-beep
roadRunner is offline   Reply With Quote

Old   April 17, 2016, 10:04
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,636
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quote:
Originally Posted by roadRunner View Post
However, when I try to import a very big mesh, ~70mil cells, it reports this (double free or corr.) and crashes. This is the first time I ever had a problem with this.
Quick questions:
  1. Do you mean "70 000 000" cells or "70 000 000 000"?
  2. Can you reproduce the problem with a simple hexahedral, tetrahedral or even polyhedral mesh with the same number of cells?
  3. Did you select both the volume and the surface meshes before exporting?
  4. Did you select any special internal interface surface meshes?
__________________
wyldckat is offline   Reply With Quote

Old   April 17, 2016, 11:37
Default
  #4
Member
 
Join Date: Apr 2015
Location: EU
Posts: 38
Rep Power: 3
roadRunner is on a distinguished road
Thanks for your reply. However, I have to object to moving the thread, in my opinion it was in an appropriate position.. Now it's visibility has been greatly reduced.

Mesh has around 70 million cells.

As I wrote in my original thread, this procedure has been validated with different meshes of the same approach just with different number of cells.
What I'm doing now: I'm recreating the same mesh with the exact same settings, just with the number of mesh that has been shown to work.

Yes, I used special interfaces, but those are ignored by the utility. The mesh is "merged" together by the utility and exported successfully.
I should point out that the correct approach is not to avoid using those special interfaces, because they are proven not to create issues on a number of other occasions.

This is a major problem in my work, and will create a lot of problems for me. Especially because I have no idea how to solve it as this is not an OF error but that of the ccm library (in my opinion).
__________________
beep-beep
roadRunner is offline   Reply With Quote

Old   April 17, 2016, 13:57
Default
  #5
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,636
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings roadRunner,

Quote:
Originally Posted by roadRunner View Post
However, I have to object to moving the thread, in my opinion it was in an appropriate position.. Now it's visibility has been greatly reduced.
OK, I've moved again back, namely from OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... to OpenFOAM Meshing & Mesh Conversion - although, please keep in mind that the other sub-forum is the correct one for this topic.

Quote:
Originally Posted by roadRunner View Post
Mesh has around 70 million cells.
Mmm... OK, I was afraid that one of the counters (points, faces or cells) might be hitting the limit of 2^31 = 2147483648, but 70000000 is still very far away from that limit.

Quote:
Originally Posted by roadRunner View Post
As I wrote in my original thread, this procedure has been validated with different meshes of the same approach just with different number of cells.
What I'm doing now: I'm recreating the same mesh with the exact same settings, just with the number of mesh that has been shown to work.
Please let us know if with a smaller number of cells it works as intended.

Because if it does work, then my suspicion is that there is something wrong in the mesh with 70 million cells. If there is a missing point that is incorrectly addressed, it could lead to ccm26ToFoam to try and create a cell that has a point with the index "-1", which would result in accessing the memory location in the array that is before the 0 index, which would in turn lead to memory corruption. This would explain why it tried to free twice the same memory place.

The other thing to check for is the minimum and maximum number of vertices a cell has in your bigger mesh, since this might be related to the "dims" problem.

Quote:
Originally Posted by roadRunner View Post
Yes, I used special interfaces, but those are ignored by the utility. The mesh is "merged" together by the utility and exported successfully.
I should point out that the correct approach is not to avoid using those special interfaces, because they are proven not to create issues on a number of other occasions.
That is very good to know! Usually I always suspect special interfaces, since they are not always supported by the mesh converters and can lead to problems when converting

Quote:
Originally Posted by roadRunner View Post
This is a major problem in my work, and will create a lot of problems for me. Especially because I have no idea how to solve it as this is not an OF error but that of the ccm library (in my opinion).
I can try and debug the utility, but I'll need a mesh to reproduce the error and another mesh that doesn't give this kind of error, in order to ensure that I don't break something while trying to solve the problem.

You can send me a download link via PM, if you prefer to not have it available publicly. And if the mesh has a sensitive geometry in it, then please try meshing something more generic, but that still reproduces the same problem.
wyldckat is offline   Reply With Quote

Old   April 17, 2016, 17:25
Default
  #6
Member
 
Join Date: Apr 2015
Location: EU
Posts: 38
Rep Power: 3
roadRunner is on a distinguished road
Dear Bruno,
thank you for your answer and suggestions.

I created another ~40m cell mesh, and it seems to produce the same error. So it seems that you're right, mesh is actually corrupted somehow. Or at least the biggest region. Small ones import with no problem.
Anyway, I have to roll back my meshing to the previous working version and move on from there. I will keep you posted.

Thank you for your suggestion, my geometry is in fact sensitive. Now I believe that I would be unable to reproduce this problem for a simple geometry. But I will try in order to rule out mesh size problem.
If I'm unable to solve this on my own, I will contact you.

Thanks again

ps I will report back in any case
__________________
beep-beep
roadRunner is offline   Reply With Quote

Old   April 18, 2016, 10:51
Default
  #7
Member
 
Join Date: Apr 2015
Location: EU
Posts: 38
Rep Power: 3
roadRunner is on a distinguished road
I was wrong, the smaller mesh actually works. To be more precise it works if I only convert the biggest region. If I try to do all, it brakes, which is consistent with what I've seen so far.

Ive tried to do some debugging myself:

It brakes exactly at line 714 of ccm26ToFoam.C:
Code:
ReadVertices(err, vertices, foamPointMap, foamPoints);
But the funny thing is: the subroutine is completed successfully! Which means, when I write out something at it's end, it's written out, which wouldn't be the case if there were problems.

So this has to be related somehow to memory management.

So anyway, this looks bad. Any idea how to proceed?

Also, when I run it on a different system, i get:
Code:
Reading state 'default' (Default state)
nPoints:309668433
bounding box:(0 0 0) (0 0 0)

--> FOAM FATAL ERROR: 
"Error reading cells"

    From function CheckError
    in file ccm26ToFoam.C at line 167.

FOAM exiting
from the code:
Code:
    CCMIOID mapID;
    CCMIOReadCells(&err, id, &mapID, &cellType[0], 0, nCells);
    CCMIOReadMap(&err, mapID, &mapData[0], 0, nCells);
    CheckError(err, "Error reading cells");
and
Code:
void CheckError(CCMIOError const &err, const Foam::string& str)
{
    if (err != kCCMIONoErr)
    {
        FatalErrorIn("CheckError")
            << str << exit(FatalError);
    }
}

I don't think this is a mesh error because it works in every possible situation except with a higher number of cells. It even works if I read in a specific region of the mesh (I export a specific region to .ccm) and not for the whole thing..




Thanks for reading,
__________________
beep-beep
roadRunner is offline   Reply With Quote

Old   April 19, 2016, 18:29
Default
  #8
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,636
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi roadRunner,

Without a test case, there isn't much I can do. All signs point to memory corruption when reading the ".ccm" file, on both machines.
The interesting detail is that the second machine is able to hold its own without crashing, but points out that there is "nothing" inside the mesh, given that even if there are over 300 million points, the bounding box is empty.

There might be a missing point on the list, or some weird file corruption is going on... which reminds me:
  1. What's the file size of the ".ccm" file?
  2. And what do the internal mesh reports give you in Star-CCM+?

There is a possible workaround, which is to output one region at a time, or to output a few regions at a time. Then you import into several OpenFOAM cases and then merge all of the meshes back into a single case. The you might need some uses of createPatch and possibly stitchMesh to make the mesh whole again, it necessary.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   April 22, 2016, 03:45
Default
  #9
Member
 
Join Date: Apr 2015
Location: EU
Posts: 38
Rep Power: 3
roadRunner is on a distinguished road
Hi Bruno,
I have to apologize, I was busy with other stuff, so this thread slipped my mind.

I tried different approach, where I switched to tetrahedral mesh (everything else kept the same) and it worked perfectly.

I'm also trying with polyhedral, but without BL, that hasn't worked so far.

So you were right, it is somehow a mesh problem. Especially, when I import the ccm file back to starccm, I get something like mesh invalid massage.
This is incredibly strange, because I only increased the mesh size a little bit, everything else was the same as in course meshes...

I would like to give you a test case, unfortunately I'm not allowed to share the geometry, or say what it is. I can make a mesh of a pipe with the same approach I used here and see what happens. -> I will try to do that today and send it over PM.

ccm file size is cca 22 gb.

Please note my gratitude for your help
__________________
beep-beep
roadRunner is offline   Reply With Quote

Old   April 24, 2016, 06:50
Default
  #10
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,636
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi roadRunner,

Quote:
Originally Posted by roadRunner View Post
So you were right, it is somehow a mesh problem. Especially, when I import the ccm file back to starccm, I get something like mesh invalid massage.
Hold on, if even Star-CCM+ is unable to import the mesh, then there isn't much we can do on OpenFOAM's import side.

Clearly there is a weird cell formation somewhere in the mesh that results in this problem. Therefore, whichever problem this is, it's on Star-CCM+'s side. Very likely there is a flat or negative volume cell somewhere.

Creating at test case will likely not be very successful, given that the problem is likely due to a specific geometrical issue in your case, e.g. a very tight corner or a boundary layer addition gone wrong between two surfaces that are very close to one another.

There is however another thing you can do with the tetrahedral mesh, you can convert in OpenFOAM with polyDualMesh to create the dual mesh of the tetrahedral mesh, namely a polyhedral mesh. For more details, I quickly Googled for is and found this thread: Usage of polyDualMesh utility - although there are more on this topic.


In the meantime, I'm returning this thread to the right place, namely the mesh conversion sub-forum for commercial meshers.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuing User Defined Real Gas Model issues aeroman FLUENT 6 April 8, 2016 03:34
Parallel User Defined Real Gas Model aeroman FLUENT 4 July 1, 2015 06:09
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 17 February 11, 2015 10:47
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23


All times are GMT -4. The time now is 08:16.