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 : 8 : #include "DataStructures/DataBox/DataBox.hpp" 9 : #include "DataStructures/Tensor/EagerMath/Norms.hpp" 10 : #include "DataStructures/Variables.hpp" 11 : #include "Evolution/Systems/ScalarWave/Constraints.hpp" 12 : #include "Evolution/Systems/ScalarWave/System.hpp" 13 : #include "Evolution/Systems/ScalarWave/Tags.hpp" 14 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" 15 : #include "Parallel/AlgorithmExecution.hpp" 16 : #include "Parallel/GlobalCache.hpp" 17 : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" 18 : #include "Utilities/ErrorHandling/Assert.hpp" 19 : 20 : namespace ScalarWave { 21 0 : namespace Actions { 22 : /// \ingroup InitializationGroup 23 : /// \brief Initialize items related to constraints of the ScalarWave system 24 : /// 25 : /// We add both constraints and the constraint damping parameter to the 26 : /// evolution databox. 27 : /// 28 : /// DataBox changes: 29 : /// - Adds: 30 : /// * `ScalarWave::Tags::ConstraintGamma2` 31 : /// - Removes: nothing 32 : /// - Modifies: nothing 33 : template <size_t Dim> 34 1 : struct InitializeConstraints { 35 0 : using simple_tags = tmpl::list<ScalarWave::Tags::ConstraintGamma2>; 36 : 37 0 : using compute_tags = tmpl::list<>; 38 : 39 : template <typename DbTagsList, typename... InboxTags, typename Metavariables, 40 : typename ArrayIndex, typename ActionList, 41 : typename ParallelComponent> 42 0 : static Parallel::iterable_action_return_t apply( 43 : db::DataBox<DbTagsList>& box, 44 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/, 45 : const Parallel::GlobalCache<Metavariables>& /*cache*/, 46 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/, 47 : const ParallelComponent* const /*meta*/) { 48 : const auto& mesh = db::get<domain::Tags::Mesh<Dim>>(box); 49 : Scalar<DataVector> gamma_2{mesh.number_of_grid_points(), 0.}; 50 : 51 : Initialization::mutate_assign<simple_tags>(make_not_null(&box), 52 : std::move(gamma_2)); 53 : 54 : return {Parallel::AlgorithmExecution::Continue, std::nullopt}; 55 : } 56 : }; 57 : } // namespace Actions 58 : } // namespace ScalarWave