Castro icon indicating copy to clipboard operation
Castro copied to clipboard

not all FABs in hydro need 4 ghost cells

Open zingale opened this issue 4 years ago • 2 comments

The only quantity in hydro that needs 4 ghost cells is pressure, and that's just because of the flattening algorithm.

But we allocate q, qaux, and src_q all with 4 ghost cells.

We can at least drop qaux and src_q to 3.

It might be possible to drop q to 3 as well if we can compute the flattening coefficient when we define the primitive variables (I think this might be possible)

zingale avatar May 09 '21 02:05 zingale

one thing we could do is the following

allocate q and qaux with 3 ghost cells, using the box qbx3 create a new single component FAB with 4 ghostcells (using the box qbx) just for pressure, call it p_flat

do the loop ctoprim over qbx, storing the pressure in p_flat on the whole box and filling q and qaux only if they are in the box qbx3

then do the flattening using p_flat.

This will save a lot of ghost cell memory, and we can destroy p_flat right after we do the flattening. For problems with a lot of nuclei, this savings could be a lot.

zingale avatar May 09 '21 18:05 zingale

It would be nice if we can devise a flattening algorithm that only requires one cell to the left and right for pressure.

maximumcats avatar May 20 '21 02:05 maximumcats