AMReX-Astro / Castro

Castro (Compressible Astrophysics): An adaptive mesh, astrophysical compressible (radiation-, magneto-) hydrodynamics simulation code for massively parallel CPU and GPU architectures.

Home Page:http://amrex-astro.github.io/Castro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change how shock flag is computed for reactions

zingale opened this issue · comments

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

  • if we are doing the hybrid Riemann solve, it is used to determine if we call the HLL solver
  • it is used to check if we are zeroing reactions if we disable burning in shocks.

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).

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.

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

this has been completed