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

Use DampingFunctions for GH evolutions #2597

Merged
merged 2 commits into from Nov 18, 2020

Conversation

geoffrey4444
Copy link
Contributor

Proposed changes

For the generalized harmonic system, this PR replaces hard-coded constraint damping parameter functions with DampingFunctions whose parameters are specified in the yaml input file. The value of the parameters in the unit tests and in KerrSchild.yaml are the same as the previously hard-coded values, which originally came from SpEC input files for a single black hole.

Since the constraint damping functions now live in a namespace GeneralizedHarmonic::ConstraintDamping, this PR also moves the other tags relevant to constraint damping parameters from GeneralizedHarmonic into GeneralizedHarmonic::ConstraintDamping.

Note: the DampingFunctions currently are constant in time. A future PR will make DampingFunctions aware of FunctionsOfTime, so that, e.g., you can scale the damping parameters by the expansion factor (as SpEC does for binary black hole mergers).

Types of changes:

  • Bugfix
  • New feature
  • Refactor

Component:

  • Code
  • Documentation
  • Build system
  • Continuous integration

Code review checklist

  • The PR passes all checks, including unit tests and clang-tidy.
    For instructions on how to perform the CI checks locally refer to the Dev
    guide on the Travis CI
    .
  • 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.

Further comments

@geoffrey4444 geoffrey4444 added the in progress Don't review, used for sharing code and getting feedback label Nov 13, 2020
@geoffrey4444 geoffrey4444 removed the in progress Don't review, used for sharing code and getting feedback label Nov 13, 2020
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 suggestions, please squash immediately

template <size_t VolumeDim, typename Fr>
auto GaussianPlusConstant<VolumeDim, Fr>::get_clone() const noexcept
-> std::unique_ptr<DampingFunction<VolumeDim, Fr>> {
return std::make_unique<GaussianPlusConstant<VolumeDim, Fr>>(
Copy link
Member

Choose a reason for hiding this comment

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

If you make the class copyable (which it very easily could and should be) then you can do make_unique<...>(*this)

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 thought, like with MathFunctions, we don't want them to be copyable, so that we force users to avoid copying? But if you're cool with it, I'm fine making them copyable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I made the class (and the base class) copyable by no longer deleting the copy constructors

Copy link
Member

Choose a reason for hiding this comment

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

Yea, but I make poor decisions just like everyone else :) When having a get_clone function it's much easier if you can copy construct 🤷


static constexpr bool pass_metavariables = false;
static type create_from_options(const type& damping_function) noexcept {
return std::move(damping_function->get_clone());
Copy link
Member

Choose a reason for hiding this comment

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

Does the std::move actual do anything here? You're already getting an rvalue result from get_clone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope! Thanks for pointing this out, as it directed me to clear up lvalue vs rvalue. I found this page very helpful for this: https://en.cppreference.com/w/cpp/language/value_category

Copy link
Contributor

@carmaza carmaza left a comment

Choose a reason for hiding this comment

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

You can squash right away.

@@ -17,6 +18,8 @@ spectre_target_headers(
HEADERS
GaussianPlusConstant.hpp
DampingFunction.hpp
RegisterDerivedWithCharm.hpp
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to the changes of this PR, but, since you are editing this file, it wouldn't hurt to fix the alphabetical order of these headers. Up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this! I meant to fix this myself. Not sure how to do it, but would be great if someday this was caught automatically somehow.

} // namespace GeneralizedHarmonic::ConstraintDamping::Tags

/*!
* \brief A DampingFunction to compute the constraint damping paramter
Copy link
Contributor

Choose a reason for hiding this comment

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

paramter -> parameter here and in two more occurrences below.

@geoffrey4444 geoffrey4444 added the updated all comments addressed, ready for re-review label Nov 17, 2020
@geoffrey4444 geoffrey4444 removed the request for review from kidder November 17, 2020 19:40
@geoffrey4444
Copy link
Contributor Author

@carmaza @nilsdeppe thanks for the very fast reviews! Very much appreciated :) I made the changes you suggested and squashed

@nilsdeppe nilsdeppe merged commit 923fde3 into sxs-collaboration:develop Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
updated all comments addressed, ready for re-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants