Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <optional> 7 : #include <tuple> 8 : #include <utility> 9 : 10 : #include "DataStructures/DataBox/DataBox.hpp" 11 : #include "DataStructures/DataVector.hpp" 12 : #include "DataStructures/Tensor/EagerMath/Determinant.hpp" 13 : #include "DataStructures/Tensor/Tensor.hpp" 14 : #include "Domain/CoordinateMaps/CoordinateMap.hpp" 15 : #include "Domain/CoordinateMaps/Tags.hpp" 16 : #include "Domain/ElementMap.hpp" 17 : #include "Domain/Tags.hpp" 18 : #include "Evolution/DgSubcell/Tags/Coordinates.hpp" 19 : #include "Evolution/DgSubcell/Tags/Jacobians.hpp" 20 : #include "Evolution/DiscontinuousGalerkin/MortarData.hpp" 21 : #include "Evolution/DiscontinuousGalerkin/MortarTags.hpp" 22 : #include "Parallel/AlgorithmExecution.hpp" 23 : #include "Utilities/ErrorHandling/Assert.hpp" 24 : 25 : /// \cond 26 : namespace Parallel { 27 : template <typename Metavariables> 28 : class GlobalCache; 29 : } // namespace Parallel 30 : namespace tuples { 31 : template <typename...> 32 : class TaggedTuple; 33 : } // namespace tuples 34 : /// \endcond 35 : 36 : namespace evolution::dg::subcell::fd::Actions { 37 : /*! 38 : * \brief Take a finite-difference time step on the subcell grid. 39 : * 40 : * The template parameter `TimeDerivative` must have a `static apply` function 41 : * that takes the `DataBox` by `gsl::not_null` as the first argument, the 42 : * cell-centered inverse Jacobian from the logical to the grid frame as the 43 : * second argument, and its determinant as the third argument. 44 : * 45 : * GlobalCache: nothing 46 : * 47 : * DataBox: 48 : * - Uses: 49 : * - `subcell::fd::Tags::InverseJacobianLogicalToGrid<Dim>` 50 : * - `subcell::fd::Tags::DetInverseJacobianLogicalToGrid` 51 : * - `domain::Tags::ElementMap<Dim, Frame::Grid>` 52 : * - `domain::CoordinateMaps::Tags::CoordinateMap<Dim, Grid, Inertial>` 53 : * - `subcell::Tags::Coordinates<Dim, Frame::ElementLogical>` 54 : * - Anything that `Metavariables::SubcellOptions::TimeDerivative` uses 55 : * - Adds: nothing 56 : * - Removes: nothing 57 : * - Modifies: 58 : * - Anything that `Metavariables::SubcellOptions::TimeDerivative` modifies 59 : */ 60 : template <typename TimeDerivative> 61 1 : struct TakeTimeStep { 62 : template <typename DbTags, typename... InboxTags, typename Metavariables, 63 : typename ArrayIndex, typename ActionList, 64 : typename ParallelComponent, size_t Dim = Metavariables::volume_dim> 65 0 : static Parallel::iterable_action_return_t apply( 66 : db::DataBox<DbTags>& box, tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 67 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 68 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 69 : const ParallelComponent* const /*meta*/) { 70 : TimeDerivative::apply(make_not_null(&box)); 71 : 72 : db::mutate<evolution::dg::Tags::MortarData<Dim>>( 73 : [](const auto mortar_data_ptr) { 74 : for (auto& data : *mortar_data_ptr) { 75 : data.second = evolution::dg::MortarData<Dim>{}; 76 : } 77 : }, 78 : make_not_null(&box)); 79 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 80 : } 81 : }; 82 : } // namespace evolution::dg::subcell::fd::Actions