SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Executables/Burgers - EvolveBurgers.hpp Hit Total Coverage
Commit: 2db722c93a8e9b106e406b439b79c8e05c2057fb Lines: 0 31 0.0 %
Date: 2021-03-03 22:01:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstdint>
       7             : #include <vector>
       8             : 
       9             : #include "Domain/Creators/RegisterDerivedWithCharm.hpp"
      10             : #include "Domain/Creators/TimeDependence/RegisterDerivedWithCharm.hpp"
      11             : #include "Domain/FunctionsOfTime/RegisterDerivedWithCharm.hpp"
      12             : #include "Domain/Tags.hpp"
      13             : #include "Evolution/Actions/AddMeshVelocitySourceTerms.hpp"
      14             : #include "Evolution/ComputeTags.hpp"
      15             : #include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivative.hpp"
      16             : #include "Evolution/DiscontinuousGalerkin/DgElementArray.hpp"  // IWYU pragma: keep
      17             : #include "Evolution/DiscontinuousGalerkin/Limiters/LimiterActions.hpp"
      18             : #include "Evolution/DiscontinuousGalerkin/Limiters/Minmod.hpp"
      19             : #include "Evolution/DiscontinuousGalerkin/Limiters/Tags.hpp"
      20             : #include "Evolution/Initialization/ConservativeSystem.hpp"
      21             : #include "Evolution/Initialization/DgDomain.hpp"
      22             : #include "Evolution/Initialization/DiscontinuousGalerkin.hpp"
      23             : #include "Evolution/Initialization/Evolution.hpp"
      24             : #include "Evolution/Initialization/Limiter.hpp"
      25             : #include "Evolution/Initialization/SetVariables.hpp"
      26             : #include "Evolution/Systems/Burgers/System.hpp"
      27             : #include "IO/Observer/Actions/RegisterEvents.hpp"
      28             : #include "IO/Observer/Helpers.hpp"
      29             : #include "IO/Observer/ObserverComponent.hpp"
      30             : #include "NumericalAlgorithms/DiscontinuousGalerkin/Actions/ImposeBoundaryConditions.hpp"  // IWYU pragma: keep
      31             : #include "NumericalAlgorithms/DiscontinuousGalerkin/BoundarySchemes/FirstOrder/FirstOrderScheme.hpp"
      32             : #include "NumericalAlgorithms/DiscontinuousGalerkin/BoundarySchemes/FirstOrder/FirstOrderSchemeLts.hpp"
      33             : #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp"
      34             : #include "NumericalAlgorithms/DiscontinuousGalerkin/NumericalFluxes/LocalLaxFriedrichs.hpp"
      35             : #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
      36             : #include "Options/Options.hpp"
      37             : #include "Parallel/Actions/TerminatePhase.hpp"
      38             : #include "Parallel/InitializationFunctions.hpp"
      39             : #include "Parallel/PhaseDependentActionList.hpp"
      40             : #include "Parallel/RegisterDerivedClassesWithCharm.hpp"
      41             : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
      42             : #include "ParallelAlgorithms/DiscontinuousGalerkin/CollectDataForFluxes.hpp"
      43             : #include "ParallelAlgorithms/DiscontinuousGalerkin/FluxCommunication.hpp"
      44             : #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeDomain.hpp"
      45             : #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeInterfaces.hpp"
      46             : #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeMortars.hpp"
      47             : #include "ParallelAlgorithms/Events/ObserveErrorNorms.hpp"
      48             : #include "ParallelAlgorithms/Events/ObserveFields.hpp"
      49             : #include "ParallelAlgorithms/Events/ObserveTimeStep.hpp"
      50             : #include "ParallelAlgorithms/EventsAndTriggers/Actions/RunEventsAndTriggers.hpp"  // IWYU pragma: keep
      51             : #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
      52             : #include "ParallelAlgorithms/EventsAndTriggers/EventsAndTriggers.hpp"  // IWYU pragma: keep
      53             : #include "ParallelAlgorithms/EventsAndTriggers/Tags.hpp"
      54             : #include "ParallelAlgorithms/Initialization/Actions/AddComputeTags.hpp"
      55             : #include "ParallelAlgorithms/Initialization/Actions/RemoveOptionsAndTerminatePhase.hpp"
      56             : #include "PointwiseFunctions/AnalyticData/Burgers/Sinusoid.hpp"  // IWYU pragma: keep
      57             : #include "PointwiseFunctions/AnalyticSolutions/Burgers/Bump.hpp"  // IWYU pragma: keep
      58             : #include "PointwiseFunctions/AnalyticSolutions/Burgers/Linear.hpp"  // IWYU pragma: keep
      59             : #include "PointwiseFunctions/AnalyticSolutions/Burgers/Step.hpp"  // IWYU pragma: keep
      60             : #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
      61             : #include "Time/Actions/AdvanceTime.hpp"                // IWYU pragma: keep
      62             : #include "Time/Actions/ChangeSlabSize.hpp"             // IWYU pragma: keep
      63             : #include "Time/Actions/ChangeStepSize.hpp"             // IWYU pragma: keep
      64             : #include "Time/Actions/RecordTimeStepperData.hpp"      // IWYU pragma: keep
      65             : #include "Time/Actions/SelfStartActions.hpp"           // IWYU pragma: keep
      66             : #include "Time/Actions/UpdateU.hpp"                    // IWYU pragma: keep
      67             : #include "Time/StepChoosers/Cfl.hpp"                   // IWYU pragma: keep
      68             : #include "Time/StepChoosers/Constant.hpp"              // IWYU pragma: keep
      69             : #include "Time/StepChoosers/Increase.hpp"              // IWYU pragma: keep
      70             : #include "Time/StepChoosers/PreventRapidIncrease.hpp"  // IWYU pragma: keep
      71             : #include "Time/StepChoosers/StepChooser.hpp"
      72             : #include "Time/StepChoosers/StepToTimes.hpp"
      73             : #include "Time/StepControllers/StepController.hpp"
      74             : #include "Time/Tags.hpp"
      75             : #include "Time/TimeSequence.hpp"
      76             : #include "Time/TimeSteppers/TimeStepper.hpp"
      77             : #include "Time/Triggers/TimeTriggers.hpp"
      78             : #include "Utilities/Blas.hpp"
      79             : #include "Utilities/ErrorHandling/FloatingPointExceptions.hpp"
      80             : #include "Utilities/TMPL.hpp"
      81             : 
      82             : // IWYU pragma: no_include <pup.h>
      83             : 
      84             : /// \cond
      85             : namespace Frame {
      86             : struct Inertial;
      87             : }  // namespace Frame
      88             : namespace Parallel {
      89             : template <typename Metavariables>
      90             : class CProxy_GlobalCache;
      91             : }  // namespace Parallel
      92             : /// \endcond
      93             : 
      94             : template <typename InitialData>
      95           0 : struct EvolutionMetavars {
      96           0 :   static constexpr size_t volume_dim = 1;
      97           0 :   using system = Burgers::System;
      98           0 :   static constexpr dg::Formulation dg_formulation =
      99             :       dg::Formulation::StrongInertial;
     100           0 :   using temporal_id = Tags::TimeStepId;
     101           0 :   static constexpr bool local_time_stepping = false;
     102             : 
     103           0 :   using initial_data = InitialData;
     104             :   static_assert(
     105             :       evolution::is_analytic_data_v<initial_data> xor
     106             :           evolution::is_analytic_solution_v<initial_data>,
     107             :       "initial_data must be either an analytic_data or an analytic_solution");
     108           0 :   using initial_data_tag =
     109             :       tmpl::conditional_t<evolution::is_analytic_solution_v<initial_data>,
     110             :                           Tags::AnalyticSolution<initial_data>,
     111             :                           Tags::AnalyticData<initial_data>>;
     112             : 
     113           0 :   using boundary_condition_tag = initial_data_tag;
     114           0 :   using normal_dot_numerical_flux =
     115             :       Tags::NumericalFlux<dg::NumericalFluxes::LocalLaxFriedrichs<system>>;
     116           0 :   using limiter =
     117             :       Tags::Limiter<Limiters::Minmod<1, system::variables_tag::tags_list>>;
     118             : 
     119           0 :   using step_choosers_common =
     120             :       tmpl::list<StepChoosers::Registrars::Cfl<volume_dim, Frame::Inertial>,
     121             :                  StepChoosers::Registrars::Constant,
     122             :                  StepChoosers::Registrars::Increase>;
     123           0 :   using step_choosers_for_step_only =
     124             :       tmpl::list<StepChoosers::Registrars::PreventRapidIncrease>;
     125           0 :   using step_choosers_for_slab_only =
     126             :       tmpl::list<StepChoosers::Registrars::StepToTimes>;
     127           0 :   using step_choosers = tmpl::conditional_t<
     128             :       local_time_stepping,
     129             :       tmpl::append<step_choosers_common, step_choosers_for_step_only>,
     130             :       tmpl::list<>>;
     131           0 :   using slab_choosers = tmpl::conditional_t<
     132             :       local_time_stepping,
     133             :       tmpl::append<step_choosers_common, step_choosers_for_slab_only>,
     134             :       tmpl::append<step_choosers_common, step_choosers_for_step_only,
     135             :                    step_choosers_for_slab_only>>;
     136             : 
     137           0 :   using time_stepper_tag = Tags::TimeStepper<
     138             :       tmpl::conditional_t<local_time_stepping, LtsTimeStepper, TimeStepper>>;
     139           0 :   using boundary_scheme = tmpl::conditional_t<
     140             :       local_time_stepping,
     141             :       dg::FirstOrderScheme::FirstOrderSchemeLts<
     142             :           volume_dim, typename system::variables_tag,
     143             :           db::add_tag_prefix<::Tags::dt, typename system::variables_tag>,
     144             :           normal_dot_numerical_flux, Tags::TimeStepId, time_stepper_tag>,
     145             :       dg::FirstOrderScheme::FirstOrderScheme<
     146             :           volume_dim, typename system::variables_tag,
     147             :           db::add_tag_prefix<::Tags::dt, typename system::variables_tag>,
     148             :           normal_dot_numerical_flux, Tags::TimeStepId>>;
     149             : 
     150             :   // public for use by the Charm++ registration code
     151           0 :   using observe_fields = typename system::variables_tag::tags_list;
     152           0 :   using analytic_solution_fields =
     153             :       tmpl::conditional_t<evolution::is_analytic_solution_v<initial_data>,
     154             :                           observe_fields, tmpl::list<>>;
     155           0 :   using events = tmpl::flatten<tmpl::list<
     156             :       tmpl::conditional_t<evolution::is_analytic_solution_v<initial_data>,
     157             :                           dg::Events::Registrars::ObserveErrorNorms<
     158             :                               Tags::Time, analytic_solution_fields>,
     159             :                           tmpl::list<>>,
     160             :       dg::Events::Registrars::ObserveFields<1, Tags::Time, observe_fields,
     161             :                                             analytic_solution_fields>,
     162             :       Events::Registrars::ObserveTimeStep<EvolutionMetavars>,
     163             :       Events::Registrars::ChangeSlabSize<slab_choosers>>>;
     164           0 :   using triggers = Triggers::time_triggers;
     165             : 
     166           0 :   using const_global_cache_tags =
     167             :       tmpl::list<initial_data_tag, normal_dot_numerical_flux, time_stepper_tag,
     168             :                  Tags::EventsAndTriggers<events, triggers>>;
     169             : 
     170           0 :   using observed_reduction_data_tags = observers::collect_reduction_data_tags<
     171             :       typename Event<events>::creatable_classes>;
     172             : 
     173           0 :   using step_actions = tmpl::flatten<tmpl::list<
     174             :       evolution::dg::Actions::ComputeTimeDerivative<EvolutionMetavars>,
     175             :       tmpl::conditional_t<
     176             :           evolution::is_analytic_solution_v<initial_data>,
     177             :           dg::Actions::ImposeDirichletBoundaryConditions<EvolutionMetavars>,
     178             :           tmpl::list<>>,
     179             :       dg::Actions::CollectDataForFluxes<
     180             :           boundary_scheme,
     181             :           domain::Tags::BoundaryDirectionsInterior<volume_dim>>,
     182             :       dg::Actions::ReceiveDataForFluxes<boundary_scheme>,
     183             :       tmpl::conditional_t<local_time_stepping,
     184             :                           tmpl::list<Actions::RecordTimeStepperData<>,
     185             :                                      Actions::MutateApply<boundary_scheme>>,
     186             :                           tmpl::list<Actions::MutateApply<boundary_scheme>,
     187             :                                      Actions::RecordTimeStepperData<>>>,
     188             :       Actions::UpdateU<>, Limiters::Actions::SendData<EvolutionMetavars>,
     189             :       Limiters::Actions::Limit<EvolutionMetavars>>>;
     190             : 
     191           0 :   enum class Phase {
     192             :     Initialization,
     193             :     RegisterWithObserver,
     194             :     InitializeTimeStepperHistory,
     195             :     Evolve,
     196             :     Exit
     197             :   };
     198             : 
     199           0 :   using initialization_actions = tmpl::list<
     200             :       Actions::SetupDataBox,
     201             :       Initialization::Actions::TimeAndTimeStep<EvolutionMetavars>,
     202             :       evolution::dg::Initialization::Domain<1>,
     203             :       Initialization::Actions::ConservativeSystem<system>,
     204             :       evolution::Initialization::Actions::SetVariables<
     205             :           domain::Tags::Coordinates<1, Frame::Logical>>,
     206             :       Initialization::Actions::TimeStepperHistory<EvolutionMetavars>,
     207             :       dg::Actions::InitializeInterfaces<
     208             :           system,
     209             :           dg::Initialization::slice_tags_to_face<
     210             :               typename system::variables_tag>,
     211             :           dg::Initialization::slice_tags_to_exterior<>,
     212             :           dg::Initialization::face_compute_tags<>,
     213             :           dg::Initialization::exterior_compute_tags<>, true, true>,
     214             :       tmpl::conditional_t<
     215             :           evolution::is_analytic_solution_v<initial_data>,
     216             :           Initialization::Actions::AddComputeTags<
     217             :               tmpl::list<evolution::Tags::AnalyticCompute<
     218             :                   1, initial_data_tag, analytic_solution_fields>>>,
     219             :           tmpl::list<>>,
     220             :       dg::Actions::InitializeMortars<boundary_scheme>,
     221             :       Initialization::Actions::DiscontinuousGalerkin<EvolutionMetavars>,
     222             :       Initialization::Actions::Minmod<1>,
     223             :       Initialization::Actions::RemoveOptionsAndTerminatePhase>;
     224             : 
     225           0 :   using component_list = tmpl::list<
     226             :       observers::Observer<EvolutionMetavars>,
     227             :       observers::ObserverWriter<EvolutionMetavars>,
     228             :       DgElementArray<
     229             :           EvolutionMetavars,
     230             :           tmpl::list<
     231             :               Parallel::PhaseActions<Phase, Phase::Initialization,
     232             :                                      initialization_actions>,
     233             : 
     234             :               Parallel::PhaseActions<
     235             :                   Phase, Phase::RegisterWithObserver,
     236             :                   tmpl::list<observers::Actions::RegisterEventsWithObservers,
     237             :                              Parallel::Actions::TerminatePhase>>,
     238             : 
     239             :               Parallel::PhaseActions<
     240             :                   Phase, Phase::InitializeTimeStepperHistory,
     241             :                   SelfStart::self_start_procedure<step_actions, system>>,
     242             : 
     243             :               Parallel::PhaseActions<
     244             :                   Phase, Phase::Evolve,
     245             :                   tmpl::list<
     246             :                       Actions::RunEventsAndTriggers, Actions::ChangeSlabSize,
     247             :                       tmpl::conditional_t<
     248             :                           local_time_stepping,
     249             :                           Actions::ChangeStepSize<step_choosers>, tmpl::list<>>,
     250             :                       step_actions, Actions::AdvanceTime>>>>>;
     251             : 
     252           0 :   static constexpr Options::String help{
     253             :       "Evolve the Burgers equation.\n\n"
     254             :       "The analytic solution is: Linear\n"
     255             :       "The numerical flux is:    LocalLaxFriedrichs\n"};
     256             : 
     257             :   template <typename... Tags>
     258           0 :   static Phase determine_next_phase(
     259             :       const gsl::not_null<
     260             :           tuples::TaggedTuple<Tags...>*> /*phase_change_decision_data*/,
     261             :       const Phase& current_phase,
     262             :       const Parallel::CProxy_GlobalCache<
     263             :           EvolutionMetavars>& /*cache_proxy*/) noexcept {
     264             :     switch (current_phase) {
     265             :       case Phase::Initialization:
     266             :         return Phase::InitializeTimeStepperHistory;
     267             :       case Phase::InitializeTimeStepperHistory:
     268             :         return Phase::RegisterWithObserver;
     269             :       case Phase::RegisterWithObserver:
     270             :         return Phase::Evolve;
     271             :       case Phase::Evolve:
     272             :         return Phase::Exit;
     273             :       case Phase::Exit:
     274             :         ERROR(
     275             :             "Should never call determine_next_phase with the current phase "
     276             :             "being 'Exit'");
     277             :       default:
     278             :         ERROR(
     279             :             "Unknown type of phase. Did you static_cast<Phase> an integral "
     280             :             "value?");
     281             :     }
     282             :   }
     283             : };
     284             : 
     285             : static const std::vector<void (*)()> charm_init_node_funcs{
     286             :     &setup_error_handling, &disable_openblas_multithreading,
     287             :     &domain::creators::register_derived_with_charm,
     288             :     &domain::creators::time_dependence::register_derived_with_charm,
     289             :     &domain::FunctionsOfTime::register_derived_with_charm,
     290             :     &Parallel::register_derived_classes_with_charm<
     291             :         Event<metavariables::events>>,
     292             :     &Parallel::register_derived_classes_with_charm<
     293             :         StepChooser<metavariables::slab_choosers>>,
     294             :     &Parallel::register_derived_classes_with_charm<
     295             :         StepChooser<metavariables::step_choosers>>,
     296             :     &Parallel::register_derived_classes_with_charm<StepController>,
     297             :     &Parallel::register_derived_classes_with_charm<TimeSequence<double>>,
     298             :     &Parallel::register_derived_classes_with_charm<TimeSequence<std::uint64_t>>,
     299             :     &Parallel::register_derived_classes_with_charm<TimeStepper>,
     300             :     &Parallel::register_derived_classes_with_charm<
     301             :         Trigger<metavariables::triggers>>};
     302             : static const std::vector<void (*)()> charm_init_proc_funcs{
     303             :     &enable_floating_point_exceptions};

Generated by: LCOV version 1.14