Skip to content

Commit

Permalink
Add LTS CMake Option in GenHarmBase Executables
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCarpenter46 committed Jun 4, 2024
1 parent 57fc561 commit 006e31d
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 19 deletions.
8 changes: 8 additions & 0 deletions src/Evolution/Executables/GeneralizedHarmonic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function(add_generalized_harmonic_executable_without_horizon DIM)
${EXECUTABLE}
PRIVATE
DIM=${DIM}
USE_LTS=false
)
target_link_libraries(${EXECUTABLE} PRIVATE ${LIBS_TO_LINK})
endfunction()
Expand All @@ -68,6 +69,12 @@ target_link_libraries(
ControlSystem
Deadlock
)
target_compile_definitions(
${SINGLE_BH_EXECUTABLE}
PRIVATE
USE_LTS=true
)


# BBH
set(BBH_EXECUTABLE EvolveGhBinaryBlackHole)
Expand Down Expand Up @@ -102,6 +109,7 @@ function(add_gh_and_characteristic_executable EXECUTABLE EVOLVE_CCM)
${EXECUTABLE}
PRIVATE
EVOLVE_CCM=${EVOLVE_CCM}
USE_LTS=false
)
target_link_libraries(
${EXECUTABLE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "Parallel/CharmMain.tpp"
#include "Utilities/Serialization/RegisterDerivedClassesWithCharm.hpp"

using metavariables = EvolutionMetavars<EVOLVE_CCM>;
using metavariables = EvolutionMetavars<EVOLVE_CCM, USE_LTS>;

extern "C" void CkRegisterMainModule() {
Parallel::charmxx::register_main_module<metavariables>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ class CProxy_GlobalCache;
} // namespace Parallel
/// \endcond

template <bool EvolveCcm>
struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3>,
template <bool EvolveCcm, bool UseLts>
struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3, UseLts>,
public CharacteristicExtractDefaults<EvolveCcm> {
static constexpr size_t volume_dim = 3;
using cce_base = CharacteristicExtractDefaults<EvolveCcm>;
using gh_base = GeneralizedHarmonicTemplateBase<volume_dim>;
using gh_base = GeneralizedHarmonicTemplateBase<volume_dim, UseLts>;
using typename gh_base::initialize_initial_data_dependent_quantities_actions;
using cce_boundary_component = Cce::GhWorldtubeBoundary<EvolutionMetavars>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Utilities/Serialization/RegisterDerivedClassesWithCharm.hpp"

// Parameters chosen in CMakeLists.txt
using metavariables = EvolutionMetavars<DIM>;
using metavariables = EvolutionMetavars<DIM, USE_LTS>;

extern "C" void CkRegisterMainModule() {
Parallel::charmxx::register_main_module<metavariables>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
#include "Utilities/ErrorHandling/Error.hpp"
#include "Utilities/ProtocolHelpers.hpp"

template <size_t VolumeDim>
struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<VolumeDim> {
template <size_t VolumeDim, bool UseLts>
struct EvolutionMetavars
: public GeneralizedHarmonicTemplateBase<VolumeDim, UseLts> {
static constexpr size_t volume_dim = VolumeDim;
using gh_base = GeneralizedHarmonicTemplateBase<volume_dim>;
using gh_base = GeneralizedHarmonicTemplateBase<volume_dim, UseLts>;
using typename gh_base::const_global_cache_tags;
using typename gh_base::dg_registration_list;
using initialization_actions =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@
#include "Parallel/CharmMain.tpp"
#include "Utilities/Serialization/RegisterDerivedClassesWithCharm.hpp"

// Parameters chosen in CMakeLists.txt
using metavariables = EvolutionMetavars<USE_LTS>;

extern "C" void CkRegisterMainModule() {
Parallel::charmxx::register_main_module<EvolutionMetavars>();
Parallel::charmxx::register_main_module<metavariables>();
Parallel::charmxx::register_init_node_and_proc(
{&domain::creators::register_derived_with_charm,
&domain::creators::time_dependence::register_derived_with_charm,
&domain::FunctionsOfTime::register_derived_with_charm,
&gh::BoundaryCorrections::register_derived_with_charm,
&gh::ConstraintDamping::register_derived_with_charm,
&control_system::size::register_derived_with_charm,
&register_factory_classes_with_charm<EvolutionMetavars>},
&register_factory_classes_with_charm<metavariables>},
{});
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@
#include "Utilities/PrettyType.hpp"
#include "Utilities/ProtocolHelpers.hpp"

struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3> {
template <bool UseLts>
struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3, UseLts> {
static constexpr size_t volume_dim = 3;
using gh_base = GeneralizedHarmonicTemplateBase<volume_dim>;
using gh_base = GeneralizedHarmonicTemplateBase<volume_dim, UseLts>;
using typename gh_base::initialize_initial_data_dependent_quantities_actions;
using typename gh_base::system;

Expand Down Expand Up @@ -263,7 +264,7 @@ struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3> {
evolution::Actions::ProjectRunEventsAndDenseTriggers,
::amr::projectors::DefaultInitialize<
Initialization::Tags::InitialTimeDelta,
Initialization::Tags::InitialSlabSize<local_time_stepping>,
Initialization::Tags::InitialSlabSize<gh_base::local_time_stepping>,
::domain::Tags::InitialExtents<volume_dim>,
::domain::Tags::InitialRefinementLevels<volume_dim>,
evolution::dg::Tags::Quadrature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,12 @@ struct FactoryCreation : tt::ConformsTo<Options::protocols::FactoryCreation> {
};
} // namespace detail

template <size_t VolumeDim>
template <size_t VolumeDim, bool LocalTimeStepping>
struct GeneralizedHarmonicTemplateBase {
static constexpr size_t volume_dim = VolumeDim;
using system = gh::System<volume_dim>;
using TimeStepperBase = TimeStepper;
using TimeStepperBase =
tmpl::conditional_t<LocalTimeStepping, LtsTimeStepper, TimeStepper>;

static constexpr bool local_time_stepping =
TimeStepperBase::local_time_stepping;
Expand Down
20 changes: 18 additions & 2 deletions support/Pipelines/Bbh/Ringdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,26 @@ DomainCreator:

Evolution:
InitialTime: 0.0
InitialTimeStep: 0.01
InitialTimeStep: 0.0002
# This is the smallest interval we'd need to observe time step/constraints. If
# you need it smaller you can edit it, but make sure to change the slab
# intervals in the EventsAndTriggers
InitialSlabSize: 0.5
StepChoosers:
- Increase:
Factor: 2
- ElementSizeCfl:
SafetyFactor: 0.5
- ErrorControl:
AbsoluteTolerance: 1e-8
RelativeTolerance: 1e-6
MaxFactor: 2
MinFactor: 0.25
SafetyFactor: 0.95
# Found that order 4 offers a significant speedup compared to order 5
TimeStepper:
AdamsBashforth:
Order: 1
Order: 4

EvolutionSystem:
GeneralizedHarmonic:
Expand Down
20 changes: 18 additions & 2 deletions tests/InputFiles/GeneralizedHarmonic/KerrSchild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,26 @@ ResourceInfo:

Evolution:
InitialTime: 0.0
InitialTimeStep: 0.01
InitialTimeStep: 0.0002
# This is the smallest interval we'd need to observe time step/constraints. If
# you need it smaller you can edit it, but make sure to change the slab
# intervals in the EventsAndTriggers
InitialSlabSize: 0.5
StepChoosers:
- Increase:
Factor: 2
- ElementSizeCfl:
SafetyFactor: 0.5
- ErrorControl:
AbsoluteTolerance: 1e-8
RelativeTolerance: 1e-6
MaxFactor: 2
MinFactor: 0.25
SafetyFactor: 0.95
# Found that order 4 offers a significant speedup compared to order 5
TimeStepper:
AdamsBashforth:
Order: 1
Order: 4

Amr:
Criteria:
Expand Down

0 comments on commit 006e31d

Please sign in to comment.