splined_moon_frame_module Module

Splined lunar principal-axis (MOON_PA) frame: the rotation from J2000 to the frame, interpolated from a table of the frame's roll, pitch and yaw angles vs. ephemeris time (e.g., data/moon_pa_2000_2100.csv, generated with SPICE).

This is the same interpolation as the moonframe library's moon_frame_interpolater (quartic B-splines of the roll, the pitch, and the cosine and sine of the yaw angle, with the same knots), and gives identical results, but with the same pattern as splined_ephemeris_module: the spline coefficients are global variables, computed once and then only read, so all the segments (and threads) share one copy. Each moon_pa_frame object only holds its own small evaluation workspace (the interval indices and a work array, which db1val modifies), so each segment (thread) has its own. (With a copy of the coefficients in every segment, the memory grew with the square of the number of revolutions.)


Uses

  • module~~splined_moon_frame_module~~UsesGraph module~splined_moon_frame_module splined_moon_frame_module bspline_module bspline_module module~splined_moon_frame_module->bspline_module csv_module csv_module module~splined_moon_frame_module->csv_module module~halo_kinds_module halo_kinds_module module~splined_moon_frame_module->module~halo_kinds_module iso_fortran_env iso_fortran_env module~halo_kinds_module->iso_fortran_env

Used by

  • module~~splined_moon_frame_module~~UsedByGraph module~splined_moon_frame_module splined_moon_frame_module module~halo_module halo_module module~halo_module->module~splined_moon_frame_module module~halo_eclipse_opt_submodule halo_eclipse_opt_submodule module~halo_eclipse_opt_submodule->module~halo_module

Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: kx = bspline_order_quartic

spline order (as in moonframe)

integer, private, parameter :: iknot = 0

knots chosen by db1ink (as in moonframe)

integer, private, parameter :: n_splines = 4

roll, pitch, cos(yaw), sin(yaw)

integer, private :: nx = 0

number of points

real(kind=wp), private, dimension(:,:), allocatable :: tx

(nx+kx, n_splines) knots

real(kind=wp), private, dimension(:,:), allocatable :: bcoef

(nx, n_splines) coefficients


Derived Types

type, public ::  moon_pa_frame

The interface to the splined MOON_PA frame: only the evaluation workspace (the splines themselves are global). Make a copy for each thread.

Components

Type Visibility Attributes Name Initial
integer, private, dimension(n_splines) :: inbvx = 1

db1val's interval index for each spline

real(kind=wp), private, dimension(3*kx) :: w0 = 0.0_wp

db1val work array

Type-Bound Procedures

procedure, public :: initialize => initialize_moon_pa_frame
procedure, public :: j2000_to_frame
procedure, public :: frame_to_j2000
procedure, public :: destroy => destroy_moon_pa_frame

Functions

private function j2000_to_frame(me, et) result(rot)

The rotation matrix from J2000 to the MOON_PA frame at et.

Arguments

Type IntentOptional Attributes Name
class(moon_pa_frame), intent(inout) :: me
real(kind=wp), intent(in) :: et

ephemeris time [sec]

Return Value real(kind=wp), dimension(3,3)

private function frame_to_j2000(me, et) result(rot)

The rotation matrix from the MOON_PA frame to J2000 at et.

Arguments

Type IntentOptional Attributes Name
class(moon_pa_frame), intent(inout) :: me
real(kind=wp), intent(in) :: et

ephemeris time [sec]

Return Value real(kind=wp), dimension(3,3)


Subroutines

private subroutine initialize_moon_pa_frame(me, filename, et0, etf)

Read the table and compute the (global) splines, for the time span [et0, etf]: the rows from the last one at or before et0 to the first one at or after etf (as in moonframe). Then the object's workspace is reset; copies of the object (allocate(..., source=...)) can be used by other threads.

Arguments

Type IntentOptional Attributes Name
class(moon_pa_frame), intent(inout) :: me
character(len=*), intent(in) :: filename

csv file with the ephemeris time, roll, pitch and yaw (rad)

real(kind=wp), intent(in) :: et0

start ephemeris time of the span to spline [sec]

real(kind=wp), intent(in) :: etf

end ephemeris time of the span to spline [sec]

private pure subroutine rpy_to_rot(roll, pitch, yaw, r)

Roll, pitch and yaw (rad) to the rotation matrix (as in moonframe).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: roll
real(kind=wp), intent(in) :: pitch
real(kind=wp), intent(in) :: yaw
real(kind=wp), intent(out), dimension(3,3) :: r

private subroutine destroy_moon_pa_frame(me)

Reset the object's workspace (the global splines are kept).

Arguments

Type IntentOptional Attributes Name
class(moon_pa_frame), intent(inout) :: me