AMReX-Astro / Castro

Castro (Compressible Astrophysics): An adaptive mesh, astrophysical compressible (radiation-, magneto-) hydrodynamics simulation code for massively parallel CPU and GPU architectures.
http://amrex-astro.github.io/Castro
Other
298 stars 97 forks source link

can we switch the fluxes MF to a fluxregister? #1691

Open zingale opened 3 years ago

zingale commented 3 years ago

Right now, we create a MF fluxes where we add the fluxes during a subcycle, eventually copying them into the flux register. The hydro routines do not operate on the flux register directly, but instead increment the fluxes. We need this intermediate array to allow for the retry functionality. But this requires a lot of memory. Can we get away with replacing the fluxes MF with a second flux register?

maxpkatz commented 2 years ago

This can be done with #2147 as a first step, followed by a subsequent change to remove references to the fluxes MultiFab in post_timestep (which, I think, ends up being unnecessary since the only flux that is currently indirectly used in post_timestep is the mass fluxes array). Then we can drop the fluxes MultiFab entirely and handle this with a flux register. In exchange, we will need to maintain a second copy of the mass_fluxes array (to distinguish the current subcycle's fluxes from the full timestep's fluxes). But this is a good tradeoff overall.