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

Generated by: LCOV version 1.14