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
297 stars 99 forks source link

change how shock flag is computed for reactions #2724

Closed zingale closed 4 months ago

zingale commented 7 months ago

Right now, we use the shock flag (stored in the conserved state if USE_SHOCK_VAR=TRUE) in two different ways:

At the moment, it is computed only once per timestep -- at the start of the advection (in the same place that we compute the flattening coefficients).

But it appears that we are always zeroing it out in initialize_do_advance(), so the shock flag will always be zero in the first half of Strang reactions.

We should switch to computing it directly in when we call the burner, so it will be updated twice per step. For the first half Strang burn, this is easy, since Sborder has ghostcells. But for the second half of the Strang burn, S_new does not have ghost cells, so we would need to do a fill into a temporary Fab or MultiFab (we could just overwrite Sborder at this point, I think).

zingale commented 7 months ago

There is an additional complication though -- we need to remove the source terms, which we don't directly have at the new time (since we time-center the sources).

So it might just be simpler to compute the shock flag at the start of a timestep and keep it fixed for both halves of the burn -- this is certainly more in line with the way that Strang splitting works. Also since we are typically using small CFL numbers, it won't matter much.

zingale commented 7 months ago

there is an additional complication -- if we are to compute this before the first burn, we need the sources, so that means we need to compute gravity before the burn, which should be fine, since the burn doesn't change Phi

zingale commented 4 months ago

this has been completed