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