facing issue while saving multiple snapshots

26 views
Skip to first unread message

Nivesh Mishra

unread,
Aug 18, 2025, 12:27:12 PMAug 18
to basilisk-fr

Hello Basilisk users,

I am working on a problem where I need to save multiple snapshots during the simulation.
While doing this, I encounter an issue at certain snapshot numbers where the program stops with the message:Too many open files

I have included the event snapshot section of my code below, along with the exact comments/output that appear during execution.

event snapshots (t = 0; t += dtuser; t <= MAXTIME) {
  int index = (int) round(t / dtuser);  // Ensure accurate integer index;
  char name[80];
  sprintf(name, "snap-%05d.ppm", index);

  view (fov = 0,
        quat = {0, 0, -0.707, 0.707},
        tx = 0.0, ty = -0.01, tz = -0.3,
        sx = 1.5, sy = 1.5, sz = 1.5,
        width = 1000, height = 1000);

  clear();
  draw_vof("f", lw = 2);  // Draw the interface
 
  // Add time annotation
  char str[80];
  sprintf(str, "t = %.3f", t);
  draw_string(str, 1, 1, size = 30); // Top-left corner
 
  save(name);
  fflush(stdout);

}

and this is the output 

snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files
snap-00842.ppm: Too many open files

What I found on the internet, this error can be caused by the ulimit setting of the HPC system. I have already increased the open file limit to 16384, but this still does not solve my problem.

Has anyone faced a similar issue, and is there a recommended way to handle or avoid this error?

Thanks and regards
Nivesh

Reply all
Reply to author
Forward
0 new messages