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

Issue50 #51

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Issue50 #51

wants to merge 5 commits into from

Conversation

Philip-Lynch
Copy link
Collaborator

Partially fixes Issue #50

New features:

  • Simplified FourVelocity expressions for Circular Schwarzschild
  • KerrGeoOnSeparatrixQ: Private function to stop KerrGeoOrbit from evaluating on the separatrix (except for Circular Schwarzschild where everything is well behaved)
  • Made FourVelocity.m use the functions from OrbitalFrequencies.m to get rid of repeated code
  • Made FourVelocity API more user friendly by removing "Covariant" option and outputting all components, both contravariant and covariant, as a single association.

Kernel/FourVelocity.m Outdated Show resolved Hide resolved
(*Circular, Equatorial*)


KerrGeoVelocityMino[(0|0.),p_,(0|0.),x_,initPhases_ ]:= Module[{En,L,Q,r,z,r1,r2,r3,r4,kr,zp,zm,kz, \[CapitalUpsilon]r, \[CapitalUpsilon]z,
Copy link
Member

Choose a reason for hiding this comment

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

The use of (0|0.) misses the case where a or e are non-machine precision zero's (e.g. 0.``32) I suggest the following instead

KerrGeoVelocityMino[a_,p_,e_,x_,initPhases_ ] /; a==0 && e==0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see in the rest of the package ?PossibleZeroQ is used. This should do the same thing, but I also think it's better style to be consistent throughout the package and use

KerrGeoVelocityMino[a_?PossibleZeroQ,p_,e_?PossibleZeroQ,x_,initPhases_ ] := ....

Copy link
Member

Choose a reason for hiding this comment

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

PossibleZeroQ could be used here, although note the slightly different. PossibleZeroQ prints a message and returns True if a number might be zero but it's not sure, whereas the version with Equal will not return True in that case, which is equivalent to returning False for the purposes of the function definition. There are also circumstances where PossibleZeroQ will get it wrong (see the docs for example). These are all very much corner cases, so I think either PossibleZeroQ or Equal would be fine.

Comment on lines 85 to 87
kr = ((r1-r2)(r3-r4))/((r1-r3)(r2-r4));

kz = a^2 (1-En^2) zm^2/zp^2;
Copy link
Member

Choose a reason for hiding this comment

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

Can these be removed now? These are the lines that lead to divide-by-zero at the separatrix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean the expressions for kr and kz?

These aren't singular at the separatrix. kz is finite and kr goes to 1. The problem is that EllipticK[kr] returns complex infinity when kr = 1 and that shows up in the frequencies, the analytic solutions for the coordinates and the four-velocities, with no obvious way (to me at least) for taking a finite limit exactly on the separatrix for generic orbits.

Copy link
Collaborator

Choose a reason for hiding this comment

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

When there is a double root, you get special solutions. These are currently not explicitly implemented in the package (except circular orbits). We should add a check for r2==r3 and produce an error message.

Copy link
Member

@barrywardell barrywardell Aug 2, 2023

Choose a reason for hiding this comment

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

Yes, I'm suggesting to remove the definitions of kr and kz. The problem with these is that in the case of repeated roots (eg. at the ISCO) they involve 0/0 and this causes problems. I had thought kr and kz are no longer used in this function, in which case we could remove them to avoid warning messages. Unfortunately I now see they are used further down. Could we define functions for these quantities also and then remove kr and kz here? The special handling of repeated roots can then be done in KerrGeoMinoFrequencyr and the other added functions.

Kernel/FourVelocity.m Outdated Show resolved Hide resolved

(*Other Roots*)
r3 = 1/(1-En^2) - (r1 + r2)/2 + Sqrt[(-(1/(1-En^2)) + (r1 + r2)/2 )^2 - (a^2 Q)/(r1 r2 (1 - En^2))];
r4 = (a^2 Q)/(r1 r2 r3 (1-En^2));
kr = ((r1-r2)(r3-r4))/((r1-r3)(r2-r4));
Copy link
Member

Choose a reason for hiding this comment

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

Remove this line?

Copy link
Collaborator Author

@Philip-Lynch Philip-Lynch Aug 2, 2023

Choose a reason for hiding this comment

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

We need the expression for kr in the function definition on line 198, so we can't just get rid of it.

Copy link
Member

Choose a reason for hiding this comment

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

This is the same issue as above.

Kernel/SpecialOrbits.m Outdated Show resolved Hide resolved
Kernel/SpecialOrbits.m Show resolved Hide resolved
Kernel/SpecialOrbits.m Show resolved Hide resolved
Kernel/SpecialOrbits.m Show resolved Hide resolved
Kernel/SpecialOrbits.m Outdated Show resolved Hide resolved
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.

3 participants