EvolveGhValenciaDivCleanWithHorizon.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <vector>
7 
8 #include "ApparentHorizons/ComputeItems.hpp"
9 #include "ApparentHorizons/Tags.hpp"
10 #include "Domain/Creators/RegisterDerivedWithCharm.hpp"
11 #include "Domain/Creators/TimeDependence/RegisterDerivedWithCharm.hpp"
12 #include "Domain/FunctionsOfTime/RegisterDerivedWithCharm.hpp"
13 #include "Evolution/DiscontinuousGalerkin/Limiters/Tags.hpp"
14 #include "Evolution/Executables/GrMhd/GhValenciaDivClean/GhValenciaDivCleanBase.hpp"
15 #include "Evolution/Systems/GeneralizedHarmonic/BoundaryConditions/RegisterDerivedWithCharm.hpp"
16 #include "Evolution/Systems/GeneralizedHarmonic/BoundaryCorrections/RegisterDerived.hpp"
17 #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/RegisterDerivedWithCharm.hpp"
18 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
19 #include "Evolution/Systems/GrMhd/GhValenciaDivClean/BoundaryConditions/RegisterDerived.hpp"
20 #include "Evolution/Systems/GrMhd/GhValenciaDivClean/BoundaryCorrections/RegisterDerived.hpp"
21 #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
22 #include "Evolution/VariableFixing/Tags.hpp"
23 #include "NumericalAlgorithms/Interpolation/AddTemporalIdsToInterpolationTarget.hpp"
24 #include "NumericalAlgorithms/Interpolation/Callbacks/ErrorOnFailedApparentHorizon.hpp"
25 #include "NumericalAlgorithms/Interpolation/Callbacks/FindApparentHorizon.hpp"
26 #include "NumericalAlgorithms/Interpolation/Callbacks/ObserveTimeSeriesOnSurface.hpp"
27 #include "NumericalAlgorithms/Interpolation/CleanUpInterpolator.hpp"
28 #include "NumericalAlgorithms/Interpolation/InitializeInterpolationTarget.hpp"
29 #include "NumericalAlgorithms/Interpolation/Interpolate.hpp"
30 #include "NumericalAlgorithms/Interpolation/InterpolationTarget.hpp"
31 #include "NumericalAlgorithms/Interpolation/InterpolationTargetApparentHorizon.hpp"
32 #include "NumericalAlgorithms/Interpolation/InterpolationTargetReceiveVars.hpp"
33 #include "NumericalAlgorithms/Interpolation/Interpolator.hpp"
34 #include "NumericalAlgorithms/Interpolation/InterpolatorReceivePoints.hpp"
35 #include "NumericalAlgorithms/Interpolation/InterpolatorReceiveVolumeData.hpp"
36 #include "NumericalAlgorithms/Interpolation/InterpolatorRegisterElement.hpp"
37 #include "NumericalAlgorithms/Interpolation/Tags.hpp"
38 #include "NumericalAlgorithms/Interpolation/TryToInterpolate.hpp"
39 #include "Options/FactoryHelpers.hpp"
40 #include "Options/Options.hpp"
41 #include "Options/Protocols/FactoryCreation.hpp"
42 #include "Parallel/PhaseControl/PhaseControlTags.hpp"
45 #include "Time/StepControllers/Factory.hpp"
46 #include "Utilities/Blas.hpp"
49 #include "Utilities/TMPL.hpp"
50 
51 template <typename InitialData, typename... InterpolationTargetTags>
52 struct EvolutionMetavars
53  : public virtual GhValenciaDivCleanDefaults,
55  EvolutionMetavars<InitialData, InterpolationTargetTags...>> {
56  static constexpr Options::String help{
57  "Evolve the Valencia formulation of the GRMHD system with divergence "
58  "cleaning, coupled to a dynamic spacetime evolved with the Generalized "
59  "Harmonic formulation\n"
60  "on a domain with a single horizon and corresponding excised region"};
61 
62  struct AhA {
63  using tags_to_observe =
64  tmpl::list<StrahlkorperGr::Tags::AreaCompute<domain_frame>>;
65  using compute_items_on_source = tmpl::list<
70  domain_frame>>;
71  using vars_to_interpolate_to_target = tmpl::list<
76  using compute_items_on_target = tmpl::append<
77  tmpl::list<StrahlkorperGr::Tags::AreaElementCompute<domain_frame>>,
78  tags_to_observe>;
79  using compute_target_points =
81  using post_interpolation_callback =
83  using horizon_find_failure_callback =
85  using post_horizon_find_callback =
87  };
88 
89  using interpolation_target_tags = tmpl::list<AhA>;
90  using interpolator_source_vars =
91  tmpl::list<gr::Tags::SpacetimeMetric<volume_dim, domain_frame>,
94 
95  using observe_fields = typename GhValenciaDivCleanTemplateBase<
96  EvolutionMetavars>::observe_fields;
97 
98  struct factory_creation
99  : tt::ConformsTo<Options::protocols::FactoryCreation> {
100  using factory_classes = Options::add_factory_classes<
102  EvolutionMetavars>::factory_creation::factory_classes,
103  tmpl::pair<Event, tmpl::list<intrp::Events::Interpolate<
104  3, AhA, interpolator_source_vars>>>>;
105  };
106 
107  using phase_changes =
109 
110  using initial_data =
112  using initial_data_tag = typename GhValenciaDivCleanTemplateBase<
113  EvolutionMetavars>::initial_data_tag;
114 
115  using const_global_cache_tags = tmpl::flatten<tmpl::list<
116  tmpl::conditional_t<evolution::is_numeric_initial_data_v<initial_data>,
117  tmpl::list<>, initial_data_tag>,
121  volume_dim, domain_frame>,
123  volume_dim, domain_frame>,
125  volume_dim, domain_frame>,
127 
128  using observed_reduction_data_tags =
129  observers::collect_reduction_data_tags<tmpl::push_back<
130  tmpl::at<typename factory_creation::factory_classes, Event>,
131  typename AhA::post_horizon_find_callback,
132  typename InterpolationTargetTags::post_interpolation_callback...>>;
133 
134  using dg_registration_list = typename GhValenciaDivCleanTemplateBase<
135  EvolutionMetavars>::dg_registration_list;
136 
137  template <typename ParallelComponent>
138  struct registration_list {
139  using type = std::conditional_t<
140  std::is_same_v<ParallelComponent,
142  EvolutionMetavars>::dg_element_array_component>,
143  dg_registration_list, tmpl::list<>>;
144  };
145 
146  using component_list =
148  EvolutionMetavars>::component_list,
150 };
151 
152 static const std::vector<void (*)()> charm_init_node_funcs{
153  &setup_error_handling,
155  &domain::creators::register_derived_with_charm,
156  &domain::creators::time_dependence::register_derived_with_charm,
157  &domain::FunctionsOfTime::register_derived_with_charm,
158  &grmhd::GhValenciaDivClean::BoundaryConditions::register_derived_with_charm,
159  &grmhd::GhValenciaDivClean::BoundaryCorrections::
160  register_derived_with_charm,
161  &GeneralizedHarmonic::ConstraintDamping::register_derived_with_charm,
162  &Parallel::register_derived_classes_with_charm<TimeStepper>,
165  &Parallel::register_factory_classes_with_charm<metavariables>};
166 
167 static const std::vector<void (*)()> charm_init_proc_funcs{
FloatingPointExceptions.hpp
intrp::callbacks::ErrorOnFailedApparentHorizon
Callback for a failed apparent horizon find that simply errors.
Definition: ErrorOnFailedApparentHorizon.hpp:24
RegisterDerivedClassesWithCharm.hpp
gr::Tags::SpatialChristoffelSecondKind
Definition: Tags.hpp:79
GeneralizedHarmonic::ConstraintDamping::Tags::DampingFunctionGamma2
A DampingFunction to compute the constraint damping parameter .
Definition: Tags.hpp:117
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
Tags.hpp
Options.hpp
vector
Error.hpp
ah::Tags::SpatialChristoffelSecondKindCompute
Definition: ComputeItems.hpp:76
PhaseControl::Tags::PhaseChangeAndTriggers
Tag for the collection of triggers that indicate synchronization points at which phase changes should...
Definition: PhaseControlTags.hpp:66
disable_openblas_multithreading
void disable_openblas_multithreading() noexcept
Disable OpenBLAS multithreading since it conflicts with Charm++ parallelism.
EvolutionMetavars
Definition: EvolveBurgers.hpp:103
domain::push_back
CoordinateMap< SourceFrame, TargetFrame, Maps..., NewMap > push_back(CoordinateMap< SourceFrame, TargetFrame, Maps... > old_map, NewMap new_map) noexcept
Creates a CoordinateMap by appending the new map to the end of the old maps.
enable_floating_point_exceptions
void enable_floating_point_exceptions()
ah::Tags::ExtrinsicCurvatureCompute
Definition: ComputeItems.hpp:54
Event
Definition: Event.hpp:19
intrp::TargetPoints::ApparentHorizon
Computes points on a trial apparent horizon`.
Definition: InterpolationTargetApparentHorizon.hpp:141
GeneralizedHarmonic::Tags::Pi
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:29
gr::Tags::SpatialMetricCompute
Compute item for spatial metric from the spacetime metric .
Definition: SpatialMetric.hpp:50
grmhd::ValenciaDivClean::Tags::ConstraintDampingParameter
The constraint damping parameter for divergence cleaning.
Definition: Tags.hpp:88
ah::Tags::InverseSpatialMetricCompute
These ComputeItems are different from those used in GeneralizedHarmonic evolution because these live ...
Definition: ComputeItems.hpp:41
GhValenciaDivCleanDefaults
Definition: GhValenciaDivCleanBase.hpp:188
GeneralizedHarmonic::ConstraintDamping::Tags::DampingFunctionGamma0
A DampingFunction to compute the constraint damping parameter .
Definition: Tags.hpp:79
intrp::callbacks::ObserveTimeSeriesOnSurface
post_interpolation_callback that outputs a time series on a surface.
Definition: ObserveTimeSeriesOnSurface.hpp:91
GeneralizedHarmonic::Tags::Phi
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:40
Tags::EventsAndTriggers
Definition: Tags.hpp:51
PhaseChange
PhaseChange objects determine the storage types and logic for moving between phases based on runtime ...
Definition: PhaseChange.hpp:141
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
GeneralizedHarmonic::ConstraintDamping::Tags::DampingFunctionGamma1
A DampingFunction to compute the constraint damping parameter .
Definition: Tags.hpp:98
gr::Tags::ExtrinsicCurvature
Definition: Tags.hpp:116
GhValenciaDivCleanTemplateBase
Definition: GhValenciaDivCleanBase.hpp:251
std::conditional_t
Parallel::register_derived_classes_with_charm
void register_derived_classes_with_charm() noexcept
Register derived classes of the Base class.
Definition: RegisterDerivedClassesWithCharm.hpp:35
Blas.hpp
Options::add_factory_classes
typename detail::add_factory_classes< FactoryClasses, NewClasses... >::type add_factory_classes
Add new factory-creatable classes to the list in a factory_creation struct.
Definition: FactoryHelpers.hpp:51
intrp::callbacks::FindApparentHorizon
post interpolation callback (see InterpolationTarget) that does a FastFlow iteration and triggers ano...
Definition: FindApparentHorizon.hpp:125
tt::ConformsTo
Indicate a class conforms to the Protocol.
Definition: ProtocolHelpers.hpp:22
intrp::Events::Interpolate
Does an interpolation onto InterpolationTargetTag by calling Actions on the Interpolator and Interpol...
Definition: Interpolate.hpp:53
TMPL.hpp
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
intrp::InterpolationTarget
ParallelComponent representing a set of points to be interpolated to and a function to call upon inte...
Definition: InterpolationTarget.hpp:347