Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <algorithm>
7 : #include <cstddef>
8 : #include <vector>
9 :
10 : #include "DataStructures/DataBox/PrefixHelpers.hpp"
11 : #include "DataStructures/DataBox/Prefixes.hpp"
12 : #include "DataStructures/VariablesTag.hpp"
13 : #include "Domain/Structure/Element.hpp"
14 : #include "Domain/Tags.hpp"
15 : #include "Evolution/DiscontinuousGalerkin/OnlyDgBlockIds.hpp"
16 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/System.hpp"
17 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/System.hpp"
18 : #include "Utilities/Algorithm.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 : namespace grmhd::GhValenciaDivClean::subcell {
22 : /*!
23 : * \brief Zeros out the MHD time derivatives in the elements next to a DG-only
24 : * block that themselves are not DG-only elements.
25 : */
26 : template <typename System>
27 1 : struct ZeroMhdTimeDerivatives {
28 0 : using return_tags = tmpl::list<::Tags::Variables<
29 : db::wrap_tags_in<::Tags::dt, typename System::variables_tag::tags_list>>>;
30 0 : using argument_tags = tmpl::list<domain::Tags::Element<3>,
31 : evolution::dg::Tags::OnlyDgBlockIds<3>>;
32 :
33 : template <class DtTagsList>
34 0 : static void apply(const gsl::not_null<Variables<DtTagsList>*> dt_variables,
35 : const Element<3>& element,
36 : const std::vector<size_t>& only_dg_block_ids) {
37 : const bool bordering_dg_block =
38 : evolution::dg::borders_only_dg_block(element, only_dg_block_ids);
39 : const bool in_dg_only_zone =
40 : alg::found(only_dg_block_ids, element.id().block_id());
41 : if (bordering_dg_block and not in_dg_only_zone) {
42 : tmpl::for_each<
43 : typename grmhd::ValenciaDivClean::System::variables_tag::tags_list>(
44 : [&dt_variables]<class Tag>(tmpl::type_<Tag> /*meta*/) {
45 : auto& var = get<::Tags::dt<Tag>>(*dt_variables);
46 : for (size_t i = 0; i < var.size(); ++i) {
47 : var[i] = 0.0;
48 : }
49 : });
50 : }
51 : }
52 : };
53 : } // namespace grmhd::GhValenciaDivClean::subcell
|