Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/Tag.hpp" 7 : #include "DataStructures/Tensor/Tensor.hpp" 8 : #include "DataStructures/Variables.hpp" 9 : #include "DataStructures/VariablesTag.hpp" 10 : #include "Domain/Tags.hpp" 11 : #include "Elliptic/Tags.hpp" 12 : #include "Parallel/Tags/Metavariables.hpp" 13 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 14 : #include "PointwiseFunctions/Hydro/Tags.hpp" 15 : #include "PointwiseFunctions/InitialDataUtilities/Background.hpp" 16 : #include "Utilities/CallWithDynamicType.hpp" 17 : #include "Utilities/Gsl.hpp" 18 : #include "Utilities/TMPL.hpp" 19 : 20 1 : namespace Xcts::Tags { 21 : 22 : /*! 23 : * \brief MHD quantities retrieved from the background solution/data 24 : * 25 : * Retrieve the `HydroTags` from the background solution/data so they can be 26 : * written out to disk. These quantities don't take part in a pure XCTS solve, 27 : * (which only solves for the gravity sector given the matter profile) except 28 : * for their contributions to the matter source terms in the XCTS equations. 29 : * However, the matter source terms are computed and stored separately, so these 30 : * hydro quantities are only used for observations. 31 : */ 32 : template <typename HydroTags> 33 1 : struct HydroQuantitiesCompute : ::Tags::Variables<HydroTags>, db::ComputeTag { 34 0 : using base = ::Tags::Variables<HydroTags>; 35 0 : using argument_tags = tmpl::list< 36 : domain::Tags::Coordinates<3, Frame::Inertial>, 37 : elliptic::Tags::Background<elliptic::analytic_data::Background>, 38 : Parallel::Tags::Metavariables>; 39 : template <typename Metavariables> 40 0 : static void function(const gsl::not_null<Variables<HydroTags>*> result, 41 : const tnsr::I<DataVector, 3>& inertial_coords, 42 : const elliptic::analytic_data::Background& background, 43 : const Metavariables& /*meta*/) { 44 : using background_classes = 45 : tmpl::at<typename Metavariables::factory_creation::factory_classes, 46 : elliptic::analytic_data::Background>; 47 : *result = call_with_dynamic_type<Variables<HydroTags>, background_classes>( 48 : &background, [&inertial_coords](const auto* const derived) { 49 : return variables_from_tagged_tuple( 50 : derived->variables(inertial_coords, HydroTags{})); 51 : }); 52 : } 53 : }; 54 : 55 : } // namespace Xcts::Tags