Skip to content

Conversation

@mar-celine
Copy link
Contributor

@mar-celine mar-celine commented Apr 11, 2023

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.OpeningAngle option to BinaryCompactObject domains in input files. Set it to 90 to keep the previous behavior.

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

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.

old_rect_domain

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.
new_rect_domain

@mar-celine mar-celine force-pushed the from_cube_to_rectangular_prism branch from 2035f2c to 003d78d Compare April 11, 2023 09:03
@mar-celine mar-celine changed the title From cube to rectangular prism Add OpeningAngle to BinaryCompactObject Apr 11, 2023
@knelli2 knelli2 self-requested a review April 11, 2023 17:10
@mar-celine mar-celine force-pushed the from_cube_to_rectangular_prism branch 2 times, most recently from 152ec1f to a0eb9a6 Compare April 11, 2023 21:42
@nilsdeppe nilsdeppe requested a review from nilsvu April 11, 2023 22:17
@mar-celine mar-celine force-pushed the from_cube_to_rectangular_prism branch from a0eb9a6 to d1a1e4d Compare April 12, 2023 19:26
@nilsvu
Copy link
Member

nilsvu commented Apr 13, 2023

Looks great! Thanks for your work on this! I'll review asap.

@mar-celine mar-celine force-pushed the from_cube_to_rectangular_prism branch 6 times, most recently from a0a4794 to 990d719 Compare April 25, 2023 01:05
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.

Just some minor changes. Love the new image though!

Comment on lines 285 to 288
/*1.0 / sqrt(with_equiangular_map
? 1.0 + square(tan(0.5 * opening_angle_xi)) +
square(tan(0.5 * opening_angle_eta))
: 3.0);*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

Comment on lines +109 to +110
// the Frustum that is furthest away from the origin. For the rectangular
// BinaryCompactObject Domain, this vertex is assumed to lie on a rectangular
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

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?

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 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.

Comment on lines 323 to 324
static constexpr Options::String help = {
"The opening angle of the two half wedges in degrees."};
Copy link
Contributor

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.

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 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!

Copy link
Contributor

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.

Comment on lines 436 to 437
// centered at the origin.
const double sphericity = 1.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

constexpr

Comment on lines 107 to 108
constexpr double outer_radius = 32.4;
constexpr double opening_angle = 120.0;
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 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;
Copy link
Contributor

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.

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. You can squash

@mar-celine mar-celine force-pushed the from_cube_to_rectangular_prism branch from cb5dc0c to fbd6ae7 Compare April 26, 2023 21:54
@mar-celine
Copy link
Contributor Author

I've squashed! @nilsvu It's ready for you to review ☺️

@mar-celine mar-celine force-pushed the from_cube_to_rectangular_prism branch from fbd6ae7 to 83eba48 Compare May 3, 2023 21:20
p | sphericity_;
p | radius_;
p | phi_;
} if (version >= 1) {
Copy link
Member

Choose a reason for hiding this comment

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

clang-format

Copy link
Member

Choose a reason for hiding this comment

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

Ping

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

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.

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

Copy link
Member

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

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?

Copy link
Contributor Author

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 😅

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.

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

Choose a reason for hiding this comment

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

Ping

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

Choose a reason for hiding this comment

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

Ok

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.

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.

@nilsvu nilsvu merged commit d9372f9 into sxs-collaboration:develop May 16, 2023
@nilsvu
Copy link
Member

nilsvu commented Jun 19, 2023

I updated the upgrade instructions.

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.

4 participants