-
Notifications
You must be signed in to change notification settings - Fork 213
Add OpeningAngle to BinaryCompactObject #4934
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 OpeningAngle to BinaryCompactObject #4934
Conversation
2035f2c to
003d78d
Compare
152ec1f to
a0eb9a6
Compare
a0eb9a6 to
d1a1e4d
Compare
|
Looks great! Thanks for your work on this! I'll review asap. |
a0a4794 to
990d719
Compare
knelli2
left a comment
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.
Just some minor changes. Love the new image though!
| /*1.0 / sqrt(with_equiangular_map | ||
| ? 1.0 + square(tan(0.5 * opening_angle_xi)) + | ||
| square(tan(0.5 * opening_angle_eta)) | ||
| : 3.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.
Remove?
| // the Frustum that is furthest away from the origin. For the rectangular | ||
| // BinaryCompactObject Domain, this vertex is assumed to lie on a rectangular |
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.
Is this true for domains other than the BCO domain?
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 good question - there is only one other Domain that uses Frustums, the FrustalCloak Domain, but this Domain has not been updated or used in a while. I expect the BinaryCompactObject Domain to be the only domain the typical user uses that would lead them to encounter a Frustum map, which is why I added this comment.
I could add, For information on how other Domains use the Frustum map, please see that Domain's documentation. or something to that effect.
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.
Yeah I think that comment would be helpful.
| std::numeric_limits<double>::signaling_NaN()}; | ||
| }; | ||
|
|
||
| bool operator!=(const Frustum& lhs, const Frustum& rhs); |
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.
[Random line] Should there be a test for the changes to the Frustum?
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 will add a random opening_angle to the test suite for map to check that the map is valid for various opening angles with the correct inverse/jacobian. Additional tests for "does this map do what we want" will be taken care of by the BCO domain's "check connectivity" test that checks that the Frustums with opening angles conform to the Wedges with opening angles.
| static constexpr Options::String help = { | ||
| "The opening angle of the two half wedges in degrees."}; |
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 be a bit more descriptive? I don't think a user necessarily knows what the half wedges are. Maybe something like
Surrounding the two objects (which are encompassed by two cubes) are a series of wedges that abut the
faces of these cubes. The wedges on the ends of these cubes are full wedges while the wedges around
the rest of the faces are half wedges. This option is the opening angle of these half wedges in degrees.
If I said something incorrect here you can just fix it when you add 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.
I don't want to make the help string too long and since this option is placed in group = OuterShell and the outer shell is in the main BCO documentation I can change half wedges to half wedges of the outer shell and the user should have enough information to find out what this is referring to with this string. But I will also add documentation on the half wedges in that place!
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.
Ok yeah that sounds good.
| // centered at the origin. | ||
| const double sphericity = 1.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.
constexpr
| constexpr double outer_radius = 32.4; | ||
| constexpr double opening_angle = 120.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.
Can you instead make this part of the random sample so we can test different values? Maybe make_array(75.0, 90.0, 120.0)?
| constexpr double outer_radius = 32.4; | ||
| constexpr double opening_angle = 90.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.
Same comment as above. You'll probably need to edit the create_option_string as well to take arbitrary values.
knelli2
left a comment
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.
Looks good. You can squash
cb5dc0c to
fbd6ae7
Compare
|
I've squashed! @nilsvu It's ready for you to review |
fbd6ae7 to
83eba48
Compare
| p | sphericity_; | ||
| p | radius_; | ||
| p | phi_; | ||
| } if (version >= 1) { |
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.
clang-format
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.
Ping
src/Domain/DomainHelpers.hpp
Outdated
| * \param radial_distribution Select the radial distribution of grid points in | ||
| * the spherical shells. | ||
| * \param which_wedges Select a subset of wedges. | ||
| * \param opening_angle sets the opening angle of the two half wedges that |
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 a sentence that this only has an effect if use_half_wedges is turned on. Also maybe name something like half_wedges_opening_angle to clarify that this number applies to the half wedges? Default to M_PI_4 in that case (and multiply by 2 to get the opening angle of the full wedge). This is an attempt to clarify what "opening angle" means for a full envelope of wedges, other suggestions welcome.
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 want to keep opening_angle as the angle for the full wedge (or both halves combined) because this makes it easier to compare with the endcap full wedge which is also given an opening_angle, but I'll had that this parameter has no effect if use_half_wedges is turned off
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.
Ok
| static constexpr Options::String help = {"Radius of the entire domain."}; | ||
| }; | ||
|
|
||
| struct OpeningAngle { |
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.
Same comment here about clarifying what "opening angle" means for a full envelope of wedges. Maybe HalfWedgesOpeningAngle if you want to retain the ability to choose any value for the angles. Values of 45 and 60 degrees would correspond to the previous behavior and the new equal angular size behavior, respectively (note that in the help string). Alternatively, just a boolean like EqualizeOpeningAngles or something like that could also work. WDYT?
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 mentioned above I think it's easier to be able to compare two half wedges with the end cap wedge using the full opening angle vs the half)
I'm not sure if we want to equalize by default yet, since we are sacrificing equiangular-ity in the endcap wedges (but so far runs have not shown poor behavior in those regions resulting from the change).
I have a guess that a value between 120.0 and 90.0 might be ideal to strike a balance between angular size and equiangular-ity, or it could also be the case that we don't want to equalize angular size in angle but rather in surface area / volume covered by each wedge/half wedge - it is not clear to me that a choice of 120.0 results in the half wedge having the same surface area or volume as an endcap wedge (and this still might not be what gives ideal behavior)
In any case, I think it's too soon to default yet 😅
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 tiny things, you can squash everything. Please add some upgrade instructions to the PR description.
| p | sphericity_; | ||
| p | radius_; | ||
| p | phi_; | ||
| } if (version >= 1) { |
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.
Ping
src/Domain/DomainHelpers.hpp
Outdated
| * \param radial_distribution Select the radial distribution of grid points in | ||
| * the spherical shells. | ||
| * \param which_wedges Select a subset of wedges. | ||
| * \param opening_angle sets the opening angle of the two half wedges that |
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.
Ok
04bd8fa to
aa7f387
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 think the relevant part for the upgrade instructions is that people have to add an OpeningAngle option to their input files and should get an idea what that does, and set it to 90 to keep the current behavior. Please update when you get the chance.
|
I updated the upgrade instructions. |
Proposed changes
Addresses issue #3545 by introducing an OpeningAngle option to the BinaryCompactObject Domain that allows the user to set the angular sizes of the Wedges in the Domain, making the angular distribution of points more uniform.
Upgrade instructions
Add the new
OuterShell.OpeningAngleoption toBinaryCompactObjectdomains in input files. Set it to90to keep the previous behavior.Code review checklist
make docto generate the documentation locally intoBUILD_DIR/docs/html.Then open
index.html.code review guide.
bugfixornew featureif appropriate.Further comments
The old domain. One can also see how the grid becomes rounded-cubical moving outwards from the two inner cubes. This is left over from bulging out from a cubical shell of frustums (the old enveloping cube), The main concern however, was the fact that the two half wedges have the same angular size as a full wedge, despite having twice the number of gridpoints between them. The proposed solution was to fan out the half wedges and make the end cap full wedges smaller in angular size.
The new domain created from the same options, except with OpeningAngle set to 120.0. The enveloping cube is stretched into a rectangular prism first, which is then bulged out, which seems to give a better gridpoint distribution than before. The Wedges in the outer layer are also opened up to conform to the new bulged out prism, and the equiangular map is revamped to accomodate variable opening angle sizes.
