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 : 9 : #include "DataStructures/DataBox/PrefixHelpers.hpp" 10 : #include "DataStructures/DataBox/Prefixes.hpp" 11 : #include "DataStructures/VariablesTag.hpp" 12 : #include "Domain/Structure/Element.hpp" 13 : #include "Domain/Tags.hpp" 14 : #include "Evolution/DgSubcell/SubcellOptions.hpp" 15 : #include "Evolution/DgSubcell/Tags/SubcellOptions.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 = 31 : tmpl::list<domain::Tags::Element<3>, 32 : evolution::dg::subcell::Tags::SubcellOptions<3>>; 33 : 34 : template <class DtTagsList> 35 0 : static void apply( 36 : const gsl::not_null<Variables<DtTagsList>*> dt_variables, 37 : const Element<3>& element, 38 : const evolution::dg::subcell::SubcellOptions& subcell_options) { 39 : const bool bordering_dg_block = alg::any_of( 40 : element.neighbors(), 41 : [&subcell_options](const auto& direction_and_neighbor) { 42 : const size_t first_block_id = 43 : direction_and_neighbor.second.ids().begin()->block_id(); 44 : return subcell_options.only_dg_block_ids().contains(first_block_id); 45 : }); 46 : const bool in_dg_only_zone = 47 : subcell_options.only_dg_block_ids().contains(element.id().block_id()); 48 : if (bordering_dg_block and not in_dg_only_zone) { 49 : tmpl::for_each< 50 : typename grmhd::ValenciaDivClean::System::variables_tag::tags_list>( 51 : [&dt_variables]<class Tag>(tmpl::type_<Tag> /*meta*/) { 52 : auto& var = get<::Tags::dt<Tag>>(*dt_variables); 53 : for (size_t i = 0; i < var.size(); ++i) { 54 : var[i] = 0.0; 55 : } 56 : }); 57 : } 58 : } 59 : }; 60 : } // namespace grmhd::GhValenciaDivClean::subcell