Skip to content

Commit

Permalink
Merge pull request #6449 from nilsdeppe/bns_improvements_10
Browse files Browse the repository at this point in the history
Remove GH dependence on ScalarTensor and Hydro
  • Loading branch information
kidder authored Jan 24, 2025
2 parents 833b897 + 20d8b80 commit 517c76e
Show file tree
Hide file tree
Showing 60 changed files with 1,836 additions and 1,868 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@ struct EvolutionMetavars {
TimeStepperBase::local_time_stepping;
static constexpr bool use_dg_element_collection = false;

using initialize_initial_data_dependent_quantities_actions = tmpl::list<
Actions::MutateApply<gh::gauges::SetPiAndPhiFromConstraints<volume_dim>>,
Parallel::Actions::TerminatePhase>;
using initialize_initial_data_dependent_quantities_actions =
tmpl::list<Actions::MutateApply<gh::gauges::SetPiAndPhiFromConstraints<
gh::Solutions::all_solutions<volume_dim>, volume_dim>>,
Parallel::Actions::TerminatePhase>;

// NOLINTNEXTLINE(google-runtime-references)
void pup(PUP::er& /*p*/) {}
Expand Down Expand Up @@ -424,7 +425,8 @@ struct EvolutionMetavars {
::Events::Tags::ObserverDetInvJacobianCompute<Frame::ElementLogical,
Frame::Inertial>,
::Events::Tags::ObserverMeshVelocityCompute<volume_dim, Frame::Inertial>,
gh::gauges::Tags::GaugeAndDerivativeCompute<volume_dim>>;
gh::gauges::Tags::GaugeAndDerivativeCompute<
volume_dim, gh::Solutions::all_solutions<volume_dim>>>;

struct factory_creation
: tt::ConformsTo<Options::protocols::FactoryCreation> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ struct ObserverTags {
Frame::Inertial>,
::Events::Tags::ObserverMeshVelocityCompute<volume_dim, Frame::Inertial>,
analytic_compute, error_compute,
gh::gauges::Tags::GaugeAndDerivativeCompute<volume_dim>>;
gh::gauges::Tags::GaugeAndDerivativeCompute<
volume_dim, gh::Solutions::all_solutions<volume_dim>>>;

using field_observations =
dg::Events::field_observations<volume_dim, observe_fields,
Expand Down Expand Up @@ -337,9 +338,10 @@ struct GeneralizedHarmonicTemplateBase {
observers::collect_reduction_data_tags<tmpl::push_back<
tmpl::at<typename factory_creation::factory_classes, Event>>>;

using initialize_initial_data_dependent_quantities_actions = tmpl::list<
Actions::MutateApply<gh::gauges::SetPiAndPhiFromConstraints<volume_dim>>,
Parallel::Actions::TerminatePhase>;
using initialize_initial_data_dependent_quantities_actions =
tmpl::list<Actions::MutateApply<gh::gauges::SetPiAndPhiFromConstraints<
gh::Solutions::all_solutions<volume_dim>, volume_dim>>,
Parallel::Actions::TerminatePhase>;

// A tmpl::list of tags to be added to the GlobalCache by the
// metavariables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
#include "Evolution/Initialization/SetVariables.hpp"
#include "Evolution/NumericInitialData.hpp"
#include "Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/AllSolutions.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/BoundaryConditions/Factory.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/BoundaryCorrections/Factory.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/Equations.hpp"
Expand Down Expand Up @@ -287,7 +286,10 @@ struct GhValenciaDivCleanDefaults {
gh::Actions::InitializeGhAnd3Plus1Variables<volume_dim>,
Actions::MutateApply<tmpl::conditional_t<
UseDgSubcell, grmhd::GhValenciaDivClean::SetPiAndPhiFromConstraints,
gh::gauges::SetPiAndPhiFromConstraints<3>>>,
gh::gauges::SetPiAndPhiFromConstraints<
ghmhd::GhValenciaDivClean::InitialData::
analytic_solutions_and_data_list,
3>>>,
Initialization::Actions::AddComputeTags<
tmpl::list<gr::Tags::SqrtDetSpatialMetricCompute<
DataVector, volume_dim, domain_frame>>>,
Expand Down Expand Up @@ -578,7 +580,9 @@ struct GhValenciaDivCleanTemplateBase<
::Events::Tags::ObserverInverseJacobian<
volume_dim, Frame::ElementLogical, Frame::Inertial>,
typename system::gradient_variables>,
gh::gauges::Tags::GaugeAndDerivativeCompute<volume_dim>>>;
gh::gauges::Tags::GaugeAndDerivativeCompute<
volume_dim, ghmhd::GhValenciaDivClean::InitialData::
analytic_solutions_and_data_list>>>;

struct factory_creation
: tt::ConformsTo<Options::protocols::FactoryCreation> {
Expand Down
8 changes: 4 additions & 4 deletions src/Evolution/Executables/ScalarTensor/ScalarTensorBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
#include "Evolution/Systems/GeneralizedHarmonic/System.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
#include "Evolution/Systems/ScalarTensor/BoundaryConditions/Factory.hpp"
#include "Evolution/Systems/ScalarTensor/BoundaryConditions/ProductOfConditions.hpp"
#include "Evolution/Systems/ScalarTensor/BoundaryCorrections/Factory.hpp"
#include "Evolution/Systems/ScalarTensor/BoundaryCorrections/ProductOfCorrections.hpp"
#include "Evolution/Systems/ScalarTensor/Constraints.hpp"
#include "Evolution/Systems/ScalarTensor/Initialize.hpp"
#include "Evolution/Systems/ScalarTensor/Sources/ScalarSource.hpp"
Expand Down Expand Up @@ -288,7 +286,8 @@ struct ObserverTags {
::Events::Tags::ObserverDetInvJacobianCompute<Frame::ElementLogical,
Frame::Inertial>,
::Events::Tags::ObserverMeshVelocityCompute<volume_dim, Frame::Inertial>,
gh::gauges::Tags::GaugeAndDerivativeCompute<volume_dim>>;
gh::gauges::Tags::GaugeAndDerivativeCompute<
volume_dim, gh::ScalarTensor::AnalyticData::all_analytic_data>>;

using field_observations =
dg::Events::field_observations<volume_dim, observe_fields,
Expand Down Expand Up @@ -396,7 +395,8 @@ struct ScalarTensorTemplateBase {
Initialization::Actions::AddComputeTags<
ScalarTensor::Initialization::scalar_tensor_3plus1_compute_tags<
volume_dim>>,
Actions::MutateApply<gh::gauges::SetPiAndPhiFromConstraints<volume_dim>>,
Actions::MutateApply<gh::gauges::SetPiAndPhiFromConstraints<
gh::ScalarTensor::AnalyticData::all_analytic_data, volume_dim>>,
Initialization::Actions::AddSimpleTags<
CurvedScalarWave::Initialization::InitializeConstraintDampingGammas<
volume_dim>>,
Expand Down
32 changes: 0 additions & 32 deletions src/Evolution/Systems/GeneralizedHarmonic/AllSolutions.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <pup.h>
#include <type_traits>

#include "Evolution/Systems/GeneralizedHarmonic/AllSolutions.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/System.hpp"
#include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Factory.hpp"
#include "PointwiseFunctions/GeneralRelativity/Lapse.hpp"
#include "PointwiseFunctions/GeneralRelativity/Shift.hpp"
#include "PointwiseFunctions/GeneralRelativity/SpatialMetric.hpp"
Expand Down Expand Up @@ -80,7 +80,7 @@ std::optional<std::string> DirichletAnalytic<Dim>::dg_ghost(
using evolved_vars_tags = typename System<Dim>::variables_tag::tags_list;
auto boundary_values = call_with_dynamic_type<
tuples::tagged_tuple_from_typelist<evolved_vars_tags>,
solutions_including_matter<Dim>>(
gh::Solutions::all_solutions<Dim>>(
analytic_prescription_.get(),
[&coords, &time](const auto* const analytic_solution_or_data) {
if constexpr (is_analytic_solution_v<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,23 @@ class DirichletAnalytic final : public BoundaryCondition<Dim> {
using dg_gridless_tags = tmpl::list<::Tags::Time>;

std::optional<std::string> dg_ghost(
const gsl::not_null<tnsr::aa<DataVector, Dim, Frame::Inertial>*>
gsl::not_null<tnsr::aa<DataVector, Dim, Frame::Inertial>*>
spacetime_metric,
const gsl::not_null<tnsr::aa<DataVector, Dim, Frame::Inertial>*> pi,
const gsl::not_null<tnsr::iaa<DataVector, Dim, Frame::Inertial>*> phi,
const gsl::not_null<Scalar<DataVector>*> gamma1,
const gsl::not_null<Scalar<DataVector>*> gamma2,
const gsl::not_null<Scalar<DataVector>*> lapse,
const gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*> shift,
const gsl::not_null<tnsr::II<DataVector, Dim, Frame::Inertial>*>
gsl::not_null<tnsr::aa<DataVector, Dim, Frame::Inertial>*> pi,
gsl::not_null<tnsr::iaa<DataVector, Dim, Frame::Inertial>*> phi,
gsl::not_null<Scalar<DataVector>*> gamma1,
gsl::not_null<Scalar<DataVector>*> gamma2,
gsl::not_null<Scalar<DataVector>*> lapse,
gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*> shift,
gsl::not_null<tnsr::II<DataVector, Dim, Frame::Inertial>*>
inv_spatial_metric,
const std::optional<
tnsr::I<DataVector, Dim, Frame::Inertial>>& /*face_mesh_velocity*/,
const tnsr::i<DataVector, Dim, Frame::Inertial>& /*normal_covector*/,
const tnsr::I<DataVector, Dim, Frame::Inertial>& /*normal_vector*/,
const tnsr::I<DataVector, Dim, Frame::Inertial>& coords,
const Scalar<DataVector>& interior_gamma1,
const Scalar<DataVector>& interior_gamma2, const double time) const;
const Scalar<DataVector>& interior_gamma2, double time) const;

private:
void lapse_shift_and_inv_spatial_metric(
Expand Down
3 changes: 1 addition & 2 deletions src/Evolution/Systems/GeneralizedHarmonic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ spectre_target_headers(
${LIBRARY}
INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/src
HEADERS
AllSolutions.hpp
Characteristics.hpp
Constraints.hpp
DuDtTempTags.hpp
Expand All @@ -29,6 +28,7 @@ spectre_target_headers(
Tags.hpp
TagsDeclarations.hpp
TimeDerivative.hpp
TimeDerivative.tpp
)

target_link_libraries(
Expand All @@ -43,7 +43,6 @@ target_link_libraries(
GeneralRelativity
GeneralRelativitySolutions
GhGrMhdAnalyticData
GhScalarTensorAnalyticData
GhGrMhdSolutions
GhRelativisticEulerSolutions
IO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@
#include "DataStructures/DataVector.hpp"
#include "DataStructures/Tensor/EagerMath/DeterminantAndInverse.hpp"
#include "DataStructures/Tensor/Tensor.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/AllSolutions.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
#include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
#include "NumericalAlgorithms/Spectral/Mesh.hpp"
#include "PointwiseFunctions/AnalyticData/GhGrMhd/Factory.hpp"
#include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Factory.hpp"
#include "PointwiseFunctions/AnalyticSolutions/GhGrMhd/Factory.hpp"
#include "PointwiseFunctions/AnalyticSolutions/GhRelativisticEuler/Factory.hpp"
#include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/Christoffel.hpp"
#include "PointwiseFunctions/GeneralRelativity/SpacetimeNormalOneForm.hpp"
#include "PointwiseFunctions/GeneralRelativity/SpacetimeNormalVector.hpp"
#include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
#include "Utilities/CallWithDynamicType.hpp"
#include "Utilities/ErrorHandling/Assert.hpp"
#include "Utilities/GenerateInstantiations.hpp"
#include "Utilities/Gsl.hpp"
#include "Utilities/TMPL.hpp"
Expand Down Expand Up @@ -61,41 +55,18 @@ std::unique_ptr<GaugeCondition> AnalyticChristoffel::get_clone() const {
}

template <size_t SpatialDim>
void AnalyticChristoffel::gauge_and_spacetime_derivative(
void AnalyticChristoffel::gauge_and_spacetime_derivative_impl(
const gsl::not_null<tnsr::a<DataVector, SpatialDim, Frame::Inertial>*>
gauge_h,
const gsl::not_null<tnsr::ab<DataVector, SpatialDim, Frame::Inertial>*>
d4_gauge_h,
const Mesh<SpatialDim>& mesh, const double time,
const tnsr::I<DataVector, SpatialDim, Frame::Inertial>& inertial_coords,
const Mesh<SpatialDim>& mesh,
const InverseJacobian<DataVector, SpatialDim, Frame::ElementLogical,
Frame::Inertial>& inverse_jacobian) const {
ASSERT(analytic_prescription_ != nullptr,
"The analytic prescription cannot be nullptr.");
using solution_tags =
tmpl::list<gh::Tags::Pi<DataVector, SpatialDim>,
gh::Tags::Phi<DataVector, SpatialDim>,
gr::Tags::SpacetimeMetric<DataVector, SpatialDim>,
gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, SpatialDim>,
gr::Tags::SpatialMetric<DataVector, SpatialDim>>;
Frame::Inertial>& inverse_jacobian,
const tuples::tagged_tuple_from_typelist<solution_tags<SpatialDim>>&
solution_vars) const {
const auto [pi, phi, spacetime_metric, lapse, shift, spatial_metric] =
call_with_dynamic_type<tuples::tagged_tuple_from_typelist<solution_tags>,
solutions_including_matter<SpatialDim>>(
analytic_prescription_.get(),
[&inertial_coords,
&time](const auto* const analytic_solution_or_data) {
if constexpr (is_analytic_solution_v<std::decay_t<
decltype(*analytic_solution_or_data)>>) {
return analytic_solution_or_data->variables(inertial_coords, time,
solution_tags{});

} else {
(void)time;
return analytic_solution_or_data->variables(inertial_coords,
solution_tags{});
}
});
solution_vars;
// Now compute Gamma_a
Variables<
tmpl::list<gr::Tags::SpacetimeNormalVector<DataVector, SpatialDim>,
Expand Down Expand Up @@ -153,16 +124,17 @@ PUP::able::PUP_ID AnalyticChristoffel::my_PUP_ID = 0;

#define DIM(data) BOOST_PP_TUPLE_ELEM(0, data)

#define INSTANTIATE(_, data) \
template void AnalyticChristoffel::gauge_and_spacetime_derivative( \
const gsl::not_null<tnsr::a<DataVector, DIM(data), Frame::Inertial>*> \
gauge_h, \
const gsl::not_null<tnsr::ab<DataVector, DIM(data), Frame::Inertial>*> \
d4_gauge_h, \
const Mesh<DIM(data)>& mesh, double time, \
const tnsr::I<DataVector, DIM(data), Frame::Inertial>& inertial_coords, \
const InverseJacobian<DataVector, DIM(data), Frame::ElementLogical, \
Frame::Inertial>& inverse_jacobian) const;
#define INSTANTIATE(_, data) \
template void AnalyticChristoffel::gauge_and_spacetime_derivative_impl( \
const gsl::not_null<tnsr::a<DataVector, DIM(data), Frame::Inertial>*> \
gauge_h, \
const gsl::not_null<tnsr::ab<DataVector, DIM(data), Frame::Inertial>*> \
d4_gauge_h, \
const Mesh<DIM(data)>& mesh, \
const InverseJacobian<DataVector, DIM(data), Frame::ElementLogical, \
Frame::Inertial>& inverse_jacobian, \
const tuples::tagged_tuple_from_typelist<solution_tags<DIM(data)>>& \
solution_vars) const;

GENERATE_INSTANTIATIONS(INSTANTIATE, (1, 2, 3))

Expand Down
Loading

0 comments on commit 517c76e

Please sign in to comment.