SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Executables/ForceFree - EvolveForceFree.hpp Hit Total Coverage
Commit: 1e29a35ad8559408f21493dc5db8a49a237bb2f0 Lines: 0 22 0.0 %
Date: 2026-03-31 22:27:51
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 <array>
       7             : #include <cstddef>
       8             : #include <type_traits>
       9             : #include <vector>
      10             : 
      11             : #include "DataStructures/DataBox/PrefixHelpers.hpp"
      12             : #include "DataStructures/Tensor/TypeAliases.hpp"
      13             : #include "Domain/Creators/DomainCreator.hpp"
      14             : #include "Domain/Creators/Factory3D.hpp"
      15             : #include "Domain/Tags.hpp"
      16             : #include "Evolution/Actions/RunEventsAndDenseTriggers.hpp"
      17             : #include "Evolution/Actions/RunEventsAndTriggers.hpp"
      18             : #include "Evolution/BoundaryCorrection.hpp"
      19             : #include "Evolution/ComputeTags.hpp"
      20             : #include "Evolution/DiscontinuousGalerkin/Actions/ApplyBoundaryCorrections.hpp"
      21             : #include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivative.hpp"
      22             : #include "Evolution/DiscontinuousGalerkin/BackgroundGrVars.hpp"
      23             : #include "Evolution/DiscontinuousGalerkin/CleanMortarHistory.hpp"
      24             : #include "Evolution/DiscontinuousGalerkin/DgElementArray.hpp"
      25             : #include "Evolution/DiscontinuousGalerkin/Initialization/Mortars.hpp"
      26             : #include "Evolution/DiscontinuousGalerkin/Limiters/Minmod.hpp"
      27             : #include "Evolution/DiscontinuousGalerkin/Limiters/Tags.hpp"
      28             : #include "Evolution/Initialization/ConservativeSystem.hpp"
      29             : #include "Evolution/Initialization/DgDomain.hpp"
      30             : #include "Evolution/Initialization/Evolution.hpp"
      31             : #include "Evolution/Initialization/Limiter.hpp"
      32             : #include "Evolution/Initialization/SetVariables.hpp"
      33             : #include "Evolution/Systems/ForceFree/BoundaryConditions/BoundaryCondition.hpp"
      34             : #include "Evolution/Systems/ForceFree/BoundaryConditions/Factory.hpp"
      35             : #include "Evolution/Systems/ForceFree/BoundaryCorrections/Factory.hpp"
      36             : #include "Evolution/Systems/ForceFree/ElectricCurrentDensity.hpp"
      37             : #include "Evolution/Systems/ForceFree/ElectromagneticVariables.hpp"
      38             : #include "Evolution/Systems/ForceFree/MaskNeutronStarInterior.hpp"
      39             : #include "Evolution/Systems/ForceFree/System.hpp"
      40             : #include "Evolution/Systems/ForceFree/Tags.hpp"
      41             : #include "Evolution/Tags/Filter.hpp"
      42             : #include "IO/Observer/Actions/RegisterEvents.hpp"
      43             : #include "IO/Observer/Actions/RegisterWithObservers.hpp"
      44             : #include "IO/Observer/Helpers.hpp"
      45             : #include "IO/Observer/ObserverComponent.hpp"
      46             : #include "NumericalAlgorithms/LinearOperators/ExponentialFilter.hpp"
      47             : #include "Options/Options.hpp"
      48             : #include "Options/Protocols/FactoryCreation.hpp"
      49             : #include "Parallel/Local.hpp"
      50             : #include "Parallel/Phase.hpp"
      51             : #include "Parallel/PhaseControl/CheckpointAndExitAfterWallclock.hpp"
      52             : #include "Parallel/PhaseControl/ExecutePhaseChange.hpp"
      53             : #include "Parallel/PhaseControl/PhaseChange.hpp"
      54             : #include "Parallel/PhaseControl/VisitAndReturn.hpp"
      55             : #include "Parallel/PhaseDependentActionList.hpp"
      56             : #include "Parallel/Protocols/RegistrationMetavariables.hpp"
      57             : #include "ParallelAlgorithms/Actions/AddComputeTags.hpp"
      58             : #include "ParallelAlgorithms/Actions/AddSimpleTags.hpp"
      59             : #include "ParallelAlgorithms/Actions/FilterAction.hpp"
      60             : #include "ParallelAlgorithms/Actions/InitializeItems.hpp"
      61             : #include "ParallelAlgorithms/Actions/LimiterActions.hpp"
      62             : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
      63             : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
      64             : #include "ParallelAlgorithms/Events/Completion.hpp"
      65             : #include "ParallelAlgorithms/Events/Factory.hpp"
      66             : #include "ParallelAlgorithms/Events/Tags.hpp"
      67             : #include "ParallelAlgorithms/EventsAndDenseTriggers/DenseTrigger.hpp"
      68             : #include "ParallelAlgorithms/EventsAndDenseTriggers/DenseTriggers/Factory.hpp"
      69             : #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
      70             : #include "ParallelAlgorithms/EventsAndTriggers/EventsAndTriggers.hpp"
      71             : #include "ParallelAlgorithms/EventsAndTriggers/LogicalTriggers.hpp"
      72             : #include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
      73             : #include "PointwiseFunctions/AnalyticData/ForceFree/AnalyticData.hpp"
      74             : #include "PointwiseFunctions/AnalyticData/ForceFree/Factory.hpp"
      75             : #include "PointwiseFunctions/AnalyticSolutions/ForceFree/Factory.hpp"
      76             : #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
      77             : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
      78             : #include "Time/Actions/SelfStartActions.hpp"
      79             : #include "Time/AdvanceTime.hpp"
      80             : #include "Time/ChangeSlabSize/Action.hpp"
      81             : #include "Time/ChangeTimeStepperOrder.hpp"
      82             : #include "Time/CleanHistory.hpp"
      83             : #include "Time/RecordTimeStepperData.hpp"
      84             : #include "Time/StepChoosers/Factory.hpp"
      85             : #include "Time/StepChoosers/StepChooser.hpp"
      86             : #include "Time/Tags/Time.hpp"
      87             : #include "Time/Tags/TimeStepId.hpp"
      88             : #include "Time/TimeSequence.hpp"
      89             : #include "Time/TimeSteppers/Factory.hpp"
      90             : #include "Time/TimeSteppers/LtsTimeStepper.hpp"
      91             : #include "Time/TimeSteppers/TimeStepper.hpp"
      92             : #include "Time/Triggers/TimeTriggers.hpp"
      93             : #include "Time/UpdateU.hpp"
      94             : #include "Utilities/ProtocolHelpers.hpp"
      95             : #include "Utilities/TMPL.hpp"
      96             : 
      97             : /// \cond
      98             : namespace PUP {
      99             : class er;
     100             : }  // namespace PUP
     101             : namespace Parallel {
     102             : template <typename Metavariables>
     103             : class CProxy_GlobalCache;
     104             : }  // namespace Parallel
     105             : /// \endcond
     106             : 
     107             : struct EvolutionMetavars {
     108             :   static constexpr size_t volume_dim = 3;
     109           0 :   using system = ForceFree::System;
     110           0 :   using temporal_id = Tags::TimeStepId;
     111           0 :   using TimeStepperBase = TimeStepper;
     112             : 
     113             :   static constexpr bool local_time_stepping =
     114             :       TimeStepperBase::local_time_stepping;
     115             :   static constexpr bool use_dg_element_collection = false;
     116             : 
     117           0 :   using initial_data_list = tmpl::append<ForceFree::Solutions::all_solutions,
     118             :                                          ForceFree::AnalyticData::all_data>;
     119             : 
     120           0 :   using limiter = Tags::Limiter<Limiters::Minmod<
     121             :       3, tmpl::list<ForceFree::Tags::TildeE, ForceFree::Tags::TildeB,
     122             :                     ForceFree::Tags::TildeQ>>>;
     123             : 
     124           0 :   using analytic_variables_tags = typename system::variables_tag::tags_list;
     125             : 
     126           0 :   using analytic_compute = evolution::Tags::AnalyticSolutionsCompute<
     127             :       volume_dim, analytic_variables_tags, false, initial_data_list>;
     128             : 
     129           0 :   using error_compute = Tags::ErrorsCompute<analytic_variables_tags>;
     130             : 
     131           0 :   using error_tags = db::wrap_tags_in<Tags::Error, analytic_variables_tags>;
     132             : 
     133           0 :   using observe_fields = tmpl::push_back<
     134             :       tmpl::append<typename system::variables_tag::tags_list, error_tags>,
     135             :       domain::Tags::Coordinates<volume_dim, Frame::Grid>,
     136             :       domain::Tags::Coordinates<volume_dim, Frame::Inertial>,
     137             :       ForceFree::Tags::ElectricFieldCompute,
     138             :       ForceFree::Tags::MagneticFieldCompute,
     139             :       ForceFree::Tags::ChargeDensityCompute,
     140             :       ForceFree::Tags::ElectricCurrentDensityCompute>;
     141             : 
     142           0 :   using non_tensor_compute_tags =
     143             :       tmpl::list<::Events::Tags::ObserverMeshCompute<volume_dim>,
     144             :                  ::Events::Tags::ObserverDetInvJacobianCompute<
     145             :                      Frame::ElementLogical, Frame::Inertial>,
     146             :                  analytic_compute, error_compute>;
     147             : 
     148             :   struct factory_creation
     149             :       : tt::ConformsTo<Options::protocols::FactoryCreation> {
     150           0 :     using factory_classes = tmpl::map<
     151             :         tmpl::pair<ForceFree::BoundaryConditions::BoundaryCondition,
     152             :                    ForceFree::BoundaryConditions::standard_boundary_conditions>,
     153             :         tmpl::pair<DenseTrigger, DenseTriggers::standard_dense_triggers>,
     154             :         tmpl::pair<DomainCreator<volume_dim>, domain_creators<volume_dim>>,
     155             :         tmpl::pair<Event,
     156             :                    tmpl::flatten<tmpl::list<
     157             :                        Events::Completion,
     158             :                        dg::Events::field_observations<
     159             :                            volume_dim, observe_fields, non_tensor_compute_tags>,
     160             :                        Events::time_events<system>>>>,
     161             :         tmpl::pair<
     162             :             evolution::BoundaryCorrection,
     163             :             ForceFree::BoundaryCorrections::standard_boundary_corrections>,
     164             :         tmpl::pair<evolution::initial_data::InitialData, initial_data_list>,
     165             :         tmpl::pair<LtsTimeStepper, TimeSteppers::lts_time_steppers>,
     166             :         tmpl::pair<PhaseChange,
     167             :                    tmpl::list<PhaseControl::VisitAndReturn<
     168             :                                   Parallel::Phase::LoadBalancing>,
     169             :                               PhaseControl::CheckpointAndExitAfterWallclock>>,
     170             :         tmpl::pair<StepChooser<StepChooserUse::LtsStep>,
     171             :                    StepChoosers::standard_step_choosers<system>>,
     172             :         tmpl::pair<
     173             :             StepChooser<StepChooserUse::Slab>,
     174             :             StepChoosers::standard_slab_choosers<system, local_time_stepping>>,
     175             :         tmpl::pair<TimeSequence<double>,
     176             :                    TimeSequences::all_time_sequences<double>>,
     177             :         tmpl::pair<TimeSequence<std::uint64_t>,
     178             :                    TimeSequences::all_time_sequences<std::uint64_t>>,
     179             :         tmpl::pair<TimeStepper, TimeSteppers::time_steppers>,
     180             :         tmpl::pair<Trigger, tmpl::append<Triggers::logical_triggers,
     181             :                                          Triggers::time_triggers>>>;
     182             :   };
     183             : 
     184           0 :   using observed_reduction_data_tags =
     185             :       observers::collect_reduction_data_tags<tmpl::flatten<tmpl::list<
     186             :           tmpl::at<typename factory_creation::factory_classes, Event>>>>;
     187             : 
     188           0 :   using dg_step_actions = tmpl::flatten<tmpl::list<
     189             :       Actions::MutateApply<
     190             :           evolution::dg::BackgroundGrVars<system, EvolutionMetavars>>,
     191             :       evolution::dg::Actions::ComputeTimeDerivative<
     192             :           volume_dim, system, AllStepChoosers, local_time_stepping,
     193             :           use_dg_element_collection>,
     194             :       evolution::dg::Actions::ApplyBoundaryCorrectionsToTimeDerivative<
     195             :           volume_dim, use_dg_element_collection>,
     196             :       Actions::MutateApply<RecordTimeStepperData<system>>,
     197             :       tmpl::conditional_t<
     198             :           local_time_stepping,
     199             :           tmpl::list<evolution::Actions::RunEventsAndDenseTriggers<
     200             :                          tmpl::list<evolution::dg::ApplyBoundaryCorrections<
     201             :                              local_time_stepping, system, volume_dim, true>>>,
     202             :                      Actions::MutateApply<UpdateU<system, local_time_stepping>>,
     203             :                      evolution::dg::Actions::ApplyLtsBoundaryCorrections<
     204             :                          volume_dim, false, use_dg_element_collection>,
     205             :                      Actions::MutateApply<ChangeTimeStepperOrder<system>>>,
     206             :           tmpl::list<
     207             :               evolution::Actions::RunEventsAndDenseTriggers<tmpl::list<>>,
     208             :               Actions::MutateApply<UpdateU<system, local_time_stepping>>>>,
     209             :       Actions::MutateApply<CleanHistory<system>>,
     210             :       tmpl::conditional_t<
     211             :           local_time_stepping,
     212             :           Actions::MutateApply<evolution::dg::CleanMortarHistory<volume_dim>>,
     213             :           tmpl::list<>>,
     214             :       Limiters::Actions::SendData<EvolutionMetavars>,
     215             :       Limiters::Actions::Limit<EvolutionMetavars>,
     216             : 
     217             :       dg::Actions::Filter<
     218             :           Filters::Exponential<0>,
     219             :           tmpl::list<ForceFree::Tags::TildeE, ForceFree::Tags::TildeB,
     220             :                      ForceFree::Tags::TildePsi, ForceFree::Tags::TildePhi,
     221             :                      ForceFree::Tags::TildeQ>>
     222             : 
     223             :       >>;
     224             : 
     225           0 :   using const_global_cache_tags =
     226             :       tmpl::list<evolution::initial_data::Tags::InitialData,
     227             :                  ForceFree::Tags::KappaPsi, ForceFree::Tags::KappaPhi,
     228             :                  ForceFree::Tags::ParallelConductivity>;
     229             : 
     230           0 :   using dg_registration_list =
     231             :       tmpl::list<observers::Actions::RegisterEventsWithObservers>;
     232             : 
     233           0 :   using initialization_actions = tmpl::list<
     234             :       Initialization::Actions::InitializeItems<
     235             :           Initialization::TimeStepping<EvolutionMetavars, TimeStepperBase>,
     236             :           evolution::dg::Initialization::Domain<EvolutionMetavars>,
     237             :           Initialization::TimeStepperHistory<EvolutionMetavars>>,
     238             :       Initialization::Actions::AddSimpleTags<
     239             :           evolution::dg::BackgroundGrVars<system, EvolutionMetavars>>,
     240             :       Initialization::Actions::ConservativeSystem<system>,
     241             :       evolution::Initialization::Actions::SetVariables<
     242             :           domain::Tags::Coordinates<3, Frame::ElementLogical>>,
     243             : 
     244             :       Initialization::Actions::AddSimpleTags<
     245             :           ForceFree::MaskNeutronStarInterior<EvolutionMetavars, false>>,
     246             : 
     247             :       Initialization::Actions::AddComputeTags<
     248             :           tmpl::list<ForceFree::Tags::ComputeTildeJ>>,
     249             : 
     250             :       Initialization::Actions::AddComputeTags<
     251             :           StepChoosers::step_chooser_compute_tags<EvolutionMetavars,
     252             :                                                   local_time_stepping>>,
     253             :       ::evolution::dg::Initialization::Mortars<volume_dim>,
     254             :       Initialization::Actions::Minmod<3>,
     255             :       evolution::Actions::InitializeRunEventsAndDenseTriggers,
     256             :       Parallel::Actions::TerminatePhase>;
     257             : 
     258           0 :   using dg_element_array_component = DgElementArray<
     259             :       EvolutionMetavars,
     260             :       tmpl::list<
     261             :           Parallel::PhaseActions<Parallel::Phase::Initialization,
     262             :                                  initialization_actions>,
     263             : 
     264             :           Parallel::PhaseActions<Parallel::Phase::Register,
     265             :                                  tmpl::list<dg_registration_list,
     266             :                                             Parallel::Actions::TerminatePhase>>,
     267             : 
     268             :           Parallel::PhaseActions<Parallel::Phase::Restart,
     269             :                                  tmpl::list<dg_registration_list,
     270             :                                             Parallel::Actions::TerminatePhase>>,
     271             : 
     272             :           Parallel::PhaseActions<
     273             :               Parallel::Phase::WriteCheckpoint,
     274             :               tmpl::list<evolution::Actions::RunEventsAndTriggers<
     275             :                              Triggers::WhenToCheck::AtCheckpoints>,
     276             :                          Parallel::Actions::TerminatePhase>>,
     277             : 
     278             :           Parallel::PhaseActions<
     279             :               Parallel::Phase::InitializeTimeStepperHistory,
     280             :               SelfStart::self_start_procedure<dg_step_actions, system>>,
     281             : 
     282             :           Parallel::PhaseActions<
     283             :               Parallel::Phase::Evolve,
     284             :               tmpl::flatten<tmpl::list<
     285             :                   std::conditional_t<local_time_stepping,
     286             :                                      evolution::Actions::RunEventsAndTriggers<
     287             :                                          Triggers::WhenToCheck::AtSteps>,
     288             :                                      tmpl::list<>>,
     289             :                   evolution::Actions::RunEventsAndTriggers<
     290             :                       Triggers::WhenToCheck::AtSlabs>,
     291             :                   Actions::ChangeSlabSize, dg_step_actions,
     292             :                   Actions::MutateApply<AdvanceTime<>>,
     293             :                   PhaseControl::Actions::ExecutePhaseChange>>>>>;
     294             : 
     295             :   struct registration
     296             :       : tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> {
     297           0 :     using element_registrars =
     298             :         tmpl::map<tmpl::pair<dg_element_array_component, dg_registration_list>>;
     299             :   };
     300             : 
     301           0 :   using component_list =
     302             :       tmpl::list<observers::Observer<EvolutionMetavars>,
     303             :                  observers::ObserverWriter<EvolutionMetavars>,
     304             :                  dg_element_array_component>;
     305             : 
     306             :   static constexpr Options::String help{
     307             :       "Evolve the GRFFE system with divergence cleaning.\n"};
     308             : 
     309             :   static constexpr std::array<Parallel::Phase, 5> default_phase_order{
     310             :       {Parallel::Phase::Initialization,
     311             :        Parallel::Phase::InitializeTimeStepperHistory, Parallel::Phase::Register,
     312             :        Parallel::Phase::Evolve, Parallel::Phase::Exit}};
     313             : 
     314             :   // NOLINTNEXTLINE(google-runtime-references)
     315           0 :   void pup(PUP::er& /*p*/) {}
     316             : };

Generated by: LCOV version 1.14