Skip to content
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

Update code to use BMSTransformation class and add function to map ABD object to the frame of another #85

Merged
merged 14 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ authors:
given-names: "Keefe"
orcid: "https://orcid.org/0000-0003-0276-3856"
title: "scri"
version: 2022.8.3
version: 2022.8.4
doi: 10.5281/zenodo.4041971
date-released: 2022-10-18
moble marked this conversation as resolved.
Show resolved Hide resolved
url: "https://github.com/moble/scri"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "scri"
version = "2022.8.3"
version = "2022.8.4"
moble marked this conversation as resolved.
Show resolved Hide resolved
description = "Time-dependent functions of spin-weighted spherical harmonics"
readme = "README.md"
license = "MIT"
Expand Down
3 changes: 3 additions & 0 deletions scri/asymptotic_bondi_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def interpolate(self, new_times):
# interpolate frame data if necessary
if self.frame.shape[0] == self.n_times:
import quaternion

new_abd.frame = quaternion.squad(self.frame, self.t, new_times)
return new_abd

Expand All @@ -203,10 +204,12 @@ def interpolate(self, new_times):
bondi_rest_mass,
bondi_four_momentum,
bondi_angular_momentum,
CWWY_angular_momentum,
bondi_dimensionless_spin,
bondi_boost_charge,
bondi_CoM_charge,
supermomentum,
)

from .map_to_superrest_frame import map_to_superrest_frame
from .map_to_abd_frame import map_to_abd_frame
45 changes: 41 additions & 4 deletions scri/asymptotic_bondi_data/bms_charges.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
### class. In particular, they assume that the first argument, `self` is an instance of
### AsymptoticBondData. They should probably not be used outside of that class.

import scri
import numpy as np
from math import sqrt, pi
import spherical_functions as sf


def mass_aspect(self, truncate_ell=max):
Expand Down Expand Up @@ -83,7 +85,7 @@ def bondi_four_momentum(self):
return charge_vector_from_aspect(charge_aspect)


def bondi_angular_momentum(self, output_dimensionless=False):
def bondi_angular_momentum(self):
"""Compute the total Bondi angular momentum vector

i (ψ₁ + σ ðσ̄)
Expand All @@ -99,6 +101,37 @@ def bondi_angular_momentum(self, output_dimensionless=False):
return charge_vector_from_aspect(charge_aspect)[:, 1:]


def CWWY_angular_momentum(self):
"""Compute the Chen/Wang/Wang/Yau angular momentum vector.

See Eq. (5) of https://arxiv.org/abs/2102.03235

"""
ell_max = 1 # Compute only the parts we need, ell<=1
supertranslation_potential_data = scri.asymptotic_bondi_data.map_to_superrest_frame.𝔇inverse(
np.array(self.sigma.ethbar_GHP.ethbar_GHP + self.sigma.bar.eth_GHP.eth_GHP), self.ell_max
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it faster to just compute self.sigma.ethbar_GHP.ethbar_GHP and take twice the real part?

)
supertranslation_potential = scri.ModesTimeSeries(
sf.SWSH_modes.Modes(
supertranslation_potential_data,
spin_weight=0,
ell_min=0,
ell_max=self.ell_max,
multiplication_truncator=max,
),
time=self.t,
)
charge_aspect = (
1j
* (
self.psi1.truncate_ell(ell_max)
+ self.sigma.multiply(self.sigma.bar.eth_GHP, truncator=lambda tup: ell_max)
+ supertranslation_potential.multiply(self.mass_aspect().eth_GHP, truncator=lambda tup: ell_max)
)
).view(np.ndarray)
return charge_vector_from_aspect(charge_aspect)[:, 1:]


def bondi_dimensionless_spin(self):
"""Compute the dimensionless Bondi spin vector"""
N = self.bondi_boost_charge()
Expand All @@ -112,7 +145,7 @@ def bondi_dimensionless_spin(self):
vhat = v.copy()
t_idx = v_norm != 0 # Get the indices for timesteps with non-zero velocity
vhat[t_idx] = v[t_idx] / v_norm[t_idx, np.newaxis]
gamma = (1 / np.sqrt(1 - v_norm ** 2))[:, np.newaxis]
gamma = (1 / np.sqrt(1 - v_norm**2))[:, np.newaxis]
J_dot_vhat = np.einsum("ij,ij->i", J, vhat)[:, np.newaxis]
spin_charge = (gamma * (J + np.cross(v, N)) - (gamma - 1) * J_dot_vhat * vhat) / M_sqr
return spin_charge
Expand Down Expand Up @@ -209,15 +242,19 @@ def supermomentum(self, supermomentum_def, **kwargs):
if supermomentum_def.lower() in ["bondi-sachs", "bs"]:
supermomentum = self.psi2 + self.sigma.grid_multiply(self.sigma.bar.dot, **kwargs)
elif supermomentum_def.lower() in ["moreschi", "m"]:
supermomentum = self.psi2 + self.sigma.grid_multiply(self.sigma.bar.dot, **kwargs) + self.sigma.bar.eth_GHP.eth_GHP
supermomentum = (
self.psi2 + self.sigma.grid_multiply(self.sigma.bar.dot, **kwargs) + self.sigma.bar.eth_GHP.eth_GHP
)
elif supermomentum_def.lower() in ["geroch", "g"]:
supermomentum = (
self.psi2
+ self.sigma.grid_multiply(self.sigma.bar.dot, **kwargs)
+ 0.5 * (self.sigma.bar.eth_GHP.eth_GHP - self.sigma.ethbar_GHP.ethbar_GHP)
)
elif supermomentum_def.lower() in ["geroch-winicour", "gw"]:
supermomentum = self.psi2 + self.sigma.grid_multiply(self.sigma.bar.dot, **kwargs) - self.sigma.ethbar_GHP.ethbar_GHP
supermomentum = (
self.psi2 + self.sigma.grid_multiply(self.sigma.bar.dot, **kwargs) - self.sigma.ethbar_GHP.ethbar_GHP
)
else:
raise ValueError(
f"Supermomentum defintion '{supermomentum_def}' not recognized. Please choose one of "
Expand Down
Loading