Skip to content

Commit ee283df

Browse files
authored
Merge pull request #6611 from knelli2/intrp_specific_blocks
Only interpolate for horizon finds from certain blocks
2 parents 4a2a005 + 3d620a2 commit ee283df

File tree

44 files changed

+697
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+697
-200
lines changed

src/Domain/Creators/Disk.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ Disk::Disk(typename InnerRadius::type inner_radius,
6060
if (boundary_condition_ != nullptr and is_periodic(boundary_condition_)) {
6161
PARSE_ERROR(context, "Cannot have periodic boundary conditions on a disk.");
6262
}
63+
64+
block_groups_["Shell0"];
65+
block_names_.reserve(5);
66+
const std::array<std::string, 4> wedge_directions{"UpperX", "UpperY",
67+
"LowerX", "LowerY"};
68+
for (const std::string& name : wedge_directions) {
69+
block_names_.emplace_back(name);
70+
block_groups_["Shell0"].insert(name);
71+
}
72+
block_names_.emplace_back("CenterSquare");
73+
block_groups_["CenterSquare"].insert("CenterSquare");
6374
}
6475

6576
Domain<2> Disk::create_domain() const {
@@ -131,7 +142,8 @@ Domain<2> Disk::create_domain() const {
131142
boundary_conditions_all_blocks.emplace_back();
132143
}
133144

134-
return Domain<2>{std::move(coord_maps), corners};
145+
return Domain<2>{std::move(coord_maps), corners, {}, {},
146+
block_names_, block_groups_};
135147
}
136148

137149
std::vector<DirectionMap<

src/Domain/Creators/Disk.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#include <array>
77
#include <cstddef>
88
#include <memory>
9+
#include <string>
10+
#include <unordered_map>
11+
#include <unordered_set>
912
#include <vector>
1013

1114
#include "Domain/BoundaryConditions/BoundaryCondition.hpp"
@@ -138,6 +141,13 @@ class Disk : public DomainCreator<2> {
138141

139142
std::vector<std::array<size_t, 2>> initial_refinement_levels() const override;
140143

144+
std::vector<std::string> block_names() const override { return block_names_; }
145+
146+
std::unordered_map<std::string, std::unordered_set<std::string>>
147+
block_groups() const override {
148+
return block_groups_;
149+
}
150+
141151
private:
142152
typename InnerRadius::type inner_radius_{};
143153
typename OuterRadius::type outer_radius_{};
@@ -146,6 +156,9 @@ class Disk : public DomainCreator<2> {
146156
typename UseEquiangularMap::type use_equiangular_map_{false};
147157
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
148158
boundary_condition_;
159+
std::vector<std::string> block_names_;
160+
std::unordered_map<std::string, std::unordered_set<std::string>>
161+
block_groups_;
149162
};
150163
} // namespace creators
151164
} // namespace domain

src/Domain/Creators/Rectilinear.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ Domain<Dim> Rectilinear<Dim>::create_domain() const {
180180
{std::move(block_corners)},
181181
std::move(identifications),
182182
{},
183-
block_names_};
183+
block_names(),
184+
block_groups()};
184185

185186
if (not time_dependence_->is_none()) {
186187
domain.inject_time_dependent_map_for_block(

src/Domain/Creators/Rectilinear.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <cstddef>
88
#include <memory>
99
#include <string>
10+
#include <unordered_map>
1011
#include <vector>
1112

1213
#include "Domain/BoundaryConditions/BoundaryCondition.hpp"
@@ -247,6 +248,11 @@ class Rectilinear : public DomainCreator<Dim> {
247248

248249
std::vector<std::string> block_names() const override { return block_names_; }
249250

251+
std::unordered_map<std::string, std::unordered_set<std::string>>
252+
block_groups() const override {
253+
return {{name(), {name()}}};
254+
}
255+
250256
// Transforms from option-created boundary conditions to the type used in the
251257
// constructor
252258
template <typename BoundaryConditionsBase>

src/Evolution/Executables/GrMhd/GhValenciaDivClean/EvolveGhValenciaDivClean.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ template <bool UseControlSystems, typename... InterpolationTargetTags>
2424
struct EvolutionMetavars
2525
: public GhValenciaDivCleanTemplateBase<
2626
EvolutionMetavars<UseControlSystems, InterpolationTargetTags...>,
27-
true, UseControlSystems> {
27+
true, UseControlSystems, false> {
2828
using base = GhValenciaDivCleanTemplateBase<
2929
EvolutionMetavars<UseControlSystems, InterpolationTargetTags...>, true,
30-
UseControlSystems>;
30+
UseControlSystems, false>;
3131
using const_global_cache_tags = typename base::const_global_cache_tags;
3232
using observed_reduction_data_tags =
3333
typename base::observed_reduction_data_tags;

src/Evolution/Executables/GrMhd/GhValenciaDivClean/EvolveGhValenciaDivCleanWithHorizon.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ template <bool UseControlSystems, typename... InterpolationTargetTags>
4343
struct EvolutionMetavars
4444
: public GhValenciaDivCleanTemplateBase<
4545
EvolutionMetavars<UseControlSystems, InterpolationTargetTags...>,
46-
false, false> {
46+
false, false, true> {
4747
static_assert(not UseControlSystems,
4848
"GhValenciaWithHorizon doesn't support control systems yet.");
4949
static constexpr bool use_dg_subcell = false;
5050

5151
using defaults = GhValenciaDivCleanDefaults<use_dg_subcell>;
5252
using base = GhValenciaDivCleanTemplateBase<EvolutionMetavars, use_dg_subcell,
53-
UseControlSystems>;
53+
UseControlSystems, true>;
5454
static constexpr size_t volume_dim = defaults::volume_dim;
5555
using domain_frame = typename defaults::domain_frame;
5656
static constexpr bool use_damped_harmonic_rollon =

src/Evolution/Executables/GrMhd/GhValenciaDivClean/GhValenciaDivCleanBase.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ struct GhValenciaDivCleanDefaults {
337337
};
338338

339339
template <typename EvolutionMetavarsDerived, bool UseDgSubcell,
340-
bool UseControlSystems>
340+
bool UseControlSystems, bool WithHorizon>
341341
struct GhValenciaDivCleanTemplateBase;
342342

343-
template <bool UseDgSubcell, bool UseControlSystems,
343+
template <bool UseDgSubcell, bool UseControlSystems, bool WithHorizon,
344344
template <bool, typename...> class EvolutionMetavarsDerived,
345345
typename... InterpolationTargetTags>
346346
struct GhValenciaDivCleanTemplateBase<
347347
EvolutionMetavarsDerived<UseControlSystems, InterpolationTargetTags...>,
348-
UseDgSubcell, UseControlSystems>
348+
UseDgSubcell, UseControlSystems, WithHorizon>
349349
: public virtual GhValenciaDivCleanDefaults<UseDgSubcell> {
350350
using derived_metavars =
351351
EvolutionMetavarsDerived<UseControlSystems, InterpolationTargetTags...>;
@@ -690,9 +690,11 @@ struct GhValenciaDivCleanTemplateBase<
690690
gh::ConstraintDamping::Tags::DampingFunctionGamma2<volume_dim,
691691
Frame::Grid>>>;
692692

693-
using dg_registration_list =
694-
tmpl::list<intrp::Actions::RegisterElementWithInterpolator,
695-
observers::Actions::RegisterEventsWithObservers>;
693+
using dg_registration_list = tmpl::flatten<tmpl::list<
694+
tmpl::conditional_t<WithHorizon,
695+
intrp::Actions::RegisterElementWithInterpolator,
696+
tmpl::list<>>,
697+
observers::Actions::RegisterEventsWithObservers>>;
696698

697699
static constexpr auto default_phase_order = std::array<Parallel::Phase, 8>{
698700
{Parallel::Phase::Initialization,
@@ -928,7 +930,8 @@ struct GhValenciaDivCleanTemplateBase<
928930
observers::ObserverWriter<derived_metavars>,
929931
importers::ElementDataReader<derived_metavars>,
930932
control_system::control_components<derived_metavars, control_systems>,
931-
intrp::Interpolator<derived_metavars>,
933+
tmpl::conditional_t<WithHorizon, intrp::Interpolator<derived_metavars>,
934+
tmpl::list<>>,
932935
intrp::InterpolationTarget<derived_metavars, InterpolationTargetTags>...,
933936
dg_element_array_component>>;
934937
};

src/Evolution/Executables/GrMhd/ValenciaDivClean/EvolveValenciaDivClean.hpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,12 @@
118118
#include "ParallelAlgorithms/EventsAndTriggers/EventsAndTriggers.hpp"
119119
#include "ParallelAlgorithms/EventsAndTriggers/LogicalTriggers.hpp"
120120
#include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp"
121-
#include "ParallelAlgorithms/Interpolation/Actions/CleanUpInterpolator.hpp"
122121
#include "ParallelAlgorithms/Interpolation/Actions/ElementInitInterpPoints.hpp"
123122
#include "ParallelAlgorithms/Interpolation/Actions/InitializeInterpolationTarget.hpp"
124-
#include "ParallelAlgorithms/Interpolation/Actions/InterpolationTargetReceiveVars.hpp"
125-
#include "ParallelAlgorithms/Interpolation/Actions/InterpolatorReceivePoints.hpp"
126-
#include "ParallelAlgorithms/Interpolation/Actions/InterpolatorReceiveVolumeData.hpp"
127-
#include "ParallelAlgorithms/Interpolation/Actions/InterpolatorRegisterElement.hpp"
128-
#include "ParallelAlgorithms/Interpolation/Actions/TryToInterpolate.hpp"
129123
#include "ParallelAlgorithms/Interpolation/Callbacks/ObserveTimeSeriesOnSurface.hpp"
130124
#include "ParallelAlgorithms/Interpolation/Events/Interpolate.hpp"
131125
#include "ParallelAlgorithms/Interpolation/Events/InterpolateWithoutInterpComponent.hpp"
132126
#include "ParallelAlgorithms/Interpolation/InterpolationTarget.hpp"
133-
#include "ParallelAlgorithms/Interpolation/Interpolator.hpp"
134127
#include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp"
135128
#include "ParallelAlgorithms/Interpolation/Tags.hpp"
136129
#include "ParallelAlgorithms/Interpolation/Targets/KerrHorizon.hpp"
@@ -515,8 +508,7 @@ struct EvolutionMetavars<tmpl::list<InterpolationTargetTags...>,
515508
dg_step_actions>;
516509

517510
using dg_registration_list =
518-
tmpl::list<intrp::Actions::RegisterElementWithInterpolator,
519-
observers::Actions::RegisterEventsWithObservers>;
511+
tmpl::list<observers::Actions::RegisterEventsWithObservers>;
520512

521513
using initialization_actions = tmpl::flatten<tmpl::list<
522514
Initialization::Actions::InitializeItems<
@@ -613,7 +605,6 @@ struct EvolutionMetavars<tmpl::list<InterpolationTargetTags...>,
613605
using component_list = tmpl::list<
614606
observers::Observer<EvolutionMetavars>,
615607
observers::ObserverWriter<EvolutionMetavars>,
616-
intrp::Interpolator<EvolutionMetavars>,
617608
intrp::InterpolationTarget<EvolutionMetavars, InterpolationTargetTags>...,
618609
dg_element_array_component>;
619610

src/ParallelAlgorithms/ApparentHorizonFinder/InterpolationTarget.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
#include <algorithm>
77
#include <cstddef>
8+
#include <unordered_set>
89

910
#include "IO/Logging/Verbosity.hpp"
11+
#include "Options/Context.hpp"
1012
#include "Utilities/GenerateInstantiations.hpp"
1113

1214
namespace Frame {
@@ -17,11 +19,13 @@ namespace intrp::OptionHolders {
1719
template <typename Frame>
1820
ApparentHorizon<Frame>::ApparentHorizon(
1921
ylm::Strahlkorper<Frame> initial_guess_in, ::FastFlow fast_flow_in,
20-
::Verbosity verbosity_in, const size_t max_interpolation_retries_in)
22+
::Verbosity verbosity_in, const size_t max_interpolation_retries_in,
23+
std::optional<std::vector<std::string>> blocks_for_interpolation_in)
2124
: initial_guess(std::move(initial_guess_in)),
2225
fast_flow(std::move(fast_flow_in)), // NOLINT
2326
verbosity(std::move(verbosity_in)), // NOLINT
24-
max_interpolation_retries(max_interpolation_retries_in) {}
27+
max_interpolation_retries(max_interpolation_retries_in),
28+
blocks_for_interpolation(std::move(blocks_for_interpolation_in)) {}
2529
// clang-tidy std::move of trivially copyable type.
2630

2731
template <typename Frame>
@@ -30,14 +34,16 @@ void ApparentHorizon<Frame>::pup(PUP::er& p) {
3034
p | fast_flow;
3135
p | verbosity;
3236
p | max_interpolation_retries;
37+
p | blocks_for_interpolation;
3338
}
3439

3540
template <typename Frame>
3641
bool operator==(const ApparentHorizon<Frame>& lhs,
3742
const ApparentHorizon<Frame>& rhs) {
3843
return lhs.initial_guess == rhs.initial_guess and
3944
lhs.fast_flow == rhs.fast_flow and lhs.verbosity == rhs.verbosity and
40-
lhs.max_interpolation_retries == rhs.max_interpolation_retries;
45+
lhs.max_interpolation_retries == rhs.max_interpolation_retries and
46+
lhs.blocks_for_interpolation == rhs.blocks_for_interpolation;
4147
}
4248

4349
template <typename Frame>

0 commit comments

Comments
 (0)