Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always enable time-dependent maps #5878

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion containers/Dockerfile.buildenv
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ ENV PATH "/opt/paraview/bin:$PATH"
# Build the executables used in the tutorial
RUN if [ "$TARGETARCH" = "$BUILDARCH" ] ; then \
cd spectre/build \
&& make ${PARALLEL_MAKE_ARG} ExportTimeDependentCoordinates3D \
&& make ${PARALLEL_MAKE_ARG} ExportCoordinates3D \
&& make ${PARALLEL_MAKE_ARG} EvolveScalarAdvection2D \
; fi

Expand Down
12 changes: 6 additions & 6 deletions docs/Tutorials/BeginnersTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ directory and compile the executables that we will use in this tutorial:

```sh
cd /work/spectre/build
make -j2 ExportTimeDependentCoordinates3D EvolveScalarAdvection2D all-pybindings
make -j2 ExportCoordinates3D EvolveScalarAdvection2D all-pybindings
```

This will compile the code on two cores. If you'd like to use more cores, use
Expand All @@ -115,9 +115,9 @@ command line right away:
spectre --help
```

## Running ExportTimeDependentCoordinates3D
## Running ExportCoordinates3D

First we will run the `ExportTimeDependentCoordinates3D` executable to visualize
First we will run the `ExportCoordinates3D` executable to visualize
the coordinates of a binary black hole domain.
Make a directory where you will run everything:

Expand All @@ -138,8 +138,8 @@ This will run it on one core. If you'd like to use more cores, add the `-j N`
option where `N` is the number of cores. After this finishes you should
see two `H5` files in your run directory:

1. ExportTimeDependentCoordinates3DVolume0
2. ExportTimeDependentCoordinates3DReductions
1. ExportCoordinates3DVolume0
2. ExportCoordinates3DReductions

The `Volume` file is where we store data from every element in our domain, like
the coordinates or the metric. The `Reductions` file is for more global
Expand Down Expand Up @@ -168,7 +168,7 @@ directory where you have the `H5` files, run
```
spectre generate-xdmf \
--subfile-name element_data --output BBH_Coords \
ExportTimeDependentCoordinates3DVolume*h5
ExportCoordinates3DVolume*h5
```

We output volume data per node so we append the
Expand Down
1 change: 0 additions & 1 deletion src/Domain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ add_subdirectory(BoundaryConditions)
add_subdirectory(CoordinateMaps)
add_subdirectory(Creators)
add_subdirectory(FunctionsOfTime)
add_subdirectory(Protocols)
add_subdirectory(Python)
add_subdirectory(Structure)
add_subdirectory(Tags)
25 changes: 3 additions & 22 deletions src/Domain/Creators/BinaryCompactObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ BinaryCompactObject::BinaryCompactObject(
const CoordinateMaps::Distribution radial_distribution_envelope,
const CoordinateMaps::Distribution radial_distribution_outer_shell,
const double opening_angle_in_degrees,
std::optional<bco::TimeDependentMapOptions<false>> time_dependent_options,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
outer_boundary_condition,
const Options::Context& context)
Expand All @@ -75,6 +76,7 @@ BinaryCompactObject::BinaryCompactObject(
radial_distribution_envelope_(radial_distribution_envelope),
radial_distribution_outer_shell_(radial_distribution_outer_shell),
outer_boundary_condition_(std::move(outer_boundary_condition)),
time_dependent_options_(std::move(time_dependent_options)),
opening_angle_(M_PI * opening_angle_in_degrees / 180.0) {
// Get useful information about the type of grid used around each compact
// object
Expand Down Expand Up @@ -283,29 +285,8 @@ BinaryCompactObject::BinaryCompactObject(
} catch (const std::exception& error) {
PARSE_ERROR(context, "Invalid 'InitialGridPoints': " << error.what());
}
}

BinaryCompactObject::BinaryCompactObject(
std::optional<bco::TimeDependentMapOptions<false>> time_dependent_options,
typename ObjectA::type object_A, typename ObjectB::type object_B,
double envelope_radius, double outer_radius,
const typename InitialRefinement::type& initial_refinement,
const typename InitialGridPoints::type& initial_number_of_grid_points,
const bool use_equiangular_map,
const CoordinateMaps::Distribution radial_distribution_envelope,
const CoordinateMaps::Distribution radial_distribution_outer_shell,
const double opening_angle_in_degrees,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
outer_boundary_condition,
const Options::Context& context)
: BinaryCompactObject(
std::move(object_A), std::move(object_B), envelope_radius,
outer_radius, initial_refinement, initial_number_of_grid_points,
use_equiangular_map, radial_distribution_envelope,
radial_distribution_outer_shell, opening_angle_in_degrees,
std::move(outer_boundary_condition), context) {
time_dependent_options_ = std::move(time_dependent_options);

// Build time-dependent maps
std::optional<std::array<double, 3>> radii_A{};
std::optional<std::array<double, 3>> radii_B{};

Expand Down
51 changes: 6 additions & 45 deletions src/Domain/Creators/BinaryCompactObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,7 @@ namespace creators {
* testing of methods only coded on cartesian grids.
*
* \par Time dependence:
* When using this domain, the metavariables struct can contain a struct named
* `domain` that conforms to `domain::protocols::Metavariables`. If
* `domain::enable_time_dependent_maps` is either set to `false` or not
* specified in the metavariables, then this domain will be time-independent. If
* `domain::enable_time_dependent_maps` is set to `true`, then this domain also
* includes a time-dependent map, along with additional options (and a
* corresponding constructor) for initializing the time-dependent map. These
* options include the `InitialTime` which specifies the initial time for the
* FunctionsOfTime controlling the map. The following time-dependent maps are
* applied:
* The following time-dependent maps are applied:
*
* - A `CubicScale` expansion and a `Rotation` applied to all blocks from the
* Grid to the Inertial frame. However, if there is a size map in the block
Expand Down Expand Up @@ -402,11 +393,11 @@ class BinaryCompactObject : public DomainCreator<3> {
};

template <typename Metavariables>
using time_independent_options = tmpl::append<
using options = tmpl::append<
tmpl::list<ObjectA, ObjectB, EnvelopeRadius, OuterRadius,
InitialRefinement, InitialGridPoints, UseEquiangularMap,
RadialDistributionEnvelope, RadialDistributionOuterShell,
OpeningAngle>,
OpeningAngle, TimeDependentMaps>,
tmpl::conditional_t<
domain::BoundaryConditions::has_boundary_conditions_base_v<
typename Metavariables::system>,
Expand All @@ -415,13 +406,6 @@ class BinaryCompactObject : public DomainCreator<3> {
typename Metavariables::system>>>,
tmpl::list<>>>;

template <typename Metavariables>
using options = tmpl::conditional_t<
domain::creators::bco::enable_time_dependent_maps_v<Metavariables>,
tmpl::push_front<time_independent_options<Metavariables>,
TimeDependentMaps>,
time_independent_options<Metavariables>>;

static constexpr Options::String help{
"A general domain for two compact objects. Each object is represented by "
"a cube along the x-axis. Object A is located on the right and Object B "
Expand All @@ -443,36 +427,11 @@ class BinaryCompactObject : public DomainCreator<3> {
"refinement in [polar, azimuthal, radial] direction\n"
" - A list, with [polar, azimuthal, radial] refinement for each block\n"
"\n"
"If time-dependent maps are enabled, the domain can rotate around the "
"The domain can rotate around the "
"z-axis and expand/compress radially. The two objects can each have a "
"spherical distortion (shape map)."};

// Constructor for time-independent version of the domain
// (i.e., for when
// Metavariables::domain::enable_time_dependent_maps == false or
// when the metavariables do not define
// Metavariables::domain::enable_time_dependent_maps)
BinaryCompactObject(
typename ObjectA::type object_A, typename ObjectB::type object_B,
double envelope_radius, double outer_radius,
const typename InitialRefinement::type& initial_refinement,
const typename InitialGridPoints::type& initial_number_of_grid_points,
bool use_equiangular_map = true,
CoordinateMaps::Distribution radial_distribution_envelope =
CoordinateMaps::Distribution::Projective,
CoordinateMaps::Distribution radial_distribution_outer_shell =
CoordinateMaps::Distribution::Linear,
double opening_angle_in_degrees = 90.0,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
outer_boundary_condition = nullptr,
const Options::Context& context = {});

// Constructor for time-dependent version of the domain
// (i.e., for when
// Metavariables::domain::enable_time_dependent_maps == true),
// with an additional parameter
BinaryCompactObject(
std::optional<bco::TimeDependentMapOptions<false>> time_dependent_options,
typename ObjectA::type object_A, typename ObjectB::type object_B,
double envelope_radius, double outer_radius,
const typename InitialRefinement::type& initial_refinement,
Expand All @@ -483,6 +442,8 @@ class BinaryCompactObject : public DomainCreator<3> {
CoordinateMaps::Distribution radial_distribution_outer_shell =
CoordinateMaps::Distribution::Linear,
double opening_angle_in_degrees = 90.0,
std::optional<bco::TimeDependentMapOptions<false>>
time_dependent_options = std::nullopt,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
outer_boundary_condition = nullptr,
const Options::Context& context = {});
Expand Down
14 changes: 0 additions & 14 deletions src/Domain/Creators/BinaryCompactObjectHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ struct Inertial;
/// Namespace used to hold things used in both the BinaryCompactObject and
/// CylindricalBinaryCompactObject domain creators.
namespace domain::creators::bco {
// If `Metavariables` has a `domain` member struct and
// `domain::enable_time_dependent_maps` is `true`, then
// inherit from `std::true_type`; otherwise, inherit from `std::false_type`.
template <typename Metavariables, typename = std::void_t<>>
struct enable_time_dependent_maps : std::false_type {};

template <typename Metavariables>
struct enable_time_dependent_maps<Metavariables,
std::void_t<typename Metavariables::domain>>
: std::bool_constant<Metavariables::domain::enable_time_dependent_maps> {};

template <typename Metavariables>
constexpr bool enable_time_dependent_maps_v =
enable_time_dependent_maps<Metavariables>::value;

/*!
* \brief Create a set of centers of objects for the binary domains.
Expand Down
27 changes: 4 additions & 23 deletions src/Domain/Creators/CylindricalBinaryCompactObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ CylindricalBinaryCompactObject::CylindricalBinaryCompactObject(
bool use_equiangular_map,
const typename InitialRefinement::type& initial_refinement,
const typename InitialGridPoints::type& initial_grid_points,
std::optional<bco::TimeDependentMapOptions<true>> time_dependent_options,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
inner_boundary_condition,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
Expand All @@ -77,7 +78,8 @@ CylindricalBinaryCompactObject::CylindricalBinaryCompactObject(
outer_radius_(outer_radius),
use_equiangular_map_(use_equiangular_map),
inner_boundary_condition_(std::move(inner_boundary_condition)),
outer_boundary_condition_(std::move(outer_boundary_condition)) {
outer_boundary_condition_(std::move(outer_boundary_condition)),
time_dependent_options_(std::move(time_dependent_options)) {
if (center_A_[2] <= 0.0) {
PARSE_ERROR(
context,
Expand Down Expand Up @@ -384,29 +386,8 @@ CylindricalBinaryCompactObject::CylindricalBinaryCompactObject(
swap_refinement_and_grid_points_xi_zeta(current_block++);
}
}
}

CylindricalBinaryCompactObject::CylindricalBinaryCompactObject(
std::optional<bco::TimeDependentMapOptions<true>> time_dependent_options,
std::array<double, 3> center_A, std::array<double, 3> center_B,
double radius_A, double radius_B, bool include_inner_sphere_A,
bool include_inner_sphere_B, bool include_outer_sphere, double outer_radius,
bool use_equiangular_map,
const typename InitialRefinement::type& initial_refinement,
const typename InitialGridPoints::type& initial_grid_points,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
inner_boundary_condition,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
outer_boundary_condition,
const Options::Context& context)
: CylindricalBinaryCompactObject(
center_A, center_B, radius_A, radius_B, include_inner_sphere_A,
include_inner_sphere_B, include_outer_sphere, outer_radius,
use_equiangular_map, initial_refinement, initial_grid_points,
std::move(inner_boundary_condition),
std::move(outer_boundary_condition), context) {
time_dependent_options_ = std::move(time_dependent_options);

// Build time-dependent maps
// The size map, which is applied from the grid to distorted frame, currently
// needs to start and stop at certain radii around each excision. If the inner
// spheres aren't included, the outer radii would have to be in the middle of
Expand Down
53 changes: 17 additions & 36 deletions src/Domain/Creators/CylindricalBinaryCompactObject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,30 +287,23 @@ class CylindricalBinaryCompactObject : public DomainCreator<3> {
bco::TimeDependentMapOptions<true>::help;
};

using time_independent_options =
template <typename Metavariables>
using options = tmpl::append<
tmpl::list<CenterA, CenterB, RadiusA, RadiusB, IncludeInnerSphereA,
IncludeInnerSphereB, IncludeOuterSphere, OuterRadius,
UseEquiangularMap, InitialRefinement, InitialGridPoints>;

template <typename Metavariables>
using basic_options = tmpl::conditional_t<
domain::creators::bco::enable_time_dependent_maps_v<Metavariables>,
tmpl::push_front<time_independent_options, TimeDependentMaps>,
time_independent_options>;

template <typename Metavariables>
using options = tmpl::conditional_t<
domain::BoundaryConditions::has_boundary_conditions_base_v<
typename Metavariables::system>,
tmpl::push_back<
basic_options<Metavariables>,
InnerBoundaryCondition<
domain::BoundaryConditions::get_boundary_conditions_base<
typename Metavariables::system>>,
OuterBoundaryCondition<
domain::BoundaryConditions::get_boundary_conditions_base<
typename Metavariables::system>>>,
basic_options<Metavariables>>;
UseEquiangularMap, InitialRefinement, InitialGridPoints,
TimeDependentMaps>,
tmpl::conditional_t<
domain::BoundaryConditions::has_boundary_conditions_base_v<
typename Metavariables::system>,
tmpl::list<
InnerBoundaryCondition<
domain::BoundaryConditions::get_boundary_conditions_base<
typename Metavariables::system>>,
OuterBoundaryCondition<
domain::BoundaryConditions::get_boundary_conditions_base<
typename Metavariables::system>>>,
tmpl::list<>>>;

static constexpr Options::String help{
"The CylindricalBinaryCompactObject domain is a general domain for "
Expand All @@ -325,20 +318,8 @@ class CylindricalBinaryCompactObject : public DomainCreator<3> {
double outer_radius, bool use_equiangular_map,
const typename InitialRefinement::type& initial_refinement,
const typename InitialGridPoints::type& initial_grid_points,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
inner_boundary_condition = nullptr,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
outer_boundary_condition = nullptr,
const Options::Context& context = {});

CylindricalBinaryCompactObject(
std::optional<bco::TimeDependentMapOptions<true>> time_dependent_options,
std::array<double, 3> center_A, std::array<double, 3> center_B,
double radius_A, double radius_B, bool include_inner_sphere_A,
bool include_inner_sphere_B, bool include_outer_sphere,
double outer_radius, bool use_equiangular_map,
const typename InitialRefinement::type& initial_refinement,
const typename InitialGridPoints::type& initial_grid_points,
std::optional<bco::TimeDependentMapOptions<true>> time_dependent_options =
std::nullopt,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
inner_boundary_condition = nullptr,
std::unique_ptr<domain::BoundaryConditions::BoundaryCondition>
Expand Down
11 changes: 0 additions & 11 deletions src/Domain/Protocols/CMakeLists.txt

This file was deleted.

37 changes: 0 additions & 37 deletions src/Domain/Protocols/Metavariables.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Xcts::BoundaryConditions {
* \\
* \label{eq:ah_beta}
* \beta_\mathrm{excess}^i &= \frac{\alpha}{\psi^2}\bar{s}^i
* + \epsilon_{ijk}\Omega^j x^k
* + \epsilon_{ijk}\Omega^j x^k - \beta_\mathrm{background}^i
* \f}
*
* following section 7.2 of \cite Pfeiffer2005zm, section 12.3.2 of
Expand Down
Loading
Loading