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 an analytic data PolarMagnetizedFmDisk #5563

Merged
merged 2 commits into from
Oct 15, 2023

Conversation

jyoo1042
Copy link
Contributor

Proposed changes

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. There are no other changes in this commit, so probably this should be in one of the later commits.
  2. Do you understand why? It might be fine, but I don't see an obvious reason for them to differ,

Copy link
Member

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
Copy link
Member

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());
Copy link
Member

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);
Copy link
Member

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(
Copy link
Member

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) {
Copy link
Member

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);
Copy link
Member

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++) {
Copy link
Member

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) {
Copy link
Member

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}"
Copy link
Member

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.

@jyoo1042 jyoo1042 force-pushed the disk_PR_new branch 2 times, most recently from 0aa1e9f to a4e454e Compare October 13, 2023 21:00
wthrowe
wthrowe previously approved these changes Oct 13, 2023
Copy link
Member

@wthrowe wthrowe left a 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?

@nilsdeppe
Copy link
Member

Yep! I might not have time until later next week, but I'm happy to take a look, hopefully sooner :D

Copy link
Member

@nilsdeppe nilsdeppe left a 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;
Copy link
Member

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]]?

Copy link
Contributor Author

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.

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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

@nilsdeppe nilsdeppe merged commit da248e2 into sxs-collaboration:develop Oct 15, 2023
@jyoo1042 jyoo1042 deleted the disk_PR_new branch October 16, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants