Skip to content

Conversation

@nikwit
Copy link
Contributor

@nikwit nikwit commented Feb 16, 2023

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_element and euclidean_area_element after all because otherwise it should really be det_euclidean_surface_jacobian which I don't really like.

@nikwit nikwit requested a review from nilsvu February 16, 2023 16:00
@nikwit nikwit requested a review from PunJustice February 24, 2023 09:42
Copy link
Contributor

@PunJustice PunJustice left a 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!

* 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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, well spotted


/*!
* \brief The determinant of the induced Jacobian on a surface
* \brief The area element i.e. the determinant of the induced Jacobian on a
Copy link
Contributor

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

@nilsdeppe
Copy link
Member

This needs a rebase. @nilsvu could you also please take a look?

@nikwit nikwit force-pushed the curved-face-det-jacobian branch from e799d1f to 3ce3a10 Compare March 4, 2023 14:21
@nilsvu nilsvu self-assigned this Mar 11, 2023

/*!
* \brief Compute the Euclidean surface element from the inverse jacobian.
* \brief Compute the Euclidean are element from the inverse jacobian.
Copy link
Member

@nilsvu nilsvu Mar 14, 2023

Choose a reason for hiding this comment

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

typo area

*/
template <typename SourceFrame, typename TargetFrame>
struct DetSurfaceJacobian : db::SimpleTag {
struct AreaElement : db::SimpleTag {
Copy link
Member

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

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 have a strong opinion but this is then inconsistent with area_element in StrahlKorperGr.cpp from what I can tell.

Copy link
Member

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.

Copy link
Contributor Author

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

/*!
Copy link
Member

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

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.

Copy link
Contributor Author

@nikwit nikwit Mar 20, 2023

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.

Copy link
Member

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.

Copy link
Contributor Author

@nikwit nikwit Mar 20, 2023

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.

@nikwit nikwit force-pushed the curved-face-det-jacobian branch 2 times, most recently from cc0c72f to 57d388c Compare March 18, 2023 10:53
@nilsvu
Copy link
Member

nilsvu commented Mar 19, 2023

Squash 👍

@nikwit nikwit force-pushed the curved-face-det-jacobian branch from 57d388c to 63cc30e Compare March 19, 2023 15:55
* 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.
Copy link
Member

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.,
Copy link
Member

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

@nikwit nikwit force-pushed the curved-face-det-jacobian branch from 63cc30e to b203809 Compare March 20, 2023 22:24
@nilsvu
Copy link
Member

nilsvu commented Mar 20, 2023

👍 please add the sqrt(gamma) also to the math in the doc while you squash

@nikwit nikwit force-pushed the curved-face-det-jacobian branch from b203809 to ae5972d Compare March 21, 2023 08:06
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.

LGTM, thanks for working this out @nikwit !

@nilsvu nilsvu merged commit 1521490 into sxs-collaboration:develop Mar 21, 2023
@nikwit nikwit deleted the curved-face-det-jacobian branch September 3, 2025 21:55
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