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

Control center of mass and linear momentum in initial data. #6212

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

iago-mendes
Copy link
Member

@iago-mendes iago-mendes commented Aug 14, 2024

Proposed changes

This PR extends the control loop in initial data to adjust the center of mass and ADM linear momentum.

Upgrade instructions

This PR changes BinaryCompactObject, which is used in multiple parts of the code. Now, the constructor expects the argument std::array<double, 2> center_of_mass_offset.

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

Copy link
Member

@kidder kidder left a comment

Choose a reason for hiding this comment

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

Not a complete review, but please don't abbreviate "center of mass" as com
I don't need to approve before the PR is merged

@@ -311,6 +311,13 @@ class BinaryCompactObject : public DomainCreator<3> {
"x-axis)."};
};

struct ComOffset {
Copy link
Member

Choose a reason for hiding this comment

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

Please spell out CenterOfMassOffset

@@ -449,7 +456,8 @@ class BinaryCompactObject : public DomainCreator<3> {

BinaryCompactObject(
typename ObjectA::type object_A, typename ObjectB::type object_B,
double envelope_radius, double outer_radius,
std::array<double, 2> com_offset, double envelope_radius,
Copy link
Member

Choose a reason for hiding this comment

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

also spell out center_of_mass_offset

Copy link
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

Not yet a complete review, I'll look at the control loop changes tomorrow.

src/Domain/Creators/BinaryCompactObject.hpp Outdated Show resolved Hide resolved
src/PointwiseFunctions/AnalyticData/Xcts/Binary.hpp Outdated Show resolved Hide resolved
support/Pipelines/Bbh/ControlId.py Outdated Show resolved Hide resolved
support/Pipelines/Bbh/ControlId.py Outdated Show resolved Hide resolved
support/Pipelines/Bbh/ControlId.py Outdated Show resolved Hide resolved
support/Pipelines/Bbh/ControlId.py Outdated Show resolved Hide resolved
support/Pipelines/Bbh/ControlId.py Outdated Show resolved Hide resolved
support/Pipelines/Bbh/ControlId.py Outdated Show resolved Hide resolved
nilsvu
nilsvu previously approved these changes Aug 15, 2024
Copy link
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

LGTM please squash 👍 It would help @knelli2 if you split the changes into two commits: one for the domain creator and the other for the control loop.

tests/Unit/Domain/Test_Domain.cpp Outdated Show resolved Hide resolved
nilsvu
nilsvu previously approved these changes Aug 15, 2024
@@ -18,9 +18,37 @@
DEFAULT_RESIDUAL_TOLERANCE = 1.0e-6
DEFAULT_MAX_ITERATIONS = 30

# Initial data physical parameters that are supported in this control scheme
SupportedParams = Literal[
Copy link
Member

Choose a reason for hiding this comment

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

(optional) You can do this to avoid duplicating this list:

SupportedParams = Literal[*FreeDataFromParams.keys()]

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems like Literal doesn't take "unpacked arguments", so this would disable the type checking. Since these parameters are specified by users in the input file, I think it would be better to keep it the way it is.

Copy link
Member

Choose a reason for hiding this comment

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

Oh ok it worked on my machine with Py 3.12, but maybe this was a more recent addition to Python. Fine with me.

Comment on lines 325 to 326
"Offset in the y and z axes applied to both object A and B in order to "
"control the center of mass."};
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a note that this moves the location of the two objects in the grid frame but keeps the Envelope and OuterShell centered on the origin in the grid frame

Comment on lines 535 to 537
double x_offset_{};
double y_offset_{};
double z_offset_{};
Copy link
Contributor

Choose a reason for hiding this comment

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

Make this a std::array named center_of_mass_offset_. With the excision offset that will be added in soon, we'll want to be very explicit about what offset is moving what coordinates.

Comment on lines +458 to +459
double y_offset_{};
double z_offset_{};
Copy link
Contributor

Choose a reason for hiding this comment

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

These are probably ok as is

Copy link
Contributor

@knelli2 knelli2 left a comment

Choose a reason for hiding this comment

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

Looks good! The clang-tidy stuff is unrelated to your changes

@nilsvu nilsvu merged commit 25e11e1 into sxs-collaboration:develop Aug 16, 2024
19 of 22 checks passed
@knelli2 knelli2 linked an issue Sep 7, 2024 that may be closed by this pull request
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.

Off-axis excisions in BBH domain
4 participants