-
Notifications
You must be signed in to change notification settings - Fork 213
Add curved area element #4743
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 curved area element #4743
Conversation
PunJustice
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 small nitpicking things!
src/Domain/AreaElement.hpp
Outdated
| * x^j\f$. The determinant of the inverse Jacobian can be passed as an argument | ||
| * as an overload, otherwise it will be calculated. | ||
| * | ||
| * \note The curved space area element as well as time dependent maps are 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.
Maybe I am confused, but isn't area_element precisely the curved space area element?
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.
yes, well spotted
src/Domain/Tags/AreaElement.hpp
Outdated
|
|
||
| /*! | ||
| * \brief The determinant of the induced Jacobian on a surface | ||
| * \brief The area element i.e. the determinant of the induced Jacobian on a |
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.
Nitpicking, but I think better is "The area element, i.e. the determinant of the induced Jacobian, on a surface."
|
This needs a rebase. @nilsvu could you also please take a look? |
e799d1f to
3ce3a10
Compare
src/Domain/AreaElement.hpp
Outdated
|
|
||
| /*! | ||
| * \brief Compute the Euclidean surface element from the inverse jacobian. | ||
| * \brief Compute the Euclidean are element from the inverse jacobian. |
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.
typo area
src/Domain/Tags/AreaElement.hpp
Outdated
| */ | ||
| template <typename SourceFrame, typename TargetFrame> | ||
| struct DetSurfaceJacobian : db::SimpleTag { | ||
| struct AreaElement : 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.
tl;dr I suggest this:
- Keep this tag unchanged (no rename, no change in what it stores).
- Include the metric determinant in your
area_elementfunctions so they actually integrate to the area in curved space.
Details: I think in curved space we should make the distinction between the surface Jacobian determinant J and the area element \sqrt{gamma} J. The area element should actually integrate to the area, hence it should include the metric determinant. Arguably the surface Jacobian alone (without the metric determinant) isn't much use, but you probably don't want to go through the code that uses the Tags::DetSurfaceJacobian and make sure it uses the metric determinant properly. Therefore, just keep this tag unchanged. But in your area_element functions include the metric determinant, and check in the test that you get the horizon area of Kerr by just integrating over the area element.
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 have a strong opinion but this is then inconsistent with area_element in StrahlKorperGr.cpp from what I can tell.
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.
In the StrahlkorperGr test here https://github.com/sxs-collaboration/spectre/blob/develop/tests/Unit/ApparentHorizons/Test_StrahlkorperGr.cpp#L417 the integral over the area element is the area, without an additional metric determinant. It follows Appendix D in https://arxiv.org/abs/gr-qc/9606010, which is explained in a bit more detail in Appendix C in the Baumgarte/Shapiro book. That's what we should do for this area_element function as well. I think multiplying by the spatial metric determinant is enough.
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 right, that makes sense. I changed it so
| TargetFrame>& inverse_jacobian_face, | ||
| const Direction<VolumeDim>& direction); | ||
|
|
||
| /*! |
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.
Use /// @{ to group the dox
| if (element_abutting_direction.has_value()) { | ||
| const auto face_logical_coords = interface_logical_coordinates( | ||
| face_mesh, element_abutting_direction.value()); | ||
| const ElementMap logical_to_grid_map( |
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 also use CoordinateMaps::Composition to get the combined logical -> grid -> kerr deformed map. Then you don't need to concatenate Jacobians yourself etc. You can get the ElementLogical -> BlockLogical map from ElementToBlockLogicalMap.hpp, then compose with block.stationary_map() and the Kerr conforming map.
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 am not sure how this is supposed to work. The problem is that the Kerr conforming map effectively goes from the intertial to the inertial frame, so I cannot put it directly into Composition because that will not be instantiated.
So I have to somehow concatenate block.stationary_map() and the Kerr conforming map into a single CoordinateMap before that goes from BlockLogical ->Inertial, presumably using make_coordinate_map. But block.stationary_map() is of type CoordinateMapBase and make_coordinate_map needs the dynamic type at compile time as far as I can tell, so Im not sure how to do this.
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.
Here's an example:
domain::CoordinateMaps::Composition coord_map{
domain::element_to_block_logical_map(element_id),
current_block.stationary_map().get_to_grid_frame(),
std::make_unique<
CoordinateMap<Frame::Grid, Frame::Inertial,
domain::CoordinateMaps::KerrHorizonConforming>>(
kerr_schild_map)};
const auto inertial_coords = coord_map(face_logical_coords);
const auto inv_jacobian = coord_map.inv_jacobian(face_logical_coords);I tested that this compiles.
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 see, so we get the map to the grid frame so all the frames are different. Do you think it would be a good idea to put the Composition implementation in the header file so it is possible to also have maps that map to the same frame in there? Currently this is not possible because the instantiation would not be there.
This also threw up a bug #4851 which needs to merged before this test can pass.
cc0c72f to
57d388c
Compare
|
Squash 👍 |
57d388c to
63cc30e
Compare
| * that will calculate it from the inverse Jacobian. | ||
| * \param direction The direction of the surface in the element. | ||
| * \param inverse_spatial_metric The inverse spatial metric sliced to the | ||
| * surface. |
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.
Update dox with metric determinant
| inv_jacobian(ti::I, ti::k) * | ||
| inv_jacobian_kerr_horizon(ti::K, ti::j)); | ||
| const auto spacetime_vars = kerr_schild.variables( | ||
| grid_to_kerr_conforming_map(inertial_coords), 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.
I think the different maps and frames are a bit confusing here (e.g. map is named grid but coords are named inertial, then there's another Inertial->Inertial map). Please clear this up a bit, or better yet use a Composition map that combines ElementLogical->BlockLogical->Wedge->HorizonConforming into one map (see my comment above #4743 (comment)).
63cc30e to
b203809
Compare
|
👍 please add the sqrt(gamma) also to the math in the doc while you squash |
b203809 to
ae5972d
Compare
nilsvu
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.
LGTM, thanks for working this out @nikwit !
Proposed changes
adds a function that computes the area element / surface jacobian for curved space
the test computes the area of a Kerr black hole in Kerr Schild coordinates
@nilsvu I decided to rename it to
area_elementandeuclidean_area_elementafter all because otherwise it should really bedet_euclidean_surface_jacobianwhich I don't really like.