-
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 IrrotationalBNS Pointwise Functions #5880
Add IrrotationalBNS Pointwise Functions #5880
Conversation
d21f030
to
cec617b
Compare
#include <cmath> | ||
#include <cstddef> | ||
|
||
#include "DataStructures/DataVector.hpp" | ||
#include "DataStructures/Tensor/Tensor.hpp" | ||
#include "PointwiseFunctions/GeneralRelativity/Lapse.hpp" | ||
#include "PointwiseFunctions/GeneralRelativity/Shift.hpp" | ||
|
||
#include "Utilities/Gsl.hpp" |
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.
#include "DataStructures/Tensor/TypeAliases.hpp"
#include "Utilities/Gsl.hpp"
I don't think you need anything else.
#include "PointwiseFunctions/GeneralRelativity/Lapse.hpp" | ||
#include "PointwiseFunctions/GeneralRelativity/Shift.hpp" |
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 these two.
namespace hydro::initial_data { | ||
|
||
template <typename DataType> | ||
void rotational_shift( |
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.
These all need documentation.
Probably also worth adding an irrotational_bns
namespace or something similar.
const Scalar<DataType>& local_angular_velocity_around_z, | ||
const Scalar<DataType>& sqrt_det_spatial_metric) { | ||
// Cross product involves volume element in arbitrary coordinates | ||
result->get(0) = -get(sqrt_det_spatial_metric) * get<1>(x) * |
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.
get<0>(*result)
and again below.
get(local_angular_velocity_around_z); | ||
result->get(1) = get(sqrt_det_spatial_metric) * get<0>(x) * | ||
get(local_angular_velocity_around_z); | ||
result->get(2) = make_with_value<DataType>(sqrt_det_spatial_metric, 0.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.
For this function, use set_number_of_grid_points(result, sqrt_det_spatial_metric)
(from Utilities/SetNumberOfGridPoints.hpp
) at the start of the function and just assign a plain 0.0
to this component. Using make_with_value
does an extra memory allocation and could break things if result
was part of a Variables (and was therefore non-owning). For most of the other functions the tenex code will handle the resizing.
const tnsr::I<DataType, 3>& x, | ||
const Scalar<DataType>& /*local_angular_velocity_around_z*/, | ||
const Scalar<DataType>& /*sqrt_det_spatial_metric*/) { | ||
*result = make_with_value<tnsr::iJ<DataType, 3>>(get<0>(x), 0.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.
Again, set_number_of_grid_points(result, x)
and then = 0.0
.
@@ -0,0 +1,28 @@ | |||
# Distributed under the MIT License. | |||
# See LICENSE.txt for details. | |||
set(LIBRARY "Test_HydroInitialData") |
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.
Fix the formatting in this file.
) / lapse - np.outer(deriv_of_lapse / lapse**2, rotational_shift) | ||
|
||
|
||
def divergence_rotational_shift_stress( |
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.
The c++ part of the test for this function is missing.
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.
Oh that function was removed because it became unnecessary, I'll remove it from the python functions, and from the IrrotationalBns.cpp
file
CoordinateMaps | ||
DataStructures | ||
DataStructuresHelpers | ||
Domain | ||
GeneralRelativity | ||
GeneralRelativityHelpers | ||
Hydro | ||
HydroHelpers | ||
LinearOperators | ||
Spectral | ||
IO | ||
Utilities |
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.
Fix this list.
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.
Not compiling.
@@ -172,7 +142,8 @@ void derivative_spatial_rotational_killing_vector( | |||
const tnsr::I<DataType, 3>& x, | |||
const Scalar<DataType>& /*local_angular_velocity_around_z*/, | |||
const Scalar<DataType>& /*sqrt_det_spatial_metric*/) { | |||
*result = make_with_value<tnsr::iJ<DataType, 3>>(get<0>(x), 0.0); | |||
set_number_of_grid_points(result, x); | |||
tenex::update<ti::i, ti::J>(result, 0.0 * (*result)(ti::i, ti::J)); |
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.
The values in result
may be uninintialized or NaN, so you can't multiply by them. I don't know if we have a standard way to zero a Tensor, but std::fill(result->begin(), result->end(), 0.0)
should work.
/*! | ||
* \ingroup HydroInitialDataGroup | ||
* \brief Items related to solving for irrotational bns initial data | ||
* See e.g. Baumgarte and Shapiro, Ch. 15 (P. 523) |
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.
\cite BaumgarteShapiro
(It's already in our references file.)
template <typename DataType> | ||
void rotational_shift( | ||
gsl::not_null<tnsr::I<DataType, 3>*> result, | ||
const tnsr::I<DataType, 3>& shift, | ||
const tnsr::I<DataType, 3>& 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.
Move after the second overload.
/// h^2 \rho^2 = \frac{1}{\alpha^2} \left(C + B^i D_i \Phi\right)^2 - D_i | ||
/// \Phi D^i \Phi | ||
/// \f] | ||
/// Where \f$\Phi \f$ is the velocity potential, andC is the Euler-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.
Typo "andC" -> "and \f$C\f$"
/// | ||
/// The eqn. is identical to B&S 15.76 | ||
/// \f[ | ||
/// h^2 \rho^2 = \frac{1}{\alpha^2} \left(C + B^i D_i \Phi\right)^2 - D_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.
Something is confusing doxygen around here, but I don't know exactly what. You might need to switch to /*! */
comments for multiline math.
/// @{ | ||
/// \brief The spatial derivative of the spatial rotational killing vector | ||
/// | ||
/// As above, assumes uniform rotation around the z-axis |
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.
Doxygen doesn't do a great job of preserving organization, so "As above" ends up being confusing in the rendered documentation. Give the name of the specific thing you are trying to refer to. (I think "spatial_rotational_killing_vector".)
@@ -0,0 +1,28 @@ | |||
# Distributed under the MIT License. | |||
# See LICENSE.txt for details. | |||
set(LIBRARY "Test_HydroInitialData") |
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 blank line above.
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 think this was done before, but it seems to have gotten lost.
|
||
set(LIBRARY_SOURCES | ||
Test_IrrotationalBns.cpp | ||
) |
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.
Indent two spaces.
add_test_library(${LIBRARY} "${LIBRARY_SOURCES}") | ||
|
||
|
||
|
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 extra blank lines.
CoordinateMaps | ||
DataStructures | ||
DataStructuresHelpers | ||
Domain | ||
GeneralRelativity | ||
GeneralRelativityHelpers | ||
Hydro | ||
HydroHelpers | ||
IO | ||
LinearOperators | ||
Spectral | ||
Utilities |
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.
All you use is
DataStructures
Hydro
Looks good. Squash. |
5c1a257
to
eb01613
Compare
@nilsvu if you'd like to take a look at this! |
@nilsvu this is ready to be looked at again when you get a chance! |
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.
You can squash everything
b7181af
to
84e6569
Compare
84e6569
to
b23ff80
Compare
@wthrowe if you'd like to take a look at this again, otherwise I think it's ready to merge |
/// @{ | ||
/// \brief Compute the spatial rotational killing vector associated with uniform | ||
/// rotation around the z-axis. | ||
/// Taking \f$\Omega_j\f$ to be the uniform rotation axis (assumed in the |
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.
Empty comment line after the "brief" part.
@@ -0,0 +1,28 @@ | |||
# Distributed under the MIT License. | |||
# See LICENSE.txt for details. | |||
set(LIBRARY "Test_HydroInitialData") |
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 think this was done before, but it seems to have gotten lost.
@wthrowe shall I squash? |
Yes, looks good. |
9bb31c6
to
24a7cbe
Compare
Proposed changes
This PR adds the point wise functions necessary to compute the needed quantities for use in solving Irrotational BNS initial data (which will be added in a future pull request)
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