Skip to content

Commit

Permalink
Merge pull request #6386 from hen-w/modified_gauge_plane_wave
Browse files Browse the repository at this point in the history
Change the GaugePlaneWave implementations for SO-CCZ4 in development.
  • Loading branch information
nilsdeppe authored Dec 10, 2024
2 parents 047f514 + 45e01fd commit 4051845
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ GaugePlaneWave<Dim>::GaugePlaneWave(CkMigrateMessage* /*msg*/) {}

template <size_t Dim>
GaugePlaneWave<Dim>::GaugePlaneWave(
std::array<double, Dim> wave_vector,
const std::array<double, Dim>& wave_vector,
std::unique_ptr<MathFunction<1, Frame::Inertial>> profile)
: wave_vector_(std::move(wave_vector)),
: wave_vector_(wave_vector),
profile_(std::move(profile)),
omega_(magnitude(wave_vector_)) {}

Expand Down Expand Up @@ -64,6 +64,7 @@ GaugePlaneWave<Dim>::IntermediateVars<DataType>::IntermediateVars(
}
h = profile->operator()(u);
du_h = profile->first_deriv(u);
du_du_h = profile->second_deriv(u);
det_gamma = 1.0 + h * square(omega);
lapse = 1.0 / sqrt(det_gamma);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ namespace gr::Solutions {
template <size_t Dim>
class GaugePlaneWave : public AnalyticSolution<Dim>,
public MarkAsAnalyticSolution {
template <typename DataType>
struct IntermediateVars;

public:
static constexpr size_t volume_dim = Dim;
struct WaveVector {
Expand All @@ -112,7 +109,7 @@ class GaugePlaneWave : public AnalyticSolution<Dim>,
static constexpr Options::String help{"Gauge plane wave in flat spacetime"};

GaugePlaneWave() = default;
GaugePlaneWave(std::array<double, Dim> wave_vector,
GaugePlaneWave(const std::array<double, Dim>& wave_vector,
std::unique_ptr<MathFunction<1, Frame::Inertial>> profile);
GaugePlaneWave(const GaugePlaneWave&);
GaugePlaneWave& operator=(const GaugePlaneWave&);
Expand All @@ -133,6 +130,20 @@ class GaugePlaneWave : public AnalyticSolution<Dim>,
::Tags::deriv<gr::Tags::SpatialMetric<DataType, volume_dim>,
tmpl::size_t<volume_dim>, Frame::Inertial>;

template <typename DataType>
struct IntermediateVars {
IntermediateVars(
const std::array<double, Dim>& wave_vector,
const std::unique_ptr<MathFunction<1, Frame::Inertial>>& profile,
double omega, const tnsr::I<DataType, volume_dim, Frame::Inertial>& x,
double t);
DataType h{};
DataType du_h{};
DataType du_du_h{};
DataType det_gamma{};
DataType lapse{};
};

template <typename DataType, typename... Tags>
tuples::TaggedTuple<Tags...> variables(
const tnsr::I<DataType, volume_dim, Frame::Inertial>& x, double t,
Expand All @@ -148,11 +159,13 @@ class GaugePlaneWave : public AnalyticSolution<Dim>,
const IntermediateVars<DataType>& vars,
tmpl::list<Tags...> /*meta*/) const {
static_assert(sizeof...(Tags) > 1,
"Unrecognized tag requested. See the function parameters "
"Unrecognized tag requested. See the function parameters "
"for the tag.");
return {get<Tags>(variables(x, t, vars, tmpl::list<Tags>{}))...};
}

std::array<double, Dim> get_wave_vector() const { return wave_vector_; }

// NOLINTNEXTLINE(google-runtime-references)
void pup(PUP::er& p);

Expand Down Expand Up @@ -239,19 +252,6 @@ class GaugePlaneWave : public AnalyticSolution<Dim>,
const -> tuples::TaggedTuple<
gr::Tags::InverseSpatialMetric<DataType, volume_dim>>;

template <typename DataType>
struct IntermediateVars {
IntermediateVars(
const std::array<double, Dim>& wave_vector,
const std::unique_ptr<MathFunction<1, Frame::Inertial>>& profile,
double omega, const tnsr::I<DataType, volume_dim, Frame::Inertial>& x,
double t);
DataType h{};
DataType du_h{};
DataType det_gamma{};
DataType lapse{};
};

template <size_t LocalDim>
// NOLINTNEXTLINE(readability-redundant-declaration)
friend bool operator==(const GaugePlaneWave<LocalDim>& lhs,
Expand Down

0 comments on commit 4051845

Please sign in to comment.