Skip to content

Commit

Permalink
Add support for equiangular maps to BNS domain
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsdeppe committed Oct 4, 2024
1 parent ae7e1e4 commit 25492b6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
2 changes: 2 additions & 0 deletions src/Domain/Creators/BinaryCompactObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ Domain<3> BinaryCompactObject<UseWorldtube>::create_domain() const {
Maps maps_frustums = domain::make_vector_coordinate_map_base<
Frame::BlockLogical, Frame::Inertial, 3>(frustum_coordinate_maps(
length_inner_cube_, length_outer_cube_, use_equiangular_map_,
use_equiangular_map_ and not use_single_block_a_ and
not use_single_block_b_,
{{-translation_, -center_of_mass_offset_[0], -center_of_mass_offset_[1]}},
radial_distribution_envelope_,
radial_distribution_envelope_ ==
Expand Down
12 changes: 7 additions & 5 deletions src/Domain/Creators/FrustalCloak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ FrustalCloak::FrustalCloak(
Domain<3> FrustalCloak::create_domain() const {
std::vector<std::unique_ptr<
CoordinateMapBase<Frame::BlockLogical, Frame::Inertial, 3>>>
coord_maps = domain::make_vector_coordinate_map_base<
Frame::BlockLogical, Frame::Inertial, 3>(frustum_coordinate_maps(
length_inner_cube_, length_outer_cube_, use_equiangular_map_,
origin_preimage_, domain::CoordinateMaps::Distribution::Projective,
projection_factor_));
coord_maps = domain::make_vector_coordinate_map_base<Frame::BlockLogical,
Frame::Inertial, 3>(
frustum_coordinate_maps(
length_inner_cube_, length_outer_cube_, use_equiangular_map_,
use_equiangular_map_, origin_preimage_,
domain::CoordinateMaps::Distribution::Projective,
projection_factor_));
return Domain<3>{std::move(coord_maps),
corners_for_biradially_layered_domains(
0, 1, false, false, {{1, 2, 3, 4, 5, 6, 7, 8}})};
Expand Down
18 changes: 9 additions & 9 deletions src/Domain/DomainHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ std::vector<domain::CoordinateMaps::Wedge<3>> sph_wedge_coordinate_maps(

std::vector<domain::CoordinateMaps::Frustum> frustum_coordinate_maps(
const double length_inner_cube, const double length_outer_cube,
const bool use_equiangular_map,
const bool equiangular_map_at_outer, const bool equiangular_map_at_inner,
const std::array<double, 3>& origin_preimage,
const domain::CoordinateMaps::Distribution radial_distribution,
const std::optional<double> distribution_value, const double sphericity,
Expand Down Expand Up @@ -777,8 +777,8 @@ std::vector<domain::CoordinateMaps::Frustum> frustum_coordinate_maps(
lower - displacement_from_origin[2],
top,
gsl::at(frustum_orientations, i),
use_equiangular_map,
use_equiangular_map,
equiangular_map_at_outer,
equiangular_map_at_inner,
radial_distribution,
distribution_value,
sphericity,
Expand All @@ -794,8 +794,8 @@ std::vector<domain::CoordinateMaps::Frustum> frustum_coordinate_maps(
lower - displacement_from_origin[2],
top,
gsl::at(frustum_orientations, i),
use_equiangular_map,
use_equiangular_map,
equiangular_map_at_outer,
equiangular_map_at_inner,
radial_distribution,
distribution_value,
sphericity,
Expand All @@ -814,8 +814,8 @@ std::vector<domain::CoordinateMaps::Frustum> frustum_coordinate_maps(
2.0 * lower - displacement_from_origin[2],
stretch * top,
frustum_orientations[4],
use_equiangular_map,
use_equiangular_map,
equiangular_map_at_outer,
equiangular_map_at_inner,
radial_distribution,
distribution_value,
sphericity,
Expand All @@ -833,8 +833,8 @@ std::vector<domain::CoordinateMaps::Frustum> frustum_coordinate_maps(
2.0 * lower - displacement_from_origin[2],
stretch * top,
frustum_orientations[5],
use_equiangular_map,
use_equiangular_map,
equiangular_map_at_outer,
equiangular_map_at_inner,
radial_distribution,
distribution_value,
sphericity,
Expand Down
8 changes: 5 additions & 3 deletions src/Domain/DomainHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ std::vector<domain::CoordinateMaps::Wedge<3>> sph_wedge_coordinate_maps(
/// \param length_inner_cube The side length of the cubes enveloping the two
/// shells.
/// \param length_outer_cube The side length of the outer cube.
/// \param use_equiangular_map Whether to apply a tangent map in the angular
/// directions.
/// \param equiangular_map_at_outer Whether to apply a tangent map in the
/// angular directions at the outer boundary.
/// \param equiangular_map_at_inner Whether to apply a tangent map in the
/// angular directions at the inner boundary.
/// \param origin_preimage The center of the two joined inner cubes is moved
/// away from the origin and to this point, origin_preimage.
/// \param radial_distribution The gridpoint distribution in the radial
Expand All @@ -214,7 +216,7 @@ std::vector<domain::CoordinateMaps::Wedge<3>> sph_wedge_coordinate_maps(
/// the same value for `opening_angle`.
std::vector<domain::CoordinateMaps::Frustum> frustum_coordinate_maps(
double length_inner_cube, double length_outer_cube,
bool use_equiangular_map,
bool equiangular_map_at_outer, bool equiangular_map_at_inner,
const std::array<double, 3>& origin_preimage = {{0.0, 0.0, 0.0}},
domain::CoordinateMaps::Distribution radial_distribution =
domain::CoordinateMaps::Distribution::Linear,
Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/Domain/Test_Domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,8 @@ Domain<3> create_serialized_domain() {
make_vector_coordinate_map_base<Frame::BlockLogical, Frame::Inertial, 3>(
frustum_coordinate_maps(
length_inner_cube, length_outer_cube, use_equiangular_map,
{{-translation, 0.0, 0.0}}, radial_distribution_envelope,
use_equiangular_map, {{-translation, 0.0, 0.0}},
radial_distribution_envelope,
radial_distribution_envelope ==
CoordinateMaps::Distribution::Projective
? std::optional<double>(length_inner_cube / length_outer_cube)
Expand Down
16 changes: 8 additions & 8 deletions tests/Unit/Domain/Test_DomainHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ void test_all_frustum_directions() {
radial_distribution});

const auto maps = frustum_coordinate_maps(
2.0 * lower, 2.0 * top, use_equiangular_map, origin_preimage,
CoordinateMaps::Distribution::Projective);
2.0 * lower, 2.0 * top, use_equiangular_map, use_equiangular_map,
origin_preimage, CoordinateMaps::Distribution::Projective);
CHECK(maps == expected_coord_maps);
}
}
Expand All @@ -656,9 +656,9 @@ void test_frustrum_errors() {
const double length_outer_cube = 1.5;
const bool use_equiangular_map = true;
const std::array<double, 3> origin_preimage = {{0.0, 0.0, 0.0}};
static_cast<void>(
frustum_coordinate_maps(length_inner_cube, length_outer_cube,
use_equiangular_map, origin_preimage));
static_cast<void>(frustum_coordinate_maps(
length_inner_cube, length_outer_cube, use_equiangular_map,
use_equiangular_map, origin_preimage));
}()),
Catch::Matchers::ContainsSubstring(
"The outer cube is too small! The inner cubes will "
Expand All @@ -670,9 +670,9 @@ void test_frustrum_errors() {
const double length_outer_cube = 3.0;
const bool use_equiangular_map = true;
const std::array<double, 3> origin_preimage = {{0.6, 0.0, 0.0}};
static_cast<void>(
frustum_coordinate_maps(length_inner_cube, length_outer_cube,
use_equiangular_map, origin_preimage));
static_cast<void>(frustum_coordinate_maps(
length_inner_cube, length_outer_cube, use_equiangular_map,
use_equiangular_map, origin_preimage));
}()),
Catch::Matchers::ContainsSubstring(
"The current choice for `origin_preimage` results in the "
Expand Down

0 comments on commit 25492b6

Please sign in to comment.