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 CCE system equations #1397
Add CCE system equations #1397
Conversation
7243b2a
to
9dfb13f
Compare
tests/Unit/Pypp/PyppFundamentals.hpp
Outdated
@@ -212,6 +212,32 @@ struct ToPyObject<DataVector, std::nullptr_t> { | |||
} | |||
}; | |||
|
|||
template <> |
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'd recommend factoring this commit out since it'll be easier to get in and should have different reviewers
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.
That makes good sense 👍. I was struggling with whether I should ask @osheamonn for this one because of this change.
9dfb13f
to
26f6ae2
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.
group review by @nilsleiffischer (main), @hrueter
We did not yet review the full PR.
If you think it would be hard to follow the calculation in the documentation please either make the documentation self-contained or add your notes as TeX files to the /docs. They are not yet automatically built when building the documentation. If you think it makes sense to add provide the Mathematica notebooks in the documentation, we propose to publish them in a separate repository. Assign them a DOI and link them from our documentation. (use e.g. zenodo )
src/Evolution/Systems/Cce/Tags.hpp
Outdated
static std::string name() noexcept { return "Beta"; } | ||
}; | ||
|
||
/// Bondi parameter \f$J\f$ |
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.
J -> H
What is H actually? We can't find it in the Handmer paper.
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.
Ah, apparently notation has diverged for this quantity, and the Handmer paper doesn't discuss the procedure in detail. I'll add more explanatory detail to this comment 👍.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
}; | ||
|
||
/// Bondi parameter \f$J\f$ | ||
struct H : db::SimpleTag { |
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.
We suggest naming these BondiH
, BondiJ
, ...
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 have a mild preference for keeping the tags brief, due to the effect of expanding the already very long tag lists in Equations.hpp
. The names are consistently used in CCE, and anything that accesses these tags outside the CCE module will need to access them by Cce::Tags::H
etc, so I think it is sufficiently disambiguated.
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’d still prefer BondiH
, BondiJ
etc, just to avoid single-letter type names that have the possibility of being hard to search-and-replace. I’d also like the other reviewers @markscheel @nilsdeppe to weigh in here before you make the 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.
Yea, I hate single letter things. With tags I don't feel as strongly because they're always prefixed with Tags::
, but I still am not a fan of it. Since currently there apparently is a comment "Bondi parameter tags` necessary, @nilsleiffischer's suggestion also removes the need for that comment.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
/// A prefix tag representing a quantity that will appear on the right-hand side | ||
/// of an explicitly regular differential equation | ||
template <typename Tag> | ||
struct IntegrandFor : db::PrefixTag, db::SimpleTag { |
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 For
. This is implied by the prefixing.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
/// represent some of the cached quantities for CCE. Note that the spins are | ||
/// added. | ||
template <typename LhsTag, typename RhsTag> | ||
struct Times : db::PrefixTag, db::SimpleTag { |
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 looks like being general to spin weighted quantities. So better move to DataStructures/Tags.hpp or DataStructures/SpinWeighted.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.
Or perhaps wait until this is needed elsewhere?
src/Evolution/Systems/Cce/Tags.hpp
Outdated
/// Temporary scalars for particular spin weights. | ||
template <size_t index, int spin> | ||
struct TemporarySpinWeightedScalar : db::SimpleTag { | ||
using type = Scalar<SpinWeighted<ComplexDataVector, spin>>; |
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.
We propose to add a spinweighted prefix tag to DataStructures/Tags.hpp, that swaps the type of a tensor with a spinweighted type. Then you can use the TempBuffer
with the aliases from Datastructures/Variables.hpp.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
}; | ||
|
||
// Additional values which are frequently used in CCE calculations, and | ||
// therefore worth caching |
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.
Should these go into a detail
namespace? Maybe in a separate 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.
I don't think we've put tags into detail
namespaces very often (ever?). My issue with moving these into a detail
namespace is that they then won't show up in Doxygen and nobody will be able to find them without reading the code.
template <typename BondiAndSWCacheTagList, typename DerivativeTagList, | ||
typename IntegrandTagList, typename SecondaryTagList, | ||
typename TemporaryTagList> | ||
void evaluate( |
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.
As discussed at the call yesterday, a comment of ours for some reason didn't make it into the review. We suggested to make this conform to the existing db::mutate_apply
mechanism, see also #1413 (that PR only makes that mechanism easier to use, it works already fine right now). Let's talk in a hangout if anything is unclear.
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.
Review with @markscheel (primary) and @moxcodes. We looked at the Tags.hpp and did a brief overview of the equations. Still more review needed.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
@@ -0,0 +1,255 @@ | |||
// Distributed under the MIT License. See LICENSE.txt for details. |
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.
Should be two (2) lines
... how did this even get committed?
src/Evolution/Systems/Cce/Tags.hpp
Outdated
}; | ||
|
||
/// Bondi parameter \f$K^2 = 1 + J \bar{J}\f$ | ||
struct KSquared : db::SimpleTag { |
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.
@moxcodes notes to self: check if this is used.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
struct Dy : db::PrefixTag, db::SimpleTag { | ||
using type = Scalar<SpinWeighted<ComplexDataVector, Tag::type::type::spin>>; | ||
using tag = Tag; | ||
static const size_t dir = 2; |
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.
- Please use a clearer name. Suggest:
dimension_to_differentiate
- Perhaps open an issue to add documentation that an assumption is made about the (phi, theta, r) ordering of the CCE coordinates.
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.
Issue created and assigned to me.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
|
||
/// A prefix tag representing the contribution to a differential equation which | ||
/// has a contribution of a nontrivial linear operator in addition to the | ||
/// differential operator |
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 ease of reading, suggest: "A prefix tag representing a linear operator that acts on Tag
"
Also include the equation in the documentation (here? elsewhere?), because the tag is specialized to a particular differential equation (note, e.g., the hardcoded spin).
src/Evolution/Systems/Cce/Tags.hpp
Outdated
|
||
/// A prefix tag representing the contribution to a differential equation which | ||
/// has a contribution of a nontrivial linear operator acting on the conjugate | ||
/// of the quantity being solved for in addition to the differential operator |
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.
"A prefix tag representing a linear operator that acts on the conjugate of Tag
"
src/Evolution/Systems/Cce/Tags.hpp
Outdated
}; | ||
|
||
/// The value \f$\exp(2\beta)\f$, which is used frequently in the Bondi | ||
/// computations. |
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.
Drop second half of comment, it isn't very illuminating. Same on following tag.
|
||
/// The value \f$ J (\bar{Q} - 2 \bar{\eth} \beta ) \f$, which must be computed | ||
/// as an intermediate step to CCE equations. | ||
struct JbarQMinus2EthBeta : db::SimpleTag { |
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.
Convention so far has been to use tag name Xbar
for \bar{X}
, so fix doxygen and/or tag name for consistency. Or rename to SadTag.
/// \brief A struct for providing a tmpl::list of integrand tags that need to be | ||
/// computed before integration can proceed for a given Bondi variable tag. | ||
template <typename BondiVariable> | ||
using integrands_to_compute_for_bondi_variable = |
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.
integrands
-> integrand_terms
(globally)
}; | ||
template <> | ||
struct tags_needed_for_integrand_computation_impl< | ||
Tags::IntegrandFor<Tags::Beta>, TagsCategory::Secondary> { |
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.
Secondary
-> IndependentOfIntegration
or similar
|
||
template <> | ||
struct tags_needed_for_integrand_computation_impl< | ||
Tags::IntegrandFor<Tags::Beta>, TagsCategory::BondiAndSWCache> { |
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.
BondiAndSWCache
-> TagsToSwshDifferentiate
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 the move of the implementations into the cpp file worked out great 👍 A few more comments on the overall structure below. Also I think it would be good to "activate" the second reviewer, to get a second opinion and make sure we are converging to a state that will be merged. @markscheel would you review this?
docs/References.bib
Outdated
@@ -169,6 +169,37 @@ @book{Hartle2003gravity | |||
url = "https://www.pearson.com/us/higher-education/program/Hartle-Gravity-An-Introduction-to-Einstein-s-General-Relativity/PGM298455.html", | |||
} | |||
|
|||
@article{Bishop1997ik, |
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.
Please sort alphabetically (see guidelines linked at the top of this file)
|
||
namespace Cce { | ||
// suppresses doxygen problems with these functions | ||
///\cond |
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 space /// \cond
, also you don't need the explanatory comment, this is done at a lot of places in the code
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 one I felt should have a comment, as dox is usually not rendered for cpp, but there appears to be a small bug in doxygen tackling this file.
// clang-tidy readability-avoid-const-params-in-decls, but the consts must | ||
// stay | ||
static void apply( | ||
const gsl::not_null<SpinWeighted<ComplexDataVector, 0>*> // 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.
I think you can remove the const
s here, you only need them in the 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.
That is not true for this scenario, because the calling interface in this case needs to know that it is passing to a function with const arguments (otherwise it can't rely on the function it calls to not mutate its own const arguments). At any rate, I wanted to avoid the long list of nolint's and it does not compile without the const :P
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.
Modulo a compiler bug this is not how const
works. You can safely remove the const
on the not_null
arguments in the forward declarations, there's no need to NOLINT
anything. On the arguments that are references, the const
matters. I tested this that it compiles the Cce
and Test_Cce
libraries clang7 and gcc6. We also do not const
the not_null
arguments everywhere else in the entire repository and have never had to NOLINT
anything. We actually use not_null
so we don't have to 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.
Fortunately, this also can be reverted to standard use now that the Variables
interface has been dropped.
@@ -0,0 +1,195 @@ | |||
# Distributed under the MIT License. |
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.
As of the guidelines introduced in #1382 please name the Python file the same as the cpp test file, without the Test_
prefix.
* `apply` function in the specialization of `ComputeBondiIntegrand`. | ||
*/ | ||
template <typename IntegrandTag> | ||
struct MutateComputeBondiIntegrand { |
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.
name ComputeBondiIntegrand
* - `temporary_cache` : `Temporary` | ||
*/ | ||
template <typename IntegrandTag> | ||
struct ComputeBondiIntegrandFromVariables { |
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 suggest to move this into test helpers. If we end up needing this in the public interface we can always move it back, but it is not clear to me that we do.
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'd still lean towards keeping at as part of the public interface, if only because the CCE/SWSH interfaces are currently working with the design goal of having interfaces which act on clusters of tags with some mathematical and functional commonality, in order to manage the combinatorically large number of values that appear in the calculations and impose some mild hierarchy. It ends up having a nice connection as well to the way the lists of tags are presented in this namespace, where if the tags were all put into a single large list, it would be more difficult to read and maintain.
If there is consensus that the Variables interface should not be included in src
, I will move it to the tests.
Another alternative is to make the templates more general still, and permit them to take an arbitrary template, so this code is equally operable for sets of Variables or TaggedTuples.
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'd like to get input from the other reviews on this. My intention here is to not make the interface unnecessarily complex before we know we need that functionality.
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.
Alright, I'm happy to have other input for this one.
My main point is just that while it's conceptually simple to just take a bunch of arguments, it will tend to be a frustrating interface to mechanically use for calling code for the large number of arguments for some of these.
@hrueter @fmahebert @markscheel opinions?
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.
Right, so I think we agree that calling these functions with a list of arguments is conceptually nice and clean, but cumbersome when one has to write it out. That is, however, why we have the struct with the argument_tags
typelist, so that you can just hand the struct over to the DataBox and have it sort out the arguments for you. I suggest you look at the GeneralizedHarmonic
code and tests for an example. Those are just structs with a plain argument_tags
list and an apply
function that takes those arguments.
When we discussed this last week you mentioned you are worried about having to call the functions explicitly in tests, which is why I suggested to move this "short-cut" code with the categories and Variables
to the tests.
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.
From separate discussion, we concluded that it will be best to move these to the test helpers for this PR as suggested by @nilsleiffischer .
Oh @markscheel sorry I didn't realised you already reviewed this as part of the group review posted by @fmahebert |
Fixups posted for all points aside from moving the |
Current status:
|
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.
Please squash the fixups and these minor additional changes
docs/References.bib
Outdated
@@ -200,6 +190,16 @@ @article{Handmer2014qha | |||
url = "https://doi.org/10.1088/0264-9381/32/2/025008" | |||
} | |||
|
|||
@book{Hartle2003gravity, |
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 the leading whitespace please
* \brief An interface to ComputeBondiIntegrand which is convenient for passing | ||
* around clusters of bondi quantities in `Variables` | ||
* \brief An interface to ComputeBondiIntegrandImpl which is convenient for | ||
* passing around clusters of bondi quantities in `Variables` |
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.
Bondi
#ifndef __clang__ | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter" | ||
#endif // __clang__ |
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 don't know if this is the best-practice way to do this, so perhaps another reviewer can confirm
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.
Do you mean specifically the #ifndef __clang__
to select compiler? This was the method I was advised to use for a compiler-specific warning in #1145 , though the warning was ultimately removed by other changes, but I'm happy to entertain other methods.
IntegrandTag, TagsCategory::IndependentOfBondiIntegration>>; | ||
|
||
template <typename... Args> | ||
static void apply(Args... args) noexcept { |
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.
const & or &&
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.
A summary of the conclusions from discussion with @nilsdeppe and @nilsleiffischer for the last few changes to these utilities.
* - `temporary_cache` : `Temporary` | ||
*/ | ||
template <typename IntegrandTag> | ||
struct ComputeBondiIntegrandFromVariables { |
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.
From separate discussion, we concluded that it will be best to move these to the test helpers for this PR as suggested by @nilsleiffischer .
* `SpinWeighted<ComplexDataVector, N>`s for each of the Bondi arguments. | ||
*/ | ||
template <typename IntegrandTag> | ||
struct ComputeBondiIntegrandImpl; |
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 convenience impl should instead be a impl function moved in the ComputeBondiIntegrand function.
|
||
// - Tags for Linear operator that acts on the conjugate of H | ||
template <> | ||
struct tags_needed_for_integrand_computation_impl< |
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 type aliases, for each term, should be a single struct, and the collections of tags should probably be placed in a separate file.
using bondi_integrand_tag = typename decltype(y)::type; | ||
using bondi_integrand_argument_list = | ||
all_arguments_for_integrand<bondi_integrand_tag>; | ||
// check the Variables interface |
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.
Once the Variables interface is in a test helpers, this comment should give a few more details as to why we are testing this way (i.e. to allow the test to use the equations without using a databox and without manually specifying each of the functions and each of the numerous arguments for each of those functions).
d6e8f70
to
6e78272
Compare
Fixups posted and rebased. The only remaining fixup commit is the one regarding the discussion about the Variables helper and the accompanying typedefs. |
class ComplexDataVector; | ||
///\endcond | ||
|
||
/// Contains system-specific tools for Cauchy Characteristic Extraction. |
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 mean with system-specific here? Perhaps just “functionality” for CCE
* Characteristic hypersurface equations. | ||
* | ||
* \details The template argument must be one of the integrand-related prefix | ||
* tags applied to a Bondi quantity for which that integrand is required. 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.
The template argument is not the prefix tag itself, but a prefixed tag, if I understand correctly
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'll adjust the later part of the sentence to refer to 'prefix tags templated on a Bondi quantity tag' for improved clarity.
Tags::Integrand<Tags::Beta>>, | ||
swsh_derivative_tags_needed_for_integrand<Tags::Integrand<Tags::Beta>>, | ||
integration_independent_tags_needed_for_integrand< | ||
Tags::Integrand<Tags::Beta>>>; |
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.
To build these return and argument tags you now refer to the tags lists in the other file. From our discussion the other day I understood we’d go with another strategy, and if I misunderstood then I’d like to suggest it here:
- Build the tag lists self-contained within the specialization of
ComputeBondiIntegrand
. You can split it intobuffer_tags
or similar, possibly private, type lists to retain the categoristation, if you like. - Remove the
TagsLists.hpp
from this PR, but keep the code around on another branch in case you’ll ever need it. - Also remove the
integrand_terms_to_compute_for_bondi_variable
from this PR but keep the code on another branch. It is part of the code that does the computation, in my opinion, so add it in a PR that makes use of it.
Before you make this change, I’d like the other reviewers to confirm @markscheel @nilsdeppe, so that you don’t waste 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.
Provided consensus, I'm fine doing the first two. I'd prefer, however, to keep the integrand_terms_to_compute_for_bondi_variable
. It's actually used in the test, and without it being present here, I'd just have to reproduce the same set of types in the test either by direct listing inline or via type aliases there.
src/Evolution/Systems/Cce/Tags.hpp
Outdated
static std::string name() noexcept { return "Beta"; } | ||
}; | ||
|
||
/// Bondi parameter \f$H = \partial_u J\f$. Note: the notation in the literature |
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.
\brief and \note
jbar = np.conj(j) | ||
k_squared = (1.0 + j * jbar) | ||
qbar = np.conj(q) | ||
script_av = eth_beta * eth_jbar + ethbar_ethbar_j / 2.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.
You take this as an argument but then compute it
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.
It is a temporary buffer, taken by argument to avoid allocation.
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.
but this is in python, so does that actually work?
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, oops, I failed to note which file this was commenting on. No, it doesn't have any optimization utility in python. I could name the intermediate step something else, but I still need the argument so that the function signature is the same as the C++, and I still want to compute the intermediate step so that the function is reasonably readable.
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 there is a way to comment out the name of the argument like there is in C/C++? Or maybe just name that argument something that makes it clear it's not used?
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 use an underscore _
for unused arguments, that's the convention
int assign_to_tag( | ||
const gsl::not_null<Variables<VariablesTagList>*> all_variables, | ||
const Arg arg) noexcept { | ||
get(get<Tag>(*all_variables)).data() = arg; |
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 do you need the data()
? Looks dangerous :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.
This is a result of the SpinWeighted wrapper. The outer get
obtains a SpinWeighted<ComplexDataVector, N>
, and the .data()
obtains the ComplexDataVector
, which can be assigned regardless of the spin-weight. It's not a pointer, which I suspect is why it feels concerning.
template <typename Tag, typename VariablesTagList, typename Arg> | ||
int assign_to_tag( | ||
const gsl::not_null<Variables<VariablesTagList>*> all_variables, | ||
const Arg arg) noexcept { |
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.
const ref
// create a variables which will hold everything | ||
Variables< | ||
tmpl::flatten<tmpl::append<ArgumentTagList, tmpl::list<OutputTag>>>> | ||
all_variables{NumberOfGridPoints, std::complex<double>(10, 57)}; |
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 remove the second argument to construct with NaNs
integrand_for_beta, | ||
const SpinWeighted<ComplexDataVector, 2>& dy_j, // NOLINT | ||
const SpinWeighted<ComplexDataVector, 2>& j, // NOLINT | ||
const SpinWeighted<ComplexDataVector, 0>& one_minus_y // 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.
You have to make sure that the apply function actually take the types of the return and argument tags. Since you want to avoid the many get
s to bypass the Scalar
s, you’ll need an apply
and apply_impl
or similar, I think @nilsdeppe suggested something.
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.
Ah, true. I agree this needs to be fixed.
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.
To make sure this works, I think it would be good to add a test that calls db::mutate_apply
. This will be made easier with #1413
new fixups posted. I believe all comments have been addressed aside from expanding the single-character bondi tags to |
squashed in a fix to get gcc to build |
@moxcodes I'll be on vacation 1st to 11th of May, so unable to review this in that time. As far as I understand this is still waiting on input by @markscheel, @fmahebert and @nilsdeppe though. If you end up moving this PR forward while I'm away, please feel free to replace me with another reviewer. |
@moxcodes could you please rebase and squash this, then ping me so I know to look at it? Thanks :) |
fcf0160
to
7d2e650
Compare
@nilsdeppe I've squashed the previous fixes and rebased. I've added one fixup in which I remove the |
@nilsleiffischer @hrueter please give feedback on whether you're happy with the changes or not. |
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 quite happy about how this code is structured now :) thanks for your patience!
Only a few minor things:
@nilsleiffischer @fmahebert I've posted fixups for the last few comments. |
The fixups LGTM |
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 looks pretty much done to me. Sorry for not checking the fixups earlier, please rebase on develop and squash. Then, make sure Travis is happy and ping @sxs-collaboration/spectre-core-devs to get this finally merged :)
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 minor documentation changes.
I did not try to check the equations themselves (ugh); that's what the tests are for...
@markscheel I've posted fixups for all of the suggestions. |
@markscheel Just waiting for the go-ahead before I squash the fixups. |
please squash! |
- previously the Tags::SpinWeighted prefix tag and Tensors of spin-weighted quantities could not be easily put into a DataBox
- add tags for relevant CCE quantities - add computation methods for CCE integrands
squashed (and rebased) |
@hrueter @nilsleiffischer @fmahebert @markscheel this should be ready for final approval. Please only request changes for obvious errors, anything else, just comment and @moxcodes can decide to address them or make an issue. |
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.
@moxcodes What I think is missing for these equations are tests that do not rely on the Python implementation, but work with some honest, hard-coded numbers that were computed externally. This is to make sure the C++ and Python implementation don't have the same bug, which can easily happen when coding them up. This was discussed briefly in this review before. Please consider adding such tests soon, perhaps make an issue for the record.
@@ -909,7 +909,7 @@ struct Subitems<TagList, Tag, | |||
|
|||
namespace Tags { | |||
template <size_t N, typename T> | |||
struct TempTensor { | |||
struct TempTensor : db::SimpleTag { |
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.
@nilsdeppe is this resolved for you?
@nilsleiffischer This pull request alone doesn't have enough of the CCE infrastructure to have useful comparisons against hand-computed quantities. I agree that those checks are important (some already exist on my own branch), so I've created issue #1641 as a reminder to prioritize those tests once the CCE code is capable of them. |
@sxs-collaboration/spectre-core-devs since @nilsleiffischer was the primary on the 'request changes' from @hrueter , I think this one is actually good to go? |
Proposed changes
This PR adds the Cauchy characteristic extraction system equations, which compute the set of inputs to the hypersurface integration routine, and represent the core of the physics at work here.
The equations I've implemented are complicated and have been adjusted to the computational task from the equations in the literature. If any of the reviewers want to be thorough and check the form of the equations themselves (and not simply trust the forms in the documentation), please just leave a comment to that effect and I will create a repository which contains my notes and Mathematica document to produce these results. I would not recommend any reviewer investing the time needed to verify the form of the equations without those reference materials.
Types of changes:
Component:
Code review checklist
clang-tidy
andIWYU
.For instructions on how to perform the CI checks locally refer to the Dev
guide on the Travis CI.
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
Dependencies