-
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 an analytic data PolarMagnetizedFmDisk #5563
Conversation
CHECK(tuples::get<tag>(single_var) == | ||
tuples::get<tag>(vars_from_all_tags_reversed)); | ||
CHECK_ITERABLE_APPROX(tuples::get<tag>(single_var), | ||
tuples::get<tag>(vars_from_all_tags)); |
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.
Why this change?
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.
test_tag_retrieval was giving an error when using CHECK.
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.
- There are no other changes in this commit, so probably this should be in one of the later commits.
- Do you understand why? It might be fine, but I don't see an obvious reason for them to differ,
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.
In offline discussion we decided this change is fine squashed into a later commit. It appears to be optimization related, and this class has more interaction between fetched variables than most of the others so that's not terribly unexpected.
grmhd::AnalyticData::MagnetizedFmDisk(1.3, 0.345, 6.123, 14.2, | ||
0.065, 1.654, 0.42, 85.0, 6), | ||
domain::CoordinateMaps::SphericalTorus(2.5, 3.6, 0.9, 0.7)); | ||
test_move_semantics(std::move(disk), disk_copy); // NOLINT |
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.
Indicate what warning is being silenced by the NOLINT as // NOLINT(warning-name)
or // NOLINTNEXTLINE(warning-name)
, where warning-name
is from the error message and will look something like performance-move-const-arg
.
test_create_from_options(); | ||
test_serialize(); | ||
test_move(); | ||
test_variables(std::numeric_limits<double>::signaling_NaN()); |
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.
Also test with DataVector.
|
||
namespace { | ||
const std::array<double, 3> t2a(const tnsr::I<double, 3>& tens); | ||
const tnsr::I<double, 3> a2t(const std::array<double, 3>& arr); |
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.
No need to declare these here, since they are defined immediately following.
}, | ||
test_point, j, 1e-3); | ||
|
||
const auto numerical1 = numerical_derivative( |
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 more descriptive names for these variables. Maybe numerical_jacobian
and numerical_inverse_jacobian
or something.
const std::array<double, 3> t2a(const tnsr::I<double, 3>& tens); | ||
const tnsr::I<double, 3> a2t(const std::array<double, 3>& arr); | ||
|
||
const std::array<double, 3> t2a(const tnsr::I<double, 3>& tens) { |
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/Tensor.hpp"
const std::array<double, 3> t2a(const tnsr::I<double, 3>& tens) { | ||
std::array<double, 3> arr{}; | ||
for (size_t i = 0; i < 3; i++) { | ||
gsl::at(arr,i) = tens.get(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.
#include "Utilities/Gsl.hpp"
|
||
const std::array<double, 3> t2a(const tnsr::I<double, 3>& tens) { | ||
std::array<double, 3> arr{}; | ||
for (size_t i = 0; i < 3; 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.
#include <cstddef>
return arr; | ||
} | ||
|
||
const tnsr::I<double, 3> a2t(const std::array<double, 3>& arr) { |
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 const
from return type. No reason to restrict what the caller can do with the temporary. Also on t2a
.
add_grmhd_executable( | ||
PolarMagnetizedFmDisk | ||
grmhd::AnalyticData::PolarMagnetizedFmDisk | ||
"${LIBS_TO_LINK}" |
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 ${LIBS_TO_LINK}
in this commit instead of the next one.
0aa1e9f
to
a4e454e
Compare
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 happy with this, but since I was involved in writing some of the code I shouldn't be the sole reviewer. @nilsdeppe, I think you were willing to do the follow-up?
Yep! I might not have time until later next week, but I'm happy to take a look, hopefully sooner :D |
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.
Couple minor things, please squash right away
std::string, std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>& | ||
functions_of_time) const { | ||
(void) functions_of_time; |
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.
What do you have against [[maybe_unused]]
?
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 got a compiler warning even with [[maybe_unused]]
.
But, I can undo this change because PolarMagnetizedFmDisk.cpp no longer uses this file.
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.
Yes, please undo since it's not needed
|
||
namespace grmhd::AnalyticData { | ||
/*! | ||
* \brief Magnetized fluid disk orbiting a Kerr black hole in the usual |
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 clarify what "usual" means?
@@ -34,9 +33,9 @@ class er; | |||
|
|||
namespace grmhd::AnalyticData { | |||
/*! | |||
* \brief Magnetized fluid disk orbiting a Kerr black hole in the usual | |||
* \brief Magnetized fluid disk orbiting a Kerr black hole in the Kerr-Schild |
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 go in the first commit.
std::string, std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>& | ||
functions_of_time) const { | ||
(void) functions_of_time; |
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.
Yes, please undo since it's not needed
Proposed changes
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