Issue with restart on Non-cubic domain/ depth()

60 views
Skip to first unread message

Pacharadech Wacharanan

unread,
Aug 29, 2025, 4:04:20 AM (9 days ago) Aug 29
to basilisk-fr
Dear all, 

I'm trying to simulate two-fluid in square duct, using non-cubic domain via Multigrid3D and MPI. To dump and restart, I run into the same issue as post here in April https://groups.google.com/g/basilisk-fr/c/i0rcMEy_KNY/m/eqpE4Io7DQAJ. (grid depth do not match error  (from the grid/multigrid.h file)). Upon inspection, the conflict is due to the depth that is recalculated in the restart function in output.h, and the one is being provided in the dump file is in conflict. Since I'm new to Basilisk, I'm not sure whether this is potentially a bug or just my confusion. Also what exactly is depth() for Multigrid3D. My understanding is it's the value of grid number (2^depth).

Output.h (The code below giving depth of 9 & init_grid(512))
dimensions (header.n.x, header.n.y, header.n.z); double n = header.n.x; int depth = header.depth; while (n > 1) depth++, n /= 2; init_grid (1 << depth);

My simulation parameter 
size(3);
dimensions(nx=3,ny=1,nz=1)
init_grid(260);

With 192 processors for MPI, and that is giving me depth() = 5 and a grid point of 384x128x128. 

Best Regards, 
Tay W

Brandon Aranda

unread,
Aug 30, 2025, 1:30:49 PM (8 days ago) Aug 30
to basilisk-fr
I looked into this issue a little more, and from my understanding, as you mentioned, the grid depth that is calculated by output.h when you restart the simulation is different than the one that is set at the beginning. This happens because the number of cells in your x direction is not equal to a power of 2. Unfortunately, I don't think there is any way around this so far, or at least from what I found. The only workaround, if your problem allows, would be to extend your geometry to the next closest power of 2, so in your case, make dimensions(nx=4,ny=1,nz=1) and then simply ignore the results in the last 1/4 of the x-dimension. In my case, I had a pipe with dimensions of 40x1x1 which I was not able to restart so I extended my geometry to 64x1x1 which did work. With my pipe, this was fine as I simply had to adjust some values and ignore the last section but depending on your problem you may have to adjust your boundary conditions. Of course, this leads to some wasted computational effort but if you need to restart then it seems to be the only option currently.
Reply all
Reply to author
Forward
0 new messages