Skip to content

Commit 7964143

Browse files
Add Topology::B1Radial
1 parent 2a5c5b6 commit 7964143

9 files changed

Lines changed: 74 additions & 9 deletions

File tree

src/Domain/BlockLogicalCoordinates.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ block_logical_coordinates_single_point(
114114
for (size_t d = 0; d < Dim; ++d) {
115115
const auto topology = gsl::at(block.topologies(), d);
116116
if (topology == domain::Topology::I1 or
117+
topology == domain::Topology::B1Radial or
117118
topology == domain::Topology::B2Radial or
118119
topology == domain::Topology::B3Radial) {
119120
// Map inverses may report logical coordinates outside [-1, 1] due to

src/Domain/Structure/CreateInitialMesh.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "Domain/Structure/Element.hpp"
1212
#include "Domain/Structure/ElementId.hpp"
1313
#include "Domain/Structure/OrientationMap.hpp"
14+
#include "Domain/Structure/Topology.hpp"
1415
#include "NumericalAlgorithms/Spectral/Basis.hpp"
1516
#include "NumericalAlgorithms/Spectral/Mesh.hpp"
1617
#include "NumericalAlgorithms/Spectral/Quadrature.hpp"
@@ -52,6 +53,8 @@ std::array<Spectral::Basis, Dim> make_basis(
5253
[[fallthrough]];
5354
case (domain::Topology::CartoonCylinder):
5455
return Spectral::Basis::Cartoon;
56+
case (domain::Topology::B1Radial):
57+
return Spectral::Basis::ZernikeB1;
5558
default:
5659
ERROR("Invalid topology");
5760
}
@@ -93,6 +96,8 @@ std::array<Spectral::Quadrature, Dim> make_quadrature(
9396
return Spectral::Quadrature::SphericalSymmetry;
9497
case (domain::Topology::CartoonCylinder):
9598
return Spectral::Quadrature::AxialSymmetry;
99+
case (domain::Topology::B1Radial):
100+
return Spectral::Quadrature::GaussRadauUpper;
96101
default:
97102
ERROR("Invalid topology");
98103
}

src/Domain/Structure/HasBoundary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace domain {
1010
bool has_boundary(const domain::Topology topology, const Side side) {
11-
return topology == Topology::I1 or
11+
return topology == Topology::I1 or topology == Topology::B1Radial or
1212
(side == Side::Upper and
1313
(topology == Topology::B2Radial or topology == Topology::B3Radial));
1414
}

src/Domain/Structure/NeighborIsConforming.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,28 @@ bool neighbor_is_conforming(
6969
return false;
7070
}
7171
}
72+
// permute_from_neighbor reorders by dimension index only, never flipping
73+
// sides. So the correct direction into the permuted array has the
74+
// dimension from searching which self index maps to the neighbor shared
75+
// face dimension, and the side directly from the orientation-mapped
76+
// shared face direction.
77+
const auto neighbor_shared_face =
78+
orientation_of_neighbor(direction_to_neighbor.opposite());
79+
std::optional<size_t> permuted_dim{};
80+
for (size_t i = 0; i < VolumeDim; ++i) {
81+
if (orientation_of_neighbor(i) == neighbor_shared_face.dimension()) {
82+
permuted_dim = i;
83+
break;
84+
}
85+
}
86+
ASSERT(permuted_dim.has_value(),
87+
"No dimension found matching neighbor shared face dimension "
88+
<< neighbor_shared_face.dimension());
89+
const Direction<VolumeDim> permuted_neighbor_direction{
90+
permuted_dim.value(), neighbor_shared_face.side()};
7291
const auto neighbor_boundary_topologies = boundary_topologies(
7392
orientation_of_neighbor.permute_from_neighbor(neighbor_topologies),
74-
direction_to_neighbor);
93+
permuted_neighbor_direction);
7594
return self_boundary_topologies == neighbor_boundary_topologies;
7695
}
7796
}

src/Domain/Structure/Topology.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ std::ostream& operator<<(std::ostream& os, const Topology topology) {
2020
return os << "S2Colatitude";
2121
case Topology::S2Longitude:
2222
return os << "S2Longitude";
23+
case Topology::B1Radial:
24+
return os << "B1Radial";
2325
case Topology::B2Radial:
2426
return os << "B2Radial";
2527
case Topology::B2Angular:

src/Domain/Structure/Topology.hpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ enum class Topology : uint8_t {
4747
S1 = 2,
4848
S2Colatitude = 3,
4949
S2Longitude = 4,
50-
B2Radial = 5,
51-
B2Angular = 6,
52-
B3Radial = 7,
53-
B3Colatitude = 8,
54-
B3Longitude = 9,
55-
CartoonSphere = 10,
56-
CartoonCylinder = 11
50+
B1Radial = 5,
51+
B2Radial = 6,
52+
B2Angular = 7,
53+
B3Radial = 8,
54+
B3Colatitude = 9,
55+
B3Longitude = 10,
56+
CartoonSphere = 11,
57+
CartoonCylinder = 12
5758
};
5859

5960
/// Output operator for a Topology.
@@ -83,8 +84,14 @@ static constexpr auto full_sphere = std::array{
8384
static constexpr auto cartoon_sphere =
8485
std::array{Topology::I1, Topology::CartoonSphere, Topology::CartoonSphere};
8586

87+
static constexpr auto cartoon_sphere_inner = std::array{
88+
Topology::B1Radial, Topology::CartoonSphere, Topology::CartoonSphere};
89+
8690
static constexpr auto cartoon_cylinder =
8791
std::array{Topology::I1, Topology::I1, Topology::CartoonCylinder};
92+
93+
static constexpr auto cartoon_cylinder_inner =
94+
std::array{Topology::B1Radial, Topology::I1, Topology::CartoonCylinder};
8895
} // namespace topologies
8996

9097
} // namespace domain

tests/Unit/Domain/Structure/Test_HasBoundary.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace {
1111
void test() {
1212
for (const auto side : std::array{Side::Lower, Side::Upper}) {
1313
CHECK(domain::has_boundary(domain::Topology::I1, side));
14+
CHECK(domain::has_boundary(domain::Topology::B1Radial, side));
1415
CHECK_FALSE(domain::has_boundary(domain::Topology::S1, side));
1516
CHECK_FALSE(domain::has_boundary(domain::Topology::S2Colatitude, side));
1617
CHECK_FALSE(domain::has_boundary(domain::Topology::S2Longitude, side));

tests/Unit/Domain/Structure/Test_NeighborIsConforming.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,35 @@ void test_3d() {
224224
CHECK(neighbor_is_conforming(domain::topologies::cylindrical_shell,
225225
domain::topologies::full_cylinder,
226226
Direction<3>::upper_zeta(), shell_to_full));
227+
228+
// Configurations of blocks in CartoonSphere2D domain
229+
const OrientationMap<3> cartoonsphere2d_map(std::array<Direction<3>, 3>{
230+
Direction<3>::lower_eta(), Direction<3>::upper_xi(),
231+
Direction<3>::upper_zeta()});
232+
const OrientationMap<3> cartoonsphere2d_map2(std::array<Direction<3>, 3>{
233+
Direction<3>::upper_eta(), Direction<3>::lower_xi(),
234+
Direction<3>::upper_zeta()});
235+
const OrientationMap<3> cartoonsphere2d_map3(std::array<Direction<3>, 3>{
236+
Direction<3>::lower_xi(), Direction<3>::lower_eta(),
237+
Direction<3>::upper_zeta()});
238+
CHECK(neighbor_is_conforming(domain::topologies::cartoon_cylinder_inner,
239+
domain::topologies::cartoon_cylinder,
240+
Direction<3>::upper_xi(), aligned));
241+
CHECK(neighbor_is_conforming(domain::topologies::cartoon_cylinder,
242+
domain::topologies::cartoon_cylinder_inner,
243+
Direction<3>::lower_xi(), aligned));
244+
CHECK(neighbor_is_conforming(domain::topologies::cartoon_cylinder_inner,
245+
domain::topologies::cartoon_cylinder,
246+
Direction<3>::upper_xi(), cartoonsphere2d_map2));
247+
CHECK(neighbor_is_conforming(domain::topologies::cartoon_cylinder,
248+
domain::topologies::cartoon_cylinder_inner,
249+
Direction<3>::lower_eta(), cartoonsphere2d_map));
250+
CHECK(neighbor_is_conforming(domain::topologies::cartoon_cylinder_inner,
251+
domain::topologies::cartoon_cylinder,
252+
Direction<3>::upper_xi(), cartoonsphere2d_map3));
253+
CHECK(neighbor_is_conforming(domain::topologies::cartoon_cylinder,
254+
domain::topologies::cartoon_cylinder_inner,
255+
Direction<3>::upper_xi(), cartoonsphere2d_map3));
227256
}
228257
} // namespace
229258

tests/Unit/Domain/Structure/Test_Topology.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ SPECTRE_TEST_CASE("Unit.Domain.Structure.Topology", "[Domain][Unit]") {
1212
CHECK(get_output(domain::Topology::S1) == "S1");
1313
CHECK(get_output(domain::Topology::S2Colatitude) == "S2Colatitude");
1414
CHECK(get_output(domain::Topology::S2Longitude) == "S2Longitude");
15+
CHECK(get_output(domain::Topology::B1Radial) == "B1Radial");
1516
CHECK(get_output(domain::Topology::B2Radial) == "B2Radial");
1617
CHECK(get_output(domain::Topology::B2Angular) == "B2Angular");
1718
CHECK(get_output(domain::Topology::B3Radial) == "B3Radial");

0 commit comments

Comments
 (0)