SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Executables/ForceFree - EvolveForceFree.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 0 22 0.0 %
Date: 2025-12-05 05:03:31
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/Factory.hpp"
      65             : #include "ParallelAlgorithms/Events/Tags.hpp"
      66             : #include "ParallelAlgorithms/EventsAndDenseTriggers/DenseTrigger.hpp"
      67             : #include "ParallelAlgorithms/EventsAndDenseTriggers/DenseTriggers/Factory.hpp"
      68             : #include "ParallelAlgorithms/EventsAndTriggers/Completion.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             :       tmpl::conditional_t<
     195             :           local_time_stepping,
     196             :           tmpl::list<Actions::MutateApply<RecordTimeStepperData<system>>,
     197             :                      evolution::Actions::RunEventsAndDenseTriggers<
     198             :                          tmpl::list<evolution::dg::ApplyBoundaryCorrections<
     199             :                              local_time_stepping, system, volume_dim, true>>>,
     200             :                      Actions::MutateApply<UpdateU<system, local_time_stepping>>,
     201             :                      evolution::dg::Actions::ApplyLtsBoundaryCorrections<
     202             :                          volume_dim, false, use_dg_element_collection>,
     203             :                      Actions::MutateApply<ChangeTimeStepperOrder<system>>>,
     204             :           tmpl::list<
     205             :               evolution::dg::Actions::ApplyBoundaryCorrectionsToTimeDerivative<
     206             :                   volume_dim, false, use_dg_element_collection>,
     207             :               Actions::MutateApply<RecordTimeStepperData<system>>,
     208             :               evolution::Actions::RunEventsAndDenseTriggers<tmpl::list<>>,
     209             :               Actions::MutateApply<UpdateU<system, local_time_stepping>>>>,
     210             :       Actions::MutateApply<CleanHistory<system>>,
     211             :       tmpl::conditional_t<
     212             :           local_time_stepping,
     213             :           Actions::MutateApply<evolution::dg::CleanMortarHistory<system>>,
     214             :           tmpl::list<>>,
     215             :       Limiters::Actions::SendData<EvolutionMetavars>,
     216             :       Limiters::Actions::Limit<EvolutionMetavars>,
     217             : 
     218             :       dg::Actions::Filter<
     219             :           Filters::Exponential<0>,
     220             :           tmpl::list<ForceFree::Tags::TildeE, ForceFree::Tags::TildeB,
     221             :                      ForceFree::Tags::TildePsi, ForceFree::Tags::TildePhi,
     222             :                      ForceFree::Tags::TildeQ>>
     223             : 
     224             :       >>;
     225             : 
     226           0 :   using const_global_cache_tags =
     227             :       tmpl::list<evolution::initial_data::Tags::InitialData,
     228             :                  ForceFree::Tags::KappaPsi, ForceFree::Tags::KappaPhi,
     229             :                  ForceFree::Tags::ParallelConductivity>;
     230             : 
     231           0 :   using dg_registration_list =
     232             :       tmpl::list<observers::Actions::RegisterEventsWithObservers>;
     233             : 
     234           0 :   using initialization_actions = tmpl::list<
     235             :       Initialization::Actions::InitializeItems<
     236             :           Initialization::TimeStepping<EvolutionMetavars, TimeStepperBase>,
     237             :           evolution::dg::Initialization::Domain<EvolutionMetavars>,
     238             :           Initialization::TimeStepperHistory<EvolutionMetavars>>,
     239             :       Initialization::Actions::AddSimpleTags<
     240             :           evolution::dg::BackgroundGrVars<system, EvolutionMetavars>>,
     241             :       Initialization::Actions::ConservativeSystem<system>,
     242             :       evolution::Initialization::Actions::SetVariables<
     243             :           domain::Tags::Coordinates<3, Frame::ElementLogical>>,
     244             : 
     245             :       Initialization::Actions::AddSimpleTags<
     246             :           ForceFree::MaskNeutronStarInterior<EvolutionMetavars, false>>,
     247             : 
     248             :       Initialization::Actions::AddComputeTags<
     249             :           tmpl::list<ForceFree::Tags::ComputeTildeJ>>,
     250             : 
     251             :       Initialization::Actions::AddComputeTags<
     252             :           StepChoosers::step_chooser_compute_tags<EvolutionMetavars,
     253             :                                                   local_time_stepping>>,
     254             :       ::evolution::dg::Initialization::Mortars<volume_dim, system>,
     255             :       Initialization::Actions::Minmod<3>,
     256             :       evolution::Actions::InitializeRunEventsAndDenseTriggers,
     257             :       Parallel::Actions::TerminatePhase>;
     258             : 
     259           0 :   using dg_element_array_component = DgElementArray<
     260             :       EvolutionMetavars,
     261             :       tmpl::list<
     262             :           Parallel::PhaseActions<Parallel::Phase::Initialization,
     263             :                                  initialization_actions>,
     264             : 
     265             :           Parallel::PhaseActions<Parallel::Phase::Register,
     266             :                                  tmpl::list<dg_registration_list,
     267             :                                             Parallel::Actions::TerminatePhase>>,
     268             : 
     269             :           Parallel::PhaseActions<Parallel::Phase::Restart,
     270             :                                  tmpl::list<dg_registration_list,
     271             :                                             Parallel::Actions::TerminatePhase>>,
     272             : 
     273             :           Parallel::PhaseActions<
     274             :               Parallel::Phase::WriteCheckpoint,
     275             :               tmpl::list<evolution::Actions::RunEventsAndTriggers<
     276             :                              Triggers::WhenToCheck::AtCheckpoints>,
     277             :                          Parallel::Actions::TerminatePhase>>,
     278             : 
     279             :           Parallel::PhaseActions<
     280             :               Parallel::Phase::InitializeTimeStepperHistory,
     281             :               SelfStart::self_start_procedure<dg_step_actions, system>>,
     282             : 
     283             :           Parallel::PhaseActions<
     284             :               Parallel::Phase::Evolve,
     285             :               tmpl::flatten<tmpl::list<
     286             :                   std::conditional_t<local_time_stepping,
     287             :                                      evolution::Actions::RunEventsAndTriggers<
     288             :                                          Triggers::WhenToCheck::AtSteps>,
     289             :                                      tmpl::list<>>,
     290             :                   evolution::Actions::RunEventsAndTriggers<
     291             :                       Triggers::WhenToCheck::AtSlabs>,
     292             :                   Actions::ChangeSlabSize, dg_step_actions,
     293             :                   Actions::MutateApply<AdvanceTime>,
     294             :                   PhaseControl::Actions::ExecutePhaseChange>>>>>;
     295             : 
     296             :   struct registration
     297             :       : tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> {
     298           0 :     using element_registrars =
     299             :         tmpl::map<tmpl::pair<dg_element_array_component, dg_registration_list>>;
     300             :   };
     301             : 
     302           0 :   using component_list =
     303             :       tmpl::list<observers::Observer<EvolutionMetavars>,
     304             :                  observers::ObserverWriter<EvolutionMetavars>,
     305             :                  dg_element_array_component>;
     306             : 
     307             :   static constexpr Options::String help{
     308             :       "Evolve the GRFFE system with divergence cleaning.\n"};
     309             : 
     310             :   static constexpr std::array<Parallel::Phase, 5> default_phase_order{
     311             :       {Parallel::Phase::Initialization,
     312             :        Parallel::Phase::InitializeTimeStepperHistory, Parallel::Phase::Register,
     313             :        Parallel::Phase::Evolve, Parallel::Phase::Exit}};
     314             : 
     315             :   // NOLINTNEXTLINE(google-runtime-references)
     316           0 :   void pup(PUP::er& /*p*/) {}
     317             : };

Generated by: LCOV version 1.14