Skip to content

Commit

Permalink
Pass spatial metric to dg_package_data
Browse files Browse the repository at this point in the history
  • Loading branch information
shabibti committed Feb 16, 2024
1 parent 57cbdd4 commit 1086956
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ void apply_boundary_condition_on_face(
tmpl::list<>>;
using tags_on_interior_face = tmpl::remove_duplicates<tmpl::append<
fluxes_tags, interior_temp_tags, interior_prim_tags,
interior_evolved_vars_tags, bcondition_interior_dt_evolved_vars_tags,
detail::get_sarah_list<BoundaryCorrection>, interior_evolved_vars_tags,
bcondition_interior_dt_evolved_vars_tags,
bcondition_interior_deriv_evolved_vars_tags, inverse_spatial_metric_list,
tmpl::list<detail::OneOverNormalVectorMagnitude,
detail::NormalVector<Dim>>>>;
Expand Down Expand Up @@ -415,6 +416,7 @@ void apply_boundary_condition_on_face(
// boundary condition.
using tags_on_exterior_face = tmpl::remove_duplicates<
tmpl::append<variables_tags, fluxes_tags, correction_temp_tags,
detail::get_sarah_list<BoundaryCorrection>,
correction_prim_tags, inverse_spatial_metric_list,
tmpl::list<detail::OneOverNormalVectorMagnitude,
detail::NormalVector<Dim>,
Expand All @@ -426,6 +428,7 @@ void apply_boundary_condition_on_face(
using mortar_tags_list = tmpl::list<PackageFieldTags...>;
using dg_package_data_projected_tags =
tmpl::append<variables_tags, fluxes_tags, correction_temp_tags,
detail::get_sarah_list<BoundaryCorrection>,
correction_prim_tags>;

Variables<mortar_tags_list> internal_packaged_data{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ double Hll::dg_package_data(
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
packaged_normal_dot_flux_tilde_b,
const gsl::not_null<Scalar<DataVector>*> packaged_normal_dot_flux_tilde_phi,
const gsl::not_null<tnsr::ii<DataVector, 3, Frame::Inertial>*> packaged_spatial_metric,

Check failure on line 44 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

unused parameter 'packaged_spatial_metric'

Check failure on line 44 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

parameter 'packaged_spatial_metric' is unused

Check failure on line 44 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

unused parameter 'packaged_spatial_metric'

Check failure on line 44 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

parameter 'packaged_spatial_metric' is unused
const gsl::not_null<Scalar<DataVector>*>
packaged_largest_outgoing_char_speed,
const gsl::not_null<Scalar<DataVector>*>
Expand All @@ -62,6 +63,9 @@ double Hll::dg_package_data(
const Scalar<DataVector>& lapse,
const tnsr::I<DataVector, 3, Frame::Inertial>& shift,

const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,

Check failure on line 66 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

unused parameter 'spatial_metric'

Check failure on line 66 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

parameter 'spatial_metric' is unused

Check failure on line 66 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

unused parameter 'spatial_metric'

Check failure on line 66 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

parameter 'spatial_metric' is unused
const tnsr::II<DataVector, 3, Frame::Inertial>& inverse_spatial_metric,

Check failure on line 67 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

unused parameter 'inverse_spatial_metric'

Check failure on line 67 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

parameter 'inverse_spatial_metric' is unused

Check failure on line 67 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

unused parameter 'inverse_spatial_metric'

Check failure on line 67 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

parameter 'inverse_spatial_metric' is unused

const tnsr::i<DataVector, 3, Frame::Inertial>& normal_covector,
const tnsr::I<DataVector, 3, Frame::Inertial>& /*normal_vector*/,
const std::optional<tnsr::I<DataVector, 3, Frame::Inertial>>&
Expand Down Expand Up @@ -104,6 +108,8 @@ double Hll::dg_package_data(
normal_dot_flux(packaged_normal_dot_flux_tilde_phi, normal_covector,
flux_tilde_phi);

// *packaged_spatial_metric = spatial_metric;

using std::max;
return max(max(abs(get(*packaged_largest_outgoing_char_speed))),
max(abs(get(*packaged_largest_ingoing_char_speed))));
Expand All @@ -130,6 +136,7 @@ void Hll::dg_boundary_terms(
const tnsr::i<DataVector, 3, Frame::Inertial>& normal_dot_flux_tilde_s_int,
const tnsr::I<DataVector, 3, Frame::Inertial>& normal_dot_flux_tilde_b_int,
const Scalar<DataVector>& normal_dot_flux_tilde_phi_int,
const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric_int,

Check failure on line 139 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

unused parameter 'spatial_metric_int'

Check failure on line 139 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

parameter 'spatial_metric_int' is unused

Check failure on line 139 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

unused parameter 'spatial_metric_int'

Check failure on line 139 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

parameter 'spatial_metric_int' is unused
const Scalar<DataVector>& largest_outgoing_char_speed_int,
const Scalar<DataVector>& largest_ingoing_char_speed_int,
const Scalar<DataVector>& tilde_d_ext,
Expand All @@ -144,6 +151,7 @@ void Hll::dg_boundary_terms(
const tnsr::i<DataVector, 3, Frame::Inertial>& normal_dot_flux_tilde_s_ext,
const tnsr::I<DataVector, 3, Frame::Inertial>& normal_dot_flux_tilde_b_ext,
const Scalar<DataVector>& normal_dot_flux_tilde_phi_ext,
const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric_ext,

Check failure on line 154 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

unused parameter 'spatial_metric_ext'

Check failure on line 154 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Release)

parameter 'spatial_metric_ext' is unused

Check failure on line 154 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

unused parameter 'spatial_metric_ext'

Check failure on line 154 in src/Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/Hll.cpp

View workflow job for this annotation

GitHub Actions / Clang-tidy (Debug)

parameter 'spatial_metric_ext' is unused
const Scalar<DataVector>& largest_outgoing_char_speed_ext,
const Scalar<DataVector>& largest_ingoing_char_speed_ext,
const dg::Formulation dg_formulation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <brigand/sequences/list.hpp>
#include <memory>
#include <optional>

Expand Down Expand Up @@ -122,11 +123,14 @@ class Hll final : public BoundaryCorrection {
::Tags::NormalDotFlux<Tags::TildeS<Frame::Inertial>>,
::Tags::NormalDotFlux<Tags::TildeB<Frame::Inertial>>,
::Tags::NormalDotFlux<Tags::TildePhi>,
gr::Tags::SpatialMetric<DataVector, 3>,
LargestOutgoingCharSpeed, LargestIngoingCharSpeed>;
using dg_package_data_temporary_tags =
tmpl::list<gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, 3>>;
using dg_package_data_primitive_tags = tmpl::list<>;
using dg_package_data_volume_tags = tmpl::list<>;
using sarah_list = tmpl::list<gr::Tags::SpatialMetric<DataVector, 3>,
gr::Tags::InverseSpatialMetric<DataVector, 3>>;

static double dg_package_data(
gsl::not_null<Scalar<DataVector>*> packaged_tilde_d,
Expand All @@ -143,6 +147,8 @@ class Hll final : public BoundaryCorrection {
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
packaged_normal_dot_flux_tilde_b,
gsl::not_null<Scalar<DataVector>*> packaged_normal_dot_flux_tilde_phi,
gsl::not_null<tnsr::ii<DataVector, 3, Frame::Inertial>*>
packaged_spatial_metric,
gsl::not_null<Scalar<DataVector>*> packaged_largest_outgoing_char_speed,
gsl::not_null<Scalar<DataVector>*> packaged_largest_ingoing_char_speed,

Expand All @@ -162,6 +168,9 @@ class Hll final : public BoundaryCorrection {
const Scalar<DataVector>& lapse,
const tnsr::I<DataVector, 3, Frame::Inertial>& shift,

const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
const tnsr::II<DataVector, 3, Frame::Inertial>& inverse_spatial_metric,

const tnsr::i<DataVector, 3, Frame::Inertial>& normal_covector,
const tnsr::I<DataVector, 3, Frame::Inertial>& normal_vector,
const std::optional<tnsr::I<DataVector, 3, Frame::Inertial>>&
Expand Down Expand Up @@ -191,6 +200,7 @@ class Hll final : public BoundaryCorrection {
const tnsr::I<DataVector, 3, Frame::Inertial>&
normal_dot_flux_tilde_b_int,
const Scalar<DataVector>& normal_dot_flux_tilde_phi_int,
const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric_int,
const Scalar<DataVector>& largest_outgoing_char_speed_int,
const Scalar<DataVector>& largest_ingoing_char_speed_int,
const Scalar<DataVector>& tilde_d_ext,
Expand All @@ -207,6 +217,7 @@ class Hll final : public BoundaryCorrection {
const tnsr::I<DataVector, 3, Frame::Inertial>&
normal_dot_flux_tilde_b_ext,
const Scalar<DataVector>& normal_dot_flux_tilde_phi_ext,
const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric_ext,
const Scalar<DataVector>& largest_outgoing_char_speed_ext,
const Scalar<DataVector>& largest_ingoing_char_speed_ext,
dg::Formulation dg_formulation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "Evolution/DgSubcell/Tags/Mesh.hpp"
#include "Evolution/DgSubcell/Tags/OnSubcellFaces.hpp"
#include "Evolution/DgSubcell/Tags/SubcellOptions.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivative.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivativeHelpers.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/NormalCovectorAndMagnitude.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/PackageDataImpl.hpp"
#include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryCorrections/BoundaryCorrection.hpp"
Expand Down Expand Up @@ -260,6 +262,7 @@ struct NeighborPackagedData {
packaged_data.initialize(num_face_pts);
using dg_package_data_projected_tags = tmpl::append<
evolved_vars_tags, fluxes_tags, dg_package_data_temporary_tags,
evolution::dg::Actions::detail::get_sarah_list<DerivedCorrection>,
typename DerivedCorrection::dg_package_data_primitive_tags>;
evolution::dg::Actions::detail::dg_package_data<System>(
make_not_null(&packaged_data),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "Evolution/DgSubcell/Tags/Mesh.hpp"
#include "Evolution/DgSubcell/Tags/OnSubcellFaces.hpp"
#include "Evolution/DgSubcell/Tags/SubcellOptions.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/ComputeTimeDerivativeHelpers.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/NormalCovectorAndMagnitude.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/PackageDataImpl.hpp"
#include "Evolution/DiscontinuousGalerkin/MortarTags.hpp"
Expand Down Expand Up @@ -275,34 +276,34 @@ struct TimeDerivative {
mesh_velocity_dg.value().get(j), dg_mesh,
face_mesh_extents, i);
}
tmpl::for_each<evolved_vars_tags>([&vars_upper_face,
&vars_lower_face,
&mesh_velocity_on_face](
auto tag_v) {
using tag = tmpl::type_from<decltype(tag_v)>;
using flux_tag =
::Tags::Flux<tag, tmpl::size_t<3>, Frame::Inertial>;
using FluxTensor = typename flux_tag::type;
const auto& var_upper = get<tag>(vars_upper_face);
const auto& var_lower = get<tag>(vars_lower_face);
auto& flux_upper = get<flux_tag>(vars_upper_face);
auto& flux_lower = get<flux_tag>(vars_lower_face);
for (size_t storage_index = 0; storage_index < var_upper.size();
++storage_index) {
const auto tensor_index =
var_upper.get_tensor_index(storage_index);
for (size_t j = 0; j < 3; j++) {
const auto flux_storage_index =
FluxTensor::get_storage_index(prepend(tensor_index, j));
flux_upper[flux_storage_index] -=
mesh_velocity_on_face.value().get(j) *
var_upper[storage_index];
flux_lower[flux_storage_index] -=
mesh_velocity_on_face.value().get(j) *
var_lower[storage_index];
}
}
});
tmpl::for_each<evolved_vars_tags>(
[&vars_upper_face, &vars_lower_face,
&mesh_velocity_on_face](auto tag_v) {
using tag = tmpl::type_from<decltype(tag_v)>;
using flux_tag =
::Tags::Flux<tag, tmpl::size_t<3>, Frame::Inertial>;
using FluxTensor = typename flux_tag::type;
const auto& var_upper = get<tag>(vars_upper_face);
const auto& var_lower = get<tag>(vars_lower_face);
auto& flux_upper = get<flux_tag>(vars_upper_face);
auto& flux_lower = get<flux_tag>(vars_lower_face);
for (size_t storage_index = 0;
storage_index < var_upper.size(); ++storage_index) {
const auto tensor_index =
var_upper.get_tensor_index(storage_index);
for (size_t j = 0; j < 3; j++) {
const auto flux_storage_index =
FluxTensor::get_storage_index(
prepend(tensor_index, j));
flux_upper[flux_storage_index] -=
mesh_velocity_on_face.value().get(j) *
var_upper[storage_index];
flux_lower[flux_storage_index] -=
mesh_velocity_on_face.value().get(j) *
var_lower[storage_index];
}
}
});
}

// Normal vectors in curved spacetime normalized by inverse
Expand Down Expand Up @@ -350,6 +351,8 @@ struct TimeDerivative {
// Compute the packaged data
using dg_package_data_projected_tags = tmpl::append<
evolved_vars_tags, fluxes_tags, dg_package_data_temporary_tags,
evolution::dg::Actions::detail::get_sarah_list<
DerivedCorrection>,
typename DerivedCorrection::dg_package_data_primitive_tags>;
evolution::dg::Actions::detail::dg_package_data<System>(
make_not_null(&upper_packaged_data), *derived_correction,
Expand Down

0 comments on commit 1086956

Please sign in to comment.