Bad allocation while saving

Dear all,

While I’m saving the file as .cub5 I’m having this issue:
ERROR: Encountered an uncaught exception ‘std::bad_alloc’. Command failed.

The file I’m trying to save has a big mesh inside and the cubit version is the 2023.4.
The machine is a Linux machine.

Thank you very much

Hi Enrico,

It is possible that Cubit is running out of RAM on your machine while trying to save the large file.

The first thing I would do is make sure I have journal files describing my process. You can force a jounal file write of the existing session by doing journal off and then journal on from the command line. The second command will print the name of the currently active journal file. The prior commands will be written to a journal file with a number one less than the active name. For example,

Cubit> journal off
Command journalling is Off.
Finished Command: journal off
Cubit>journal on
Command journalling is On.
Commands will be journaled to 'C:\Users\karl\junk\cubit46.jou'
Journaled Command: journal on

In this case, the commands from the current session would be saved in the file cubit45.jou. Validate that you have the commands from the current session as a possible backup.

Can you try saving the mesh separately? Try saving it out in Exodus format. Exodus is a compact binary file with support for large meshes. Cubit does buffered writing of mesh data and attempts not to use too much memory during the write.

export mesh 'my_mesh.e'

Even if that fails, you might try deleting the mesh delete mesh and saving your geometry and mesh settings in the cub5 file. You should be able to regenerate the mesh based on the settings saved in the file.

The other thing you might try is writing to the legacy cub file, save as 'my_file.cub. I don’t think that should use less memory that the HDF5 writer, but it might. It also might crash Cubit in a low memory situation. Try this as a last resort.

Karl

Hi Karl,

Thank you for the response.

I don’t think that the systems run out of memory since the RAM in the system I’m working with is used at half during the saving process and I have 1 TB of RAM.

I can try to generate for you a journal and append it to this topic. Do you need all the commands to generate the mesh or just the command that makes that response?

The mesh file for example in Ansys format can be exported without any problem. But I could not save the file in a cubit format anyway.

I already tried saving the file with the .cub format but I have the same response.

If I delete the mesh I’m able to save the file again in a cubit format but in this case, I lose all the generated mesh.

I don’t know if the problem is related to the machine I’m using or the operating system.

Thank you very much,
Enrico

Hi Enrico,

Please clarify, you can save the mesh from Cubit in Ansys format, but you cannot save it in Exodus format from Cubit?

Can you save individual volumes and see if there is a specific volume that causes the problem. For example,

export mesh 'volume1.e' volume 1
export mesh 'volume2.e' volume 2

If you have many volumes we can write a short python script to loop over the volumes and write them out.

I would need the entire journal file to determine what is actually going on.

Karl

Hi Karl,

I can do for example:

export fluent ".../coreformFiles/test2908.msh" block all sideset all bcset all dimension 3 overwrite

but I cannot do:

Cubit>save cub5 ".../coreformFiles/test2908_1606.cub5" overwrite journal
ERROR: Encountered an uncaught exception 'std::bad_alloc'.  Command failed.
Cubit>

With the command that you posted, the program crashed and closed.
The mesh creation journal is “mesh19.jou” .
After the mesh generation with “mesh19.jou” doing File>Save or save cub5 ".../coreformFiles/test2908_1606.cub5" overwrite journal it gives the bad alloc error
mesh19.jou (26.8 KB)

Thanks Enrico,

I apologize for the crash. We do try to avoid those, but a bad memory allocation is frequently problematic. I find it odd that you can write to a fluent file but not an Exodus file.

I will see if I can replicate the problem in the latest version that was just released, 2023.8.

Thanks,
Karl

Hi Enrico,

Is it possible to share your geometry with me? The cub5 file would be best as that would let me see the mesh settings you are using as well.

Thanks,
Karl

Can I send the file by email?

Yes. Send it to karl@coreform.com