diff --git a/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp b/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp index 5395630b379e..5eafb9254782 100644 --- a/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp +++ b/src/Evolution/Executables/RadiationTransport/M1Grey/EvolveM1Grey.hpp @@ -68,12 +68,15 @@ #include "ParallelAlgorithms/EventsAndTriggers/LogicalTriggers.hpp" #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp" #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp" +#include "PointwiseFunctions/AnalyticData/RadiationTransport/M1Grey/AnalyticData.hpp" +#include "PointwiseFunctions/AnalyticData/RadiationTransport/M1Grey/Factory.hpp" #include "PointwiseFunctions/AnalyticData/Tags.hpp" #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp" +#include "PointwiseFunctions/AnalyticSolutions/RadiationTransport/M1Grey/ConstantM1.hpp" #include "PointwiseFunctions/AnalyticSolutions/RadiationTransport/M1Grey/Factory.hpp" #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp" #include "PointwiseFunctions/Hydro/Tags.hpp" -#include "PointwiseFunctions/InitialDataUtilities/Tags/InitialData.hpp" +#include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp" #include "Time/Actions/AdvanceTime.hpp" #include "Time/Actions/CleanHistory.hpp" #include "Time/Actions/RecordTimeStepperData.hpp" @@ -110,9 +113,6 @@ class CProxy_GlobalCache; struct EvolutionMetavars { static constexpr size_t volume_dim = 3; - using initial_data_list = - RadiationTransport::M1Grey::Solutions::all_solutions; - // Set list of neutrino species to be used by M1 code using neutrino_species = tmpl::list>; @@ -124,6 +124,10 @@ struct EvolutionMetavars { TimeStepperBase::local_time_stepping; static constexpr bool use_dg_element_collection = false; + using initial_data_list = + tmpl::append; + using analytic_variables_tags = typename system::variables_tag::tags_list; using limiter = Tags::Limiter< Limiters::Minmod<3, typename system::variables_tag::tags_list>>; @@ -156,7 +160,6 @@ struct EvolutionMetavars { volume_dim, observe_fields, non_tensor_compute_tags>, Events::time_events>>>, tmpl::pair, - tmpl::pair, tmpl::pair, tmpl::pair, @@ -173,7 +176,8 @@ struct EvolutionMetavars { TimeSequences::all_time_sequences>, tmpl::pair, tmpl::pair>>; + Triggers::time_triggers>>, + tmpl::pair>; }; using observed_reduction_data_tags = @@ -269,8 +273,7 @@ struct EvolutionMetavars { using const_global_cache_tags = tmpl::list; - static constexpr Options::String help{ - "Evolve the M1Grey system (without coupling to hydro).\n\n"}; + static constexpr Options::String help{"Evolve the M1Grey system. \n\n"}; static constexpr std::array default_phase_order{ {Parallel::Phase::Initialization, diff --git a/src/Evolution/Systems/RadiationTransport/M1Grey/CMakeLists.txt b/src/Evolution/Systems/RadiationTransport/M1Grey/CMakeLists.txt index b720cb30cba6..6e33f9332d3b 100644 --- a/src/Evolution/Systems/RadiationTransport/M1Grey/CMakeLists.txt +++ b/src/Evolution/Systems/RadiationTransport/M1Grey/CMakeLists.txt @@ -37,6 +37,8 @@ target_link_libraries( GeneralRelativity Hydro LinearOperators + M1GreyAnalyticData + M1GreySolutions Serialization Utilities INTERFACE diff --git a/src/Evolution/Systems/RadiationTransport/M1Grey/Initialize.hpp b/src/Evolution/Systems/RadiationTransport/M1Grey/Initialize.hpp index fac331791120..a9ea8eada13a 100644 --- a/src/Evolution/Systems/RadiationTransport/M1Grey/Initialize.hpp +++ b/src/Evolution/Systems/RadiationTransport/M1Grey/Initialize.hpp @@ -13,7 +13,11 @@ #include "Parallel/AlgorithmExecution.hpp" #include "Parallel/GlobalCache.hpp" #include "ParallelAlgorithms/Initialization/MutateAssign.hpp" +#include "PointwiseFunctions/AnalyticData/RadiationTransport/M1Grey/Factory.hpp" +#include "PointwiseFunctions/AnalyticSolutions/RadiationTransport/M1Grey/Factory.hpp" #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp" +#include "PointwiseFunctions/InitialDataUtilities/Tags/InitialData.hpp" +#include "Utilities/CallWithDynamicType.hpp" #include "Utilities/Gsl.hpp" #include "Utilities/TMPL.hpp" #include "Utilities/TaggedTuple.hpp" @@ -22,10 +26,8 @@ namespace Frame { struct Inertial; } // namespace Frame -namespace evolution::initial_data::Tags { -struct InitialData; -} // namespace evolution::initial_data::Tags namespace Tags { +struct AnalyticSolutionOrData; struct Time; } // namespace Tags namespace domain { @@ -60,46 +62,64 @@ struct InitializeM1Tags { static Parallel::iterable_action_return_t apply( db::DataBox& box, const tuples::TaggedTuple& /*inboxes*/, - const Parallel::GlobalCache& /*cache*/, + const Parallel::GlobalCache& cache, const ArrayIndex& /*array_index*/, ActionList /*meta*/, const ParallelComponent* const /*meta*/) { using EvolvedVars = typename evolved_variables_tag::type; using HydroVars = typename hydro_variables_tag::type; using M1Vars = typename m1_variables_tag::type; - using derived_classes = - tmpl::at; - call_with_dynamic_type( - &db::get(box), - [&box](const auto* const data_or_solution) { - static constexpr size_t dim = System::volume_dim; - const double initial_time = db::get<::Tags::Time>(box); - const size_t num_grid_points = - db::get>(box).number_of_grid_points(); - const auto& inertial_coords = - db::get>(box); - - db::mutate( - [initial_time, &inertial_coords, &data_or_solution]( - const gsl::not_null evolved_vars) { - evolved_vars->assign_subset( - evolution::Initialization::initial_data( - *data_or_solution, inertial_coords, initial_time, - typename evolved_variables_tag::tags_list{})); - }, - make_not_null(&box)); - - // Get hydro variables - HydroVars hydro_variables{num_grid_points}; - hydro_variables.assign_subset(evolution::Initialization::initial_data( - *data_or_solution, inertial_coords, initial_time, - typename hydro_variables_tag::tags_list{})); - - M1Vars m1_variables{num_grid_points, -1.}; - Initialization::mutate_assign(make_not_null(&box), - std::move(hydro_variables), - std::move(m1_variables)); + + static constexpr size_t dim = System::volume_dim; + const double initial_time = db::get<::Tags::Time>(box); + const size_t num_grid_points = + db::get>(box).number_of_grid_points(); + const auto& inertial_coords = + db::get>(box); + + using initial_data_evo_tags = typename evolved_variables_tag::tags_list; + using initial_data_hydro_tags = typename hydro_variables_tag::tags_list; + + using initial_data_list = + tmpl::append; + + const auto initial_data_evo_vars = call_with_dynamic_type< + tuples::tagged_tuple_from_typelist, + initial_data_list>( + &Parallel::get(cache), + [&inertial_coords, &initial_time](const auto* const initial_data) { + return evolution::Initialization::initial_data( + *initial_data, inertial_coords, initial_time, + initial_data_evo_tags{}); + }); + + const auto initial_data_hydro_vars = call_with_dynamic_type< + tuples::tagged_tuple_from_typelist, + initial_data_list>( + &Parallel::get(cache), + [&inertial_coords, &initial_time](const auto* const initial_data) { + return evolution::Initialization::initial_data( + *initial_data, inertial_coords, initial_time, + initial_data_hydro_tags{}); }); + + db::mutate( + [&initial_data_evo_vars]( + const gsl::not_null evolved_vars) { + evolved_vars->assign_subset(initial_data_evo_vars); + }, + make_not_null(&box)); + + // Get hydro variables + HydroVars hydro_variables{num_grid_points}; + + hydro_variables.assign_subset(initial_data_hydro_vars); + + M1Vars m1_variables{num_grid_points, -1.}; + Initialization::mutate_assign(make_not_null(&box), + std::move(hydro_variables), + std::move(m1_variables)); + return {Parallel::AlgorithmExecution::Continue, std::nullopt}; } };