-
Notifications
You must be signed in to change notification settings - Fork 191
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 perturbation option to MagnetizedTovStar #6016
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,16 +38,19 @@ MagnetizedTovStar::MagnetizedTovStar( | |
const RelativisticEuler::Solutions::TovCoordinates coordinate_system, | ||
std::vector<std::unique_ptr< | ||
grmhd::AnalyticData::InitialMagneticFields::InitialMagneticField>> | ||
magnetic_fields) | ||
magnetic_fields, | ||
const double perturbation) | ||
: tov_star(central_rest_mass_density, std::move(equation_of_state), | ||
coordinate_system), | ||
magnetic_fields_(std::move(magnetic_fields)) {} | ||
magnetic_fields_(std::move(magnetic_fields)), | ||
perturbation_(perturbation) {} | ||
|
||
MagnetizedTovStar::MagnetizedTovStar(const MagnetizedTovStar& rhs) | ||
: evolution::initial_data::InitialData{rhs}, | ||
RelativisticEuler::Solutions::TovStar( | ||
static_cast<const RelativisticEuler::Solutions::TovStar&>(rhs)), | ||
magnetic_fields_(clone_unique_ptrs(rhs.magnetic_fields_)) {} | ||
magnetic_fields_(clone_unique_ptrs(rhs.magnetic_fields_)), | ||
perturbation_(rhs.perturbation_) {} | ||
|
||
MagnetizedTovStar& MagnetizedTovStar::operator=(const MagnetizedTovStar& rhs) { | ||
if (this == &rhs) { | ||
|
@@ -56,6 +59,7 @@ MagnetizedTovStar& MagnetizedTovStar::operator=(const MagnetizedTovStar& rhs) { | |
static_cast<RelativisticEuler::Solutions::TovStar&>(*this) = | ||
static_cast<const RelativisticEuler::Solutions::TovStar&>(rhs); | ||
magnetic_fields_ = clone_unique_ptrs(rhs.magnetic_fields_); | ||
perturbation_ = rhs.perturbation_; | ||
return *this; | ||
} | ||
|
||
|
@@ -69,6 +73,7 @@ MagnetizedTovStar::MagnetizedTovStar(CkMigrateMessage* msg) : tov_star(msg) {} | |
void MagnetizedTovStar::pup(PUP::er& p) { | ||
tov_star::pup(p); | ||
p | magnetic_fields_; | ||
p | perturbation_; | ||
} | ||
|
||
namespace magnetized_tov_detail { | ||
|
@@ -94,6 +99,31 @@ void MagnetizedTovVariables<DataType, Region>::operator()( | |
sqrt_det_spatial_metric, deriv_pressure); | ||
} | ||
} | ||
|
||
template <typename DataType, StarRegion Region> | ||
void MagnetizedTovVariables<DataType, Region>::operator()( | ||
const gsl::not_null<tnsr::I<DataType, 3>*> spatial_velocity, | ||
[[maybe_unused]] const gsl::not_null<Cache*> cache, | ||
hydro::Tags::SpatialVelocity<DataType, 3> /*meta*/) const { | ||
if constexpr (Region == StarRegion::Center or | ||
Region == StarRegion::Exterior) { | ||
get<0>(*spatial_velocity) = 0.; | ||
get<1>(*spatial_velocity) = 0.; | ||
get<2>(*spatial_velocity) = 0.; | ||
} else { | ||
const auto& areal_radius = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I'm a bit worried about the normalization here. I think probably the number that gets passed in should be the norm of the spatial velocity. |
||
radial_solution.coordinate_system() == | ||
RelativisticEuler::Solutions::TovCoordinates::Isotropic | ||
? get(cache->get_var( | ||
*this, | ||
RelativisticEuler::Solutions::tov_detail::Tags::ArealRadius< | ||
DataType>{})) | ||
: radius; | ||
get<0>(*spatial_velocity) = perturbation * coords.get(0) / areal_radius; | ||
get<1>(*spatial_velocity) = perturbation * coords.get(1) / areal_radius; | ||
get<2>(*spatial_velocity) = perturbation * coords.get(2) / areal_radius; | ||
} | ||
} | ||
Comment on lines
+103
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's where the perturbation is actually applied. |
||
} // namespace magnetized_tov_detail | ||
|
||
PUP::able::PUP_ID MagnetizedTovStar::my_PUP_ID = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,7 +215,7 @@ struct TovVariables { | |
void operator()(gsl::not_null<Scalar<DataType>*> lorentz_factor, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this also needs to be modified, right now I'm pretty sure it's being used to compute prim2con here , because initialization is just using the primitive variables tag list here, which points to this. I would love to be wrong about this though, because we don't really need the Lorentz factor if we have the spatial velocity and the spatial metric. |
||
gsl::not_null<Cache*> cache, | ||
hydro::Tags::LorentzFactor<DataType> /*meta*/) const; | ||
void operator()(gsl::not_null<tnsr::I<DataType, 3>*> spatial_velocity, | ||
virtual void operator()(gsl::not_null<tnsr::I<DataType, 3>*> spatial_velocity, | ||
gsl::not_null<Cache*> cache, | ||
hydro::Tags::SpatialVelocity<DataType, 3> /*meta*/) const; | ||
virtual void operator()( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a more specific name, like
radial_velocity_perturbation
?