Prolongation/Notes

From Einstein Toolkit Documentation
Jump to: navigation, search

2017-08-08: Algorithm notes

Have three sets of equations:

1. RK4 2. ys in ks 3. ks in ys

Algorithm for unigrid evolution of existing data at t_n:

  • Use RK4 to set y_{n+1}
  • Repeat

Algorithm for 2-level evolution of existing data at t_n:

  • Evolve coarse grid using RK4. Keeps the ks in gridfunctions and y_n and y_{n+1}.
  • Spatially prolongate the coarse ks to the fine ks in the RB
  • Save y_{n+1} on the RB using "ys in ks" and the prolongated coarse grid ks
  • Compute fine ks from coarse ks on the RB using "ys in ks" at th=0 then "ks in ys"
  • Compute f(Y1) using the RHS function on the interior
  • Set k1 using RK4 on the interior
  • k1 is now set everywhere
  • Set Y2 using RK4
  • Set k2 using RK4 on the interior
  • Already have fine k2 on RB
  • Set Y3 using RK4
  • Set k3 using RK4 on the interior
  • Already have fine k3 on RB
  • Set Y4 from RK4
  • Set k4 from RK4 on the interior
  • Do not have k4 on the RB
  • Set y_{n+1} using RK4 on the interior
  • Restore the saved y_{n+1} on the RB
  • Now have y_{n+1} everywhere
  • Spatially prolongate the coarse ks to the fine ks in the RB (either do this again, or don't overwrite the ks. if we are using efficient RK4, we might not be setting the same k variables directly * anyway, so this isn't an issue?)
  • Compute the fine grid ks from the coarse ks in the RB using "ys in ks" at th=1 then "ks in ys"
  • Repeat RK4 steps to advance fine grid to t_{n+2}

Current Carpet/MoL algorithm:

  • t_n, t_{n-1} and t_{n-2} initialised by ID
  • Compute f in interior
  • MoL_Add to compute Y2
  • Prolongate Y2 from coarse grid
  • Compute f in interior
  • MoL_Add to compute Y3
  • Prolongate Y2 from coarse grid
  • Compute f in interior
  • MoL_Add to compute Y4
  • Prolongate Y2 from coarse grid
  • Compute f in interior
  • Accumulate vars into y_{n+1}
  • Prolongate Y2 from coarse grid

How can we implement the new algorithm?

Suppose we only prolongate the ks once, at t_n. RHSs computed as normal on the interior. Schedule a new function before MoL_Add to set the rhs variables to 1/dt k_i where these k_i are computed using the prolongated k variables using ks in ys and ys in ks.


2017-08-09: Schedule

When Old Changes for RK prolongation
CCTK_INITIAL State vector set at t=0 ks, kTildes undefined (they are set during evolution)
CCTK_EVOL Time and iteration variables advanced.
MoL_SetCounter Disable Carpet prolongation (for buffer zone method)
MoL_ProlongateKs Prolongate ks into RBs. Copy ks into kTildes everywhere (in future, only on the RBs).
Loop over steps:
MoL_CalcRHS Physics thorns compute RHSs on the grid interior
MoL_RHSBoundaries Compute RHS in RB using kTildes (currently also compute in ghost zones)
MoL_SetKs Compute and store the k variables from the RHS variables into the ks over the whole grid. Apply BCs for the interprocessor and outer boundaries of the ks. Prolongation is still disabled.
MoL_Add MoL performs one update step
MoL_PostStep Sync evolved variable ghost zones, apply BCs. Prolongate RBs of evolved variables. Don't prolongate evolved variables.
MoL::MoL_ReenableProlongation Re-enable prolongation

2017-08-18: Transition zone

  • Need to prolongate an additional set of points (number should be a parameter; will try 3 to start with).
  • Can implement this using the existing code for buffer zones. Should be able to set "use_buffer_zones = yes" and "additional_buffer_zones = -nghosts*(rk_substeps-2). This will remove all but the last nghosts buffer zones.
  • Now, when Carpet prolongates the ks, it will give us all 6 points. However, now there is a problem. We need to continue to do our RK prolongation in MoL on the last three points. No code change needed. But then we need to identify the transition zone. This is the set of buffer points which are NOT the last three ghost points. For now, we can assume that all internal boundary faces are refinement boundaries, and run on a single process so there are no interprocessor boundaries.
  • When we prolongate the ks, we could also prolongate the state vector. However, this is going to be used by MoL in its integration, so we would lose information. We could copy the state vector into a temporary variable (e.g. the scratch space), then prolongate it, then swap it out with the scratch space. so now we would have y_n from the coarse grid in the scratch space. We will then need access to this at the end of the step, so probably we just use another grid function for it. Then we may as well use that instead of the scratch space. So we define a new gridfunction for the coarse y_n, and use it to store the prolongated evolved variables. This will be kept around for the whole step, and used at the end to compute y_{n+1} on the coarse grid, and hence to do the blending.
  • It seems like applying the blending at every substep would be better. Assume that you have the solution on the coarse grid for the current step. This will result in a certain error wrt the continuum solution. When you take the first substep on the fine grid, you will get a smaller error, in a way which is not smoothly related to the coarse grid error. The last evolved point will "see" the coarse grid solution from the prolongated points as a boundary condition, and the evaluation of the derivatives using this point will effectively be differencing a discontinuous "solution". We don't apply the blending until the end of the fine grid step, so any effects of this problem will propagate into the domain into a region of size nghosts*4 (more or less). After the 4 substeps, we then blend the coarse grid solution with the fine grid in the transition zone. So I can imagine that this helps a bit, but it doesn't seem to solve the problem in the best way.
  • Instead, we could compute the ks in the transition zone as a blending between the ks that we prolongate with, and the ks that come from evolution on the fine grid. I think this would smooth out the discontinuity between the grids much better.
  • How is this related to the "sponge" boundary conditions that Bishop mentioned?

Plan

  • Add three buffer zones to the simulation
  • Add a new gridfunction for the prolongated state vector
  • Prolongate the state vector at the same time as the ks and store the result in the prolongated state vector variable (do this by a store-and-swap strategy)
  • At the end of the time step, compute pointwise the coarse grid y_{n+1} from the ks and the prolongated y_n, and blend it with the integrated fine grid solution on the transition zone