Skip to content

Commit

Permalink
Merge pull request #5555 from yoonso0-0/ffe/subcell/remove_tags
Browse files Browse the repository at this point in the history
Remove unnecessary tags in ForceFree FD reconstructors
  • Loading branch information
nilsdeppe authored Oct 12, 2023
2 parents e586a65 + 38db303 commit 1665625
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ void AdaptiveOrder::pup(PUP::er& p) {
PUP::able::PUP_ID AdaptiveOrder::my_PUP_ID = 0;

void AdaptiveOrder::reconstruct(
const gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
const gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_lower_face,
const gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
const gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_upper_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
Expand Down Expand Up @@ -118,7 +118,7 @@ void AdaptiveOrder::reconstruct(
}

void AdaptiveOrder::reconstruct_fd_neighbor(
const gsl::not_null<Variables<face_vars_tags>*> vars_on_face,
const gsl::not_null<Variables<recons_tags>*> vars_on_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
const Element<dim>& element,
Expand Down
25 changes: 6 additions & 19 deletions src/Evolution/Systems/ForceFree/FiniteDifference/AdaptiveOrder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Evolution/DgSubcell/Tags/Mesh.hpp"
#include "Evolution/DiscontinuousGalerkin/Actions/NormalCovectorAndMagnitude.hpp"
#include "Evolution/Systems/ForceFree/FiniteDifference/Reconstructor.hpp"
#include "Evolution/Systems/ForceFree/FiniteDifference/Tags.hpp"
#include "Evolution/Systems/ForceFree/Tags.hpp"
#include "NumericalAlgorithms/FiniteDifference/FallbackReconstructorType.hpp"
#include "Options/Auto.hpp"
Expand All @@ -40,7 +41,7 @@ template <size_t dim>
class ElementId;
template <size_t dim>
class Mesh;
template <typename face_vars_tags>
template <typename recons_tags>
class Variables;
namespace gsl {
template <typename>
Expand Down Expand Up @@ -72,21 +73,7 @@ class AdaptiveOrder : public Reconstructor {
using volume_vars_tags =
tmpl::list<TildeE, TildeB, TildePsi, TildePhi, TildeQ>;

using face_vars_tags =
tmpl::list<TildeJ, // we reconstruct TildeJ, not computing it from values
// of reconstructed evolved variables
TildeE, TildeB, TildePsi, TildePhi, TildeQ,
::Tags::Flux<TildeE, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildeB, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildePsi, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildePhi, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildeQ, tmpl::size_t<3>, Frame::Inertial>,
gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, 3, Frame::Inertial>,
gr::Tags::SpatialMetric<DataVector, 3, Frame::Inertial>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3, Frame::Inertial>,
evolution::dg::Actions::detail::NormalVector<3>>;
using recons_tags = ForceFree::fd::tags_list_for_reconstruction;

using FallbackReconstructorType =
::fd::reconstruction::FallbackReconstructorType;
Expand Down Expand Up @@ -163,9 +150,9 @@ class AdaptiveOrder : public Reconstructor {
evolution::dg::subcell::Tags::Mesh<dim>>;

void reconstruct(
gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_lower_face,
gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_upper_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
Expand All @@ -178,7 +165,7 @@ class AdaptiveOrder : public Reconstructor {
const Mesh<dim>& subcell_mesh) const;

void reconstruct_fd_neighbor(
gsl::not_null<Variables<face_vars_tags>*> vars_on_face,
gsl::not_null<Variables<recons_tags>*> vars_on_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
const Element<dim>& element,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ void MonotonisedCentral::pup(PUP::er& p) { Reconstructor::pup(p); }
PUP::able::PUP_ID MonotonisedCentral::my_PUP_ID = 0;

void MonotonisedCentral::reconstruct(
const gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
const gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_lower_face,
const gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
const gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_upper_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
Expand Down Expand Up @@ -77,7 +77,7 @@ void MonotonisedCentral::reconstruct(
}

void MonotonisedCentral::reconstruct_fd_neighbor(
const gsl::not_null<Variables<face_vars_tags>*> vars_on_face,
const gsl::not_null<Variables<recons_tags>*> vars_on_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
const Element<dim>& element,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template <size_t dim>
class ElementId;
template <size_t dim>
class Mesh;
template <typename face_vars_tags>
template <typename recons_tags>
class Variables;
namespace gsl {
template <typename>
Expand Down Expand Up @@ -68,21 +68,7 @@ class MonotonisedCentral : public Reconstructor {
using volume_vars_tags =
tmpl::list<TildeE, TildeB, TildePsi, TildePhi, TildeQ>;

using face_vars_tags =
tmpl::list<TildeJ, // we reconstruct TildeJ, not computing it from values
// of reconstructed evolved variables
TildeE, TildeB, TildePsi, TildePhi, TildeQ,
::Tags::Flux<TildeE, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildeB, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildePsi, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildePhi, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildeQ, tmpl::size_t<3>, Frame::Inertial>,
gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, 3, Frame::Inertial>,
gr::Tags::SpatialMetric<DataVector, 3, Frame::Inertial>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3, Frame::Inertial>,
evolution::dg::Actions::detail::NormalVector<3>>;
using recons_tags = ForceFree::fd::tags_list_for_reconstruction;

public:
static constexpr size_t dim = 3;
Expand Down Expand Up @@ -117,9 +103,9 @@ class MonotonisedCentral : public Reconstructor {
evolution::dg::subcell::Tags::Mesh<dim>>;

void reconstruct(
gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_lower_face,
gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_upper_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
Expand All @@ -132,7 +118,7 @@ class MonotonisedCentral : public Reconstructor {
const Mesh<dim>& subcell_mesh) const;

void reconstruct_fd_neighbor(
gsl::not_null<Variables<face_vars_tags>*> vars_on_face,
gsl::not_null<Variables<recons_tags>*> vars_on_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
const Element<dim>& element,
Expand Down
6 changes: 3 additions & 3 deletions src/Evolution/Systems/ForceFree/FiniteDifference/Wcns5z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ void Wcns5z::pup(PUP::er& p) {
PUP::able::PUP_ID Wcns5z::my_PUP_ID = 0;

void Wcns5z::reconstruct(
const gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
const gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_lower_face,
const gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
const gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_upper_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
Expand Down Expand Up @@ -95,7 +95,7 @@ void Wcns5z::reconstruct(
}

void Wcns5z::reconstruct_fd_neighbor(
const gsl::not_null<Variables<face_vars_tags>*> vars_on_face,
const gsl::not_null<Variables<recons_tags>*> vars_on_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
const Element<dim>& element,
Expand Down
24 changes: 5 additions & 19 deletions src/Evolution/Systems/ForceFree/FiniteDifference/Wcns5z.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ template <size_t dim>
class ElementId;
template <size_t dim>
class Mesh;
template <typename face_vars_tags>
template <typename recons_tags>
class Variables;
namespace gsl {
template <typename>
Expand Down Expand Up @@ -68,21 +68,7 @@ class Wcns5z : public Reconstructor {
using volume_vars_tags =
tmpl::list<TildeE, TildeB, TildePsi, TildePhi, TildeQ>;

using face_vars_tags =
tmpl::list<TildeJ, // we reconstruct TildeJ, not computing it from values
// of reconstructed evolved variables
TildeE, TildeB, TildePsi, TildePhi, TildeQ,
::Tags::Flux<TildeE, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildeB, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildePsi, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildePhi, tmpl::size_t<3>, Frame::Inertial>,
::Tags::Flux<TildeQ, tmpl::size_t<3>, Frame::Inertial>,
gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, 3, Frame::Inertial>,
gr::Tags::SpatialMetric<DataVector, 3, Frame::Inertial>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3, Frame::Inertial>,
evolution::dg::Actions::detail::NormalVector<3>>;
using recons_tags = ForceFree::fd::tags_list_for_reconstruction;

using FallbackReconstructorType =
::fd::reconstruction::FallbackReconstructorType;
Expand Down Expand Up @@ -152,9 +138,9 @@ class Wcns5z : public Reconstructor {
evolution::dg::subcell::Tags::Mesh<dim>>;

void reconstruct(
gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_lower_face,
gsl::not_null<std::array<Variables<face_vars_tags>, dim>*>
gsl::not_null<std::array<Variables<recons_tags>, dim>*>
vars_on_upper_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
Expand All @@ -167,7 +153,7 @@ class Wcns5z : public Reconstructor {
const Mesh<dim>& subcell_mesh) const;

void reconstruct_fd_neighbor(
gsl::not_null<Variables<face_vars_tags>*> vars_on_face,
gsl::not_null<Variables<recons_tags>*> vars_on_face,
const Variables<volume_vars_tags>& volume_vars,
const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j,
const Element<dim>& element,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ void test_reconstructor(const size_t points_per_dimension,
using TildeJ = ::ForceFree::Tags::TildeJ;

using cons_tags = tmpl::list<TildeE, TildeB, TildePsi, TildePhi, TildeQ>;
using flux_tags = db::wrap_tags_in<::Tags::Flux, cons_tags, tmpl::size_t<3>,
Frame::Inertial>;

const Mesh<3> subcell_mesh{points_per_dimension,
Spectral::Basis::FiniteDifference,
Expand Down Expand Up @@ -183,43 +181,12 @@ void test_reconstructor(const size_t points_per_dimension,
const size_t reconstructed_num_pts =
(subcell_mesh.extents(0) + 1) *
subcell_mesh.extents().slice_away(0).product();
using face_vars_tags = tmpl::append<
tmpl::list<TildeJ>, cons_tags, flux_tags,
tmpl::remove_duplicates<tmpl::push_back<tmpl::list<
gr::Tags::Lapse<DataVector>,
gr::Tags::Shift<DataVector, 3, Frame::Inertial>,
gr::Tags::SpatialMetric<DataVector, 3>,
gr::Tags::SqrtDetSpatialMetric<DataVector>,
gr::Tags::InverseSpatialMetric<DataVector, 3, Frame::Inertial>,
evolution::dg::Actions::detail::NormalVector<3>>>>>;
tnsr::ii<DataVector, 3, Frame::Inertial> lower_face_spatial_metric{
reconstructed_num_pts, 0.0};
tnsr::ii<DataVector, 3, Frame::Inertial> upper_face_spatial_metric{
reconstructed_num_pts, 0.0};
for (size_t i = 0; i < 3; ++i) {
lower_face_spatial_metric.get(i, i) = 1.0 + 0.01 * i;
upper_face_spatial_metric.get(i, i) = 1.0 - 0.01 * i;
}
const Scalar<DataVector> lower_face_sqrt_det_spatial_metric{
sqrt(get(determinant(lower_face_spatial_metric)))};
const Scalar<DataVector> upper_face_sqrt_det_spatial_metric{
sqrt(get(determinant(upper_face_spatial_metric)))};

std::array<Variables<face_vars_tags>, 3> vars_on_lower_face =
make_array<3>(Variables<face_vars_tags>(reconstructed_num_pts));
std::array<Variables<face_vars_tags>, 3> vars_on_upper_face =
make_array<3>(Variables<face_vars_tags>(reconstructed_num_pts));
for (size_t i = 0; i < 3; ++i) {
get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(
gsl::at(vars_on_lower_face, i)) = lower_face_sqrt_det_spatial_metric;
get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(
gsl::at(vars_on_upper_face, i)) = upper_face_sqrt_det_spatial_metric;

get<gr::Tags::SpatialMetric<DataVector, 3>>(
gsl::at(vars_on_lower_face, i)) = lower_face_spatial_metric;
get<gr::Tags::SpatialMetric<DataVector, 3>>(
gsl::at(vars_on_upper_face, i)) = upper_face_spatial_metric;
}
using recons_tags = ::ForceFree::fd::tags_list_for_reconstruction;

std::array<Variables<recons_tags>, 3> vars_on_lower_face =
make_array<3>(Variables<recons_tags>(reconstructed_num_pts));
std::array<Variables<recons_tags>, 3> vars_on_upper_face =
make_array<3>(Variables<recons_tags>(reconstructed_num_pts));

// Now we have everything to call the reconstruction
dynamic_cast<const Reconstructor&>(reconstructor)
Expand All @@ -244,7 +211,7 @@ void test_reconstructor(const size_t points_per_dimension,
}

// check reconstructed values for reconstruct() function
Variables<face_vars_tags> expected_face_values{
Variables<recons_tags> expected_face_values{
face_centered_mesh.number_of_grid_points()};
expected_face_values.assign_subset(
compute_solution(logical_coords_face_centered));
Expand All @@ -266,37 +233,15 @@ void test_reconstructor(const size_t points_per_dimension,
const size_t num_pts_on_mortar =
face_centered_mesh.slice_away(dim).number_of_grid_points();

Variables<face_vars_tags> upper_side_vars_on_mortar{num_pts_on_mortar};
// Slice GR variables onto the mortar
data_on_slice(
make_not_null(&get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(
upper_side_vars_on_mortar)),
get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(expected_face_values),
face_centered_mesh.extents(), dim, face_centered_mesh.extents(dim) - 1);
data_on_slice(
make_not_null(&get<gr::Tags::SpatialMetric<DataVector, 3>>(
upper_side_vars_on_mortar)),
get<gr::Tags::SpatialMetric<DataVector, 3>>(expected_face_values),
face_centered_mesh.extents(), dim, face_centered_mesh.extents(dim) - 1);
Variables<recons_tags> upper_side_vars_on_mortar{num_pts_on_mortar};

dynamic_cast<const Reconstructor&>(reconstructor)
.reconstruct_fd_neighbor(make_not_null(&upper_side_vars_on_mortar),
volume_vars, volume_tilde_j, element,
ghost_data, subcell_mesh,
Direction<3>{dim, Side::Upper});

Variables<face_vars_tags> lower_side_vars_on_mortar{num_pts_on_mortar};
// Slice GR variables onto the mortar
data_on_slice(
make_not_null(&get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(
lower_side_vars_on_mortar)),
get<gr::Tags::SqrtDetSpatialMetric<DataVector>>(expected_face_values),
face_centered_mesh.extents(), dim, 0);
data_on_slice(
make_not_null(&get<gr::Tags::SpatialMetric<DataVector, 3>>(
lower_side_vars_on_mortar)),
get<gr::Tags::SpatialMetric<DataVector, 3>>(expected_face_values),
face_centered_mesh.extents(), dim, 0);
Variables<recons_tags> lower_side_vars_on_mortar{num_pts_on_mortar};

dynamic_cast<const Reconstructor&>(reconstructor)
.reconstruct_fd_neighbor(make_not_null(&lower_side_vars_on_mortar),
Expand Down

0 comments on commit 1665625

Please sign in to comment.