-
Notifications
You must be signed in to change notification settings - Fork 192
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 BNS initial data executable and SpEC initial Data #6422
base: develop
Are you sure you want to change the base?
Add BNS initial data executable and SpEC initial Data #6422
Conversation
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.
I found a few potential bugs in the fixed sources that might explain the deviations from SpEC that you see.
Please add a test input file that has the Check: parse
line so the executable gets compiled on CI.
Also, it would be nice to add a test for the SpecData
that's similar to tests/Unit/PointwiseFunctions/AnalyticData/GrMhd/Test_FukaInitialData.cpp
in that you can supply SpEC sample data as an environment variable, and then it checks that the data fulfills the equations (see verify_solution
from tests/Unit/Helpers/PointwiseFunctions/AnalyticSolutions/FirstOrderEllipticSolutionsTestHelpers.hpp
for an example).
static constexpr Options::String help{ | ||
"Find the solution for the velocity potential of" | ||
"an irrotational BNS system using fixed" | ||
"problem on fixed space-time and with a fixed" |
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.
Missing space at the beginning or end of each line. Also, this sentence seems a little off, maybe delete "using fixed problem".
@@ -76,6 +77,7 @@ struct FirstOrderSystem | |||
::Tags::Flux<velocity_potential, tmpl::size_t<3>, Frame::Inertial>>; | |||
|
|||
using background_fields = tmpl::list< | |||
hydro::Tags::RestMassDensity<DataVector>, |
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.
where is this used?
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.
It's been used diagnostically, since otherwise we can't write out the density along with the rest of the data.
|
||
#include "PointwiseFunctions/AnalyticData/BnsInitialData/SpecInitialData.hpp" | ||
namespace BnsInitialData::InitialData { | ||
using all_initial_data = tmpl::list<TovStar, SpecInitialData<1>>; |
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.
Where do you get the TovStar
from? The TOV solution is just the trivial
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.
I'm just going to delete the TOV star, it's not useful anymore now that we have SpEC data
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.
Ope sorry forgot I already deleted it, needed to do some cleanup apparently
#pragma once | ||
|
||
#include "PointwiseFunctions/AnalyticData/BnsInitialData/SpecInitialData.hpp" | ||
namespace BnsInitialData::InitialData { |
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.
name this namespace AnalyticData
please for consistency with the other systems
|
||
#include "PointwiseFunctions/AnalyticData/BnsInitialData/SpecInitialData.hpp" | ||
namespace BnsInitialData::InitialData { | ||
using all_initial_data = tmpl::list<TovStar, SpecInitialData<1>>; |
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.
and name this all_analytic_data
data_directory_ = rhs.data_directory_; | ||
equation_of_state_ = rhs.equation_of_state_->get_clone(); | ||
density_cutoff_ = rhs.density_cutoff_; | ||
orbital_angular_velocity_ = rhs.orbital_angular_velocity_; | ||
euler_enthalpy_constant_ = rhs.euler_enthalpy_constant_; | ||
spec_exporter_ = | ||
std::make_unique<spec::Exporter>(sys::procs_on_node(sys::my_node()), | ||
data_directory_, vars_to_interpolate_); |
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.
Replace with:
*this = rhs;
* constant read from the input file. | ||
*/ | ||
template <size_t ThermodynamicDim> | ||
class SpecInitialData : public elliptic::analytic_data::Background, |
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.
Name this maybe just SpecData
* | ||
* This class loads numerical data written out by the SpEC initial data solver. | ||
* It uses the `spec::Exporter` linked in from SpEC to interpolate to arbitrary | ||
* grid points. The coordinates are assumed to be in SpEC's "grid" frame. |
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.
We should check if SpEC's grid frame is the one that is deformed to the surface of the star
} | ||
// The velocity potential is used in the initial guess | ||
template <typename DataType> | ||
tuples::TaggedTuple<Tags::VelocityPotential<DataType>> variables( |
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.
Move the definition of these variables
functions to the cpp file. You can also remove the templating on DataType
and just use DataVector
(if you want).
@@ -116,10 +116,9 @@ void spatial_rotational_killing_vector( | |||
const Scalar<DataType>& sqrt_det_spatial_metric) { |
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.
remove unused argument
step_function(get(rest_mass_density) - 0.0), | ||
get(equation_of_state_->pressure_from_density(rest_mass_density)) / | ||
get(rest_mass_density) + | ||
*(1.0 + |
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.
This *
seems off
background_values), | ||
get<gr::Tags::InverseSpatialMetric<DataVector, 3>>(background_values), | ||
velocity_profile); | ||
const auto flux_gradient = partial_derivative(flux, mesh, inv_jacobian); |
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.
Use divergence()
make_not_null( | ||
&get<::Tags::FixedSource<Tags::VelocityPotential<DataType>>>( | ||
result)), | ||
euler_enthalpy_constant_ * |
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.
Overall minus sign is missing
1.0 / square(lapse()) * deriv_of_shift(ti::i, ti::I) + | ||
// Christoffel terms | ||
1.0 / square(lapse()) * | ||
(rotational_shift(ti::I) * |
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.
this should only be the shift
const auto deriv_log_lapse_times_density_over_specific_enthalpy = | ||
partial_derivative( | ||
Scalar<DataType>{ | ||
get(get<gr::Tags::Lapse<DataType>>(interpolated_vars)) * |
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.
Add log
1.0 / square(lapse()) * | ||
(rotational_shift(ti::I) * | ||
spatial_christoffel_second_kind_contracted(ti::i) - | ||
divergence_spatial_rotational_killing_vector()))); |
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.
delete this divergence because it should be zero
density_cutoff_(density_cutoff), | ||
orbital_angular_velocity_(orbital_angular_velocity), | ||
euler_enthalpy_constant_(euler_enthalpy_constant), | ||
spec_exporter_(std::make_unique<spec::Exporter>(1, data_directory_, |
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.
Hmm @nilsvu, it seems that if this is set to 1 then my test runs, but the executable gives some weird runtime error and if it's set to sys::props_on_node(sys::my_node())
then the test segfaults but the executable runs no problem
Proposed changes
Add an elliptic executable to solve for the velocity potential of a BNS system for use in initial data to evolutions. Additionally add SpEC analytic data for initializing a spacetime/matter distribution for the velocity potential solve.
Upgrade instructions
Code review checklist
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
bugfix
ornew feature
if appropriate.Further comments