SpECTRE  v2022.05.05
evolution::dg::subcell::Actions::TciAndSwitchToDg< TciMutator > Struct Template Reference

Run the troubled-cell indicator on the subcell solution to see if it is safe to switch back to DG. More...

#include <TciAndSwitchToDg.hpp>

## Static Public Member Functions

template<typename DbTags , typename... InboxTags, typename Metavariables , typename ArrayIndex , typename ActionList , typename ParallelComponent , size_t Dim = Metavariables::volume_dim>
static std::tuple< db::DataBox< DbTags > && > apply (db::DataBox< DbTags > &box, const tuples::TaggedTuple< InboxTags... > &, const Parallel::GlobalCache< Metavariables > &, const ArrayIndex &, const ActionList, const ParallelComponent *const)

## Detailed Description

template<typename TciMutator>
struct evolution::dg::subcell::Actions::TciAndSwitchToDg< TciMutator >

Run the troubled-cell indicator on the subcell solution to see if it is safe to switch back to DG.

In terms of the DG-subcell/FD hybrid solver, this action is run after the FD step has calculated the solution at $$t^{n+1}$$. At this point we check if the FD solution at the new time $$t^{n+1}$$ is representable on the DG grid.

The algorithm proceeds as follows:

1. If we are using a substep time integrator and are not at the end of a step, or we are in the self-starting stage of a multistep method, or the subcell_options.always_use_subcells() == true, then we do not run any TCI or try to go back to DG. We need to avoid reconstructing (in the sense of the inverse of projecting the DG solution to the subcells) the time stepper history if there are shocks present in the history, and for substep methods this is most easily handled by only switching back at the end of a full time step. During the self-start phase of the multistep time integrators we integrate over the same region of time at increasingly higher order, which means if we were on subcell "previously" (since we use a forward-in-time self-start method the time history is actually in the future of the current step) then we will very likely need to again switch to subcell.
2. Reconstruct the subcell solution to the DG grid.
3. Run the relaxed discrete maximum principle (RDMP) troubled-cell indicator (TCI), checking both the subcell solution at $$t^{n+1}$$ and the reconstructed DG solution at $$t^{n+1}$$ to make sure they are admissible.
4. If the RDMP TCI marked the DG solution as admissible, run the user-specified mutator TCI TciMutator.
5. If the cell is not troubled, and the time integrator type is substep or the TCI history indicates the entire history for the multistep method is free of discontinuities, then we can switch back to DG. Switching back to DG requires swapping the active and inactive evolved variables, reconstructing the time stepper history, marking the active grid as ActiveGrid::Dg, and clearing the subcell neighbor data.
6. If we are not using a substep method, then record the TCI decision in the subcell::Tags::TciGridHistory.
Note
Unlike Actions::TciAndRollback, this action does not jump back to Labels::BeginDg. This is because users may add actions after a time step has been completed. In that sense, it may be more proper to actually check the TCI and switch back to DG at the start of the step rather than the end.
This action always sets subcell::Tags::DidRollback to false at the very beginning since this action is called after an FD step has completed.

GlobalCache:

• Uses:
• subcell::Tags::SubcellOptions

DataBox:

• Uses:
• domain::Tags::Mesh<Dim>
• subcell::Tags::Mesh<Dim>
• Tags::TimeStepId
• subcell::Tags::ActiveGrid
• subcell::Tags::DataForRdmpTci
• subcell::Tags::TciGridHistory
• subcell::Tags::Inactive<System::variables_tag>
• System::variables_tag if the cell is not troubled
• Tags::HistoryEvolvedVariables if the cell is not troubled
• subcell::Tags::ActiveGrid if the cell is not troubled
• subcell::Tags::DidRollback sets to false
• subcell::Tags::NeighborDataForReconstruction<Dim> if the cell is not troubled
• subcell::Tags::TciGridHistory if the time stepper is a multistep method