Skip to content

Commit

Permalink
Cone Rotation Fix
Browse files Browse the repository at this point in the history
Fixed erroneous rotation for cone function for non 0 zeniths.
  • Loading branch information
NLarsen15 committed Dec 3, 2024
1 parent bc5098c commit 7ce7a9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions OTSO/Library/Conversion.f95
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ end subroutine LatGDZ2GEO

subroutine Rotate(Vector, Zenith, Azimuth, NewVector)
implicit none
real(8) :: Vector(3), Zenith, Azimuth, NewVector(3), TempVector(3)
real(8) :: Vector(3), Zenith, Azimuth, NewVector(3), TempVector(3), NewZenith, NewAzimuth
real(8), parameter :: pi = 4 * atan(1.0_8)

Zenith = -(pi / 180.0)*Zenith
Azimuth = (pi / 180.0)*Azimuth
NewZenith = -(pi / 180.0)*Zenith
NewAzimuth = (pi / 180.0)*Azimuth

TempVector(1) = Vector(1)*cos(Zenith) + Vector(3)*sin(Zenith)
TempVector(1) = Vector(1)*cos(NewZenith) + Vector(3)*sin(NewZenith)
TempVector(2) = Vector(2)
TempVector(3) = -Vector(1)*sin(Zenith) + Vector(3)*cos(Zenith)
TempVector(3) = -Vector(1)*sin(NewZenith) + Vector(3)*cos(NewZenith)

NewVector(1) = TempVector(1)*cos(Azimuth) - TempVector(2)*sin(Azimuth)
NewVector(2) = TempVector(1)*sin(Azimuth) + TempVector(2)*cos(Azimuth)
NewVector(1) = TempVector(1)*cos(NewAzimuth) - TempVector(2)*sin(NewAzimuth)
NewVector(2) = TempVector(1)*sin(NewAzimuth) + TempVector(2)*cos(NewAzimuth)
NewVector(3) = TempVector(3)

end subroutine Rotate
2 changes: 1 addition & 1 deletion OTSO/Library/Velocity.f95
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ subroutine NormalVector(StartPosition, NormOUT)
USE particle
implicit none

real(8) :: Earth, StartPosition(3)
real(8) :: Earth, StartPosition(5)
real(8) :: NormOUT(3), xDT(3), xDTConvert(3), xINConvert(3)

!f2py intent(in) xIN, year, day, sec
Expand Down

0 comments on commit 7ce7a9d

Please sign in to comment.