Skip to content

Commit

Permalink
Hack Gforce into GhValenciaDivClean system
Browse files Browse the repository at this point in the history
  • Loading branch information
shabibti committed Oct 16, 2024
1 parent c6efb49 commit c331636
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <cstddef>
#include <memory>
#include <pup.h>
#include <type_traits>

#include "Evolution/Systems/GeneralizedHarmonic/BoundaryCorrections/Factory.hpp"
#include "Evolution/Systems/GeneralizedHarmonic/System.hpp"
Expand All @@ -19,6 +20,7 @@
#include "Utilities/PrettyType.hpp"
#include "Utilities/Serialization/CharmPupable.hpp"
#include "Utilities/TMPL.hpp"
#include "Utilities/TypeTraits/IsA.hpp"

namespace grmhd::GhValenciaDivClean::BoundaryCorrections {
namespace detail {
Expand All @@ -29,7 +31,8 @@ template <typename DerivedGhCorrection, typename DerivedValenciaCorrection,
typename GhTempTagList, typename ValenciaTempTagList,
typename DeduplicatedTempTags, typename GhPrimTagList,
typename ValenicaPrimTagList, typename GhVolumeTagList,
typename ValenciaVolumeTagList>
typename ValenciaVolumeTagList, typename GhBoundaryVolumeTagList,
typename ValenciaBoundaryVolumeTagList>
struct ProductOfCorrectionsImpl;

template <typename DerivedGhCorrection, typename DerivedValenciaCorrection,
Expand All @@ -39,7 +42,8 @@ template <typename DerivedGhCorrection, typename DerivedValenciaCorrection,
typename... GhTempTags, typename... ValenciaTempTags,
typename... DeduplicatedTempTags, typename... GhPrimTags,
typename... ValenciaPrimTags, typename... GhVolumeTags,
typename... ValenciaVolumeTags>
typename... ValenciaVolumeTags, typename... GhBoundaryVolumeTags,
typename... ValenciaBoundaryVolumeTags>
struct ProductOfCorrectionsImpl<
DerivedGhCorrection, DerivedValenciaCorrection,
tmpl::list<GhPackageFieldTags...>, tmpl::list<ValenciaPackageFieldTags...>,
Expand All @@ -48,7 +52,23 @@ struct ProductOfCorrectionsImpl<
tmpl::list<GhTempTags...>, tmpl::list<ValenciaTempTags...>,
tmpl::list<DeduplicatedTempTags...>, tmpl::list<GhPrimTags...>,
tmpl::list<ValenciaPrimTags...>, tmpl::list<GhVolumeTags...>,
tmpl::list<ValenciaVolumeTags...>> {
tmpl::list<ValenciaVolumeTags...>, tmpl::list<GhBoundaryVolumeTags...>,
tmpl::list<ValenciaBoundaryVolumeTags...>> {
template <typename Tag, bool IsAUniquePtr>
struct get_type {
using type = typename Tag::type;
};

template <typename Tag>
struct get_type<Tag, true> {
using type = typename Tag::type::element_type;
};

template <typename Tag>
using get_type_t =
typename get_type<Tag,
tt::is_a_v<std::unique_ptr, typename Tag::type>>::type;

static double dg_package_data(
const gsl::not_null<
typename GhPackageFieldTags::type*>... gh_packaged_fields,
Expand Down Expand Up @@ -112,14 +132,20 @@ struct ProductOfCorrectionsImpl<
type&... valencia_external_packaged_fields,
const dg::Formulation dg_formulation,

const get_type_t<GhBoundaryVolumeTags>&... gh_boundary_volume_quantities,
const get_type_t<
ValenciaBoundaryVolumeTags>&... valencia_boundary_volume_quantities,

const DerivedGhCorrection& gh_correction,
const DerivedValenciaCorrection& valencia_correction) {
gh_correction.dg_boundary_terms(
gh_boundary_corrections..., gh_internal_packaged_fields...,
gh_external_packaged_fields..., dg_formulation);
gh_external_packaged_fields..., dg_formulation,
gh_boundary_volume_quantities...);
valencia_correction.dg_boundary_terms(
valencia_boundary_corrections..., valencia_internal_packaged_fields...,
valencia_external_packaged_fields..., dg_formulation);
valencia_external_packaged_fields..., dg_formulation,
valencia_boundary_volume_quantities...);
}
};
} // namespace detail
Expand Down Expand Up @@ -172,7 +198,9 @@ class ProductOfCorrections final : public BoundaryCorrection {
dg_package_data_temporary_tags, tmpl::list<>,
typename DerivedValenciaCorrection::dg_package_data_primitive_tags,
typename DerivedGhCorrection::dg_package_data_volume_tags,
typename DerivedValenciaCorrection::dg_package_data_volume_tags>;
typename DerivedValenciaCorrection::dg_package_data_volume_tags,
typename DerivedGhCorrection::dg_boundary_terms_volume_tags,
typename DerivedValenciaCorrection::dg_boundary_terms_volume_tags>;

static std::string name() {
return "Product" + pretty_type::name<DerivedGhCorrection>() + "And" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,17 @@ DirectionalIdMap<3, DataVector> NeighborPackagedData::apply(

using dg_package_data_temporary_tags =
typename DerivedCorrection::dg_package_data_temporary_tags;
using dg_package_data_argument_tags =
tmpl::append<evolved_vars_tags, recons_prim_tags, fluxes_tags,
tmpl::remove_duplicates<tmpl::push_back<
dg_package_data_temporary_tags,
gr::Tags::SpatialMetric<DataVector, 3>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3>,
evolution::dg::Actions::detail::NormalVector<3>>>>;
using dg_package_data_argument_tags = tmpl::append<
evolved_vars_tags, recons_prim_tags, fluxes_tags,
tmpl::remove_duplicates<tmpl::push_back<
tmpl::list<gh::ConstraintDamping::Tags::ConstraintGamma1,
gh::ConstraintDamping::Tags::ConstraintGamma2,
gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, 3>>,
gr::Tags::SpatialMetric<DataVector, 3>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3>,
evolution::dg::Actions::detail::NormalVector<3>>>>;

const auto& element = db::get<domain::Tags::Element<3>>(box);
const auto& eos = get<hydro::Tags::GrmhdEquationOfState>(box);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ struct TimeDerivative {
using dg_package_data_argument_tags = tmpl::append<
evolved_vars_tags, recons_prim_tags, fluxes_tags,
tmpl::remove_duplicates<tmpl::push_back<
dg_package_data_temporary_tags,
tmpl::list<gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, 3>>,
gr::Tags::SpatialMetric<DataVector, 3>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3>,
Expand Down

0 comments on commit c331636

Please sign in to comment.