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

Add tags used to smoothly turn on the self force #6273

Merged
merged 1 commit into from
Sep 24, 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
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ struct EvolutionMetavars {
CurvedScalarWave::Worldtube::Tags::ExcisionSphere<volume_dim>,
CurvedScalarWave::Worldtube::Tags::ExpansionOrder,
CurvedScalarWave::Worldtube::Tags::Charge,
CurvedScalarWave::Worldtube::Tags::SelfForceTurnOnTime,
CurvedScalarWave::Worldtube::Tags::SelfForceTurnOnInterval,
CurvedScalarWave::Worldtube::Tags::Mass,
CurvedScalarWave::Worldtube::Tags::MaxIterations,
CurvedScalarWave::Worldtube::Tags::ObserveCoefficientsTrigger>;
Expand Down
12 changes: 10 additions & 2 deletions src/Evolution/Systems/CurvedScalarWave/Worldtube/Tags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@

namespace CurvedScalarWave::Worldtube::OptionTags {
SelfForceOptions::SelfForceOptions() = default;
SelfForceOptions::SelfForceOptions(double mass_in, size_t iterations_in)
: mass(mass_in), iterations(iterations_in) {}
SelfForceOptions::SelfForceOptions(const double mass_in,
const size_t iterations_in,
const double turn_on_time_in,
const double turn_on_interval_in)
: mass(mass_in),
iterations(iterations_in),
turn_on_time(turn_on_time_in),
turn_on_interval(turn_on_interval_in) {}
knelli2 marked this conversation as resolved.
Show resolved Hide resolved

void SelfForceOptions::pup(PUP::er& p) {
p | mass;
p | iterations;
p | turn_on_time;
p | turn_on_interval;
}
} // namespace CurvedScalarWave::Worldtube::OptionTags

Expand Down
78 changes: 76 additions & 2 deletions src/Evolution/Systems/CurvedScalarWave/Worldtube/Tags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ struct Charge {
/*!
* \brief Options for the scalar self-force. Select `None` for a purely geodesic
* evolution
*
*\details The self force is turned on using the smooth transition function
*
* \begin{equation}
* w(t) = 1 - \exp{ \left(- \left(\frac{t - t_1}{\sigma} \right)^4 \right)}.
* \end{equation}
*
* The turn on time is given by \f$t_1\f$ and the turn on interval is given by
*\f$sigma\f$.
*/
struct SelfForceOptions {
static constexpr Options::String help = {
Expand All @@ -92,14 +101,33 @@ struct SelfForceOptions {
"acceleration."};
static size_t lower_bound() { return 1; }
};

struct TurnOnTime {
using type = double;
static constexpr Options::String help{
"The time at which the scalar self force is turned on."};
static double lower_bound() { return 0.; }
};

struct TurnOnInterval {
using type = double;
static constexpr Options::String help{
"The interval over which the scalar self force is smoothly turned on. "
"We require a minimum of 1 M for the interval."};
static double lower_bound() { return 1.; }
};

SelfForceOptions();
SelfForceOptions(double mass_in, size_t iterations_in);
SelfForceOptions(double mass_in, size_t iterations_in, double turn_on_time_in,
double turn_on_interval_in);
void pup(PUP::er& p);

using options = tmpl::list<Mass, Iterations>;
using options = tmpl::list<Mass, Iterations, TurnOnTime, TurnOnInterval>;

double mass{};
size_t iterations{};
double turn_on_time{};
double turn_on_interval{};
};

/*!
Expand Down Expand Up @@ -251,6 +279,52 @@ struct Charge : db::SimpleTag {
static double create_from_options(const double charge) { return charge; };
};

/*!
* \brief The time at which the self-force is smoothly turned on.
*
* \details The self force is turned on using the smooth transition function
*
* \begin{equation}
* w(t) = 1 - \exp{ \left(- \left(\frac{t - t_1}{\sigma} \right)^4 \right)}.
* \end{equation}
*
* The turn on time is given by \f$t_1\f$.
*/
struct SelfForceTurnOnTime : db::SimpleTag {
using type = std::optional<double>;
using option_tags = tmpl::list<OptionTags::SelfForceOptions>;
static constexpr bool pass_metavariables = false;
static std::optional<double> create_from_options(
const std::optional<OptionTags::SelfForceOptions>& self_force_options) {
return self_force_options.has_value()
? std::make_optional(self_force_options->turn_on_time)
: std::nullopt;
};
};

/*!
* \brief The interval over which the self-force is smoothly turned on.
*
* \details The self force is turned on using the smooth transition function
*
* \begin{equation}
* w(t) = 1 - \exp{ \left(- \left(\frac{t - t_1}{\sigma} \right)^4 \right)}.
* \end{equation}
*
* The turn on interval is given by \f$\sigma\f$.
*/
struct SelfForceTurnOnInterval : db::SimpleTag {
using type = std::optional<double>;
using option_tags = tmpl::list<OptionTags::SelfForceOptions>;
static constexpr bool pass_metavariables = false;
static std::optional<double> create_from_options(
const std::optional<OptionTags::SelfForceOptions>& self_force_options) {
return self_force_options.has_value()
? std::make_optional(self_force_options->turn_on_interval)
: std::nullopt;
};
};

/*!
* \brief The mass of the scalar charge. Only has a value if the scalar self
* force is applied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,13 @@ void test_check_input_file() {
void test_self_force_options() {
const auto options = TestHelpers::test_creation<OptionTags::SelfForceOptions>(
"Mass: 0.1\n"
"Iterations: 3");
"Iterations: 3\n"
"TurnOnTime: 1234.\n"
"TurnOnInterval: 987.");
CHECK(options.mass == 0.1);
CHECK(options.iterations == 3);
CHECK(options.turn_on_time == 1234.);
CHECK(options.turn_on_interval == 987.);
}

} // namespace
Expand All @@ -704,6 +708,12 @@ SPECTRE_TEST_CASE("Unit.Evolution.Systems.CurvedScalarWave.Worldtube.Tags",
"Charge");
TestHelpers::db::test_simple_tag<CurvedScalarWave::Worldtube::Tags::Mass>(
"Mass");
TestHelpers::db::test_simple_tag<
CurvedScalarWave::Worldtube::Tags::SelfForceTurnOnTime>(
"SelfForceTurnOnTime");
TestHelpers::db::test_simple_tag<
CurvedScalarWave::Worldtube::Tags::SelfForceTurnOnInterval>(
"SelfForceTurnOnInterval");
TestHelpers::db::test_simple_tag<
CurvedScalarWave::Worldtube::Tags::MaxIterations>("MaxIterations");
TestHelpers::db::test_simple_tag<
Expand Down
Loading