@essrt/physics 22.1.0 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/package.json +9 -3
- package/src/constants/coefficients.d.ts +11 -11
- package/src/constants/coefficients.js +4 -4
- package/src/constants/generated.d.ts +4 -16
- package/src/constants/generated.js +8 -32
- package/src/constants/units.cjs +20 -0
- package/src/deltat/deep-time-chain.js +457 -0
- package/src/deltat/deep-time.cjs +68 -25
- package/src/deltat/moon-distance-artifact.cjs +23 -0
- package/src/deltat/moon-distance-history.cjs +115 -0
- package/src/earth/deep-orbital-history.cjs +69 -19
- package/src/earth/mass-chain.cjs +95 -0
- package/src/earth/mean-obliquity-history.cjs +94 -0
- package/src/earth/precession-composed.cjs +49 -3
- package/src/index.js +23 -1
- package/src/layer0/derive-params.js +1 -5
- package/src/layer0/index.js +30 -17
- package/src/math/angles.cjs +38 -0
- package/src/model.js +100 -266
- package/src/moon/arguments.cjs +5 -31
- package/src/moon/month-chain.cjs +12 -19
- package/src/planets/chain-artifact.js +2 -2
- package/src/time/calendar.cjs +165 -0
- package/types/constants/coefficients.d.ts +11 -11
- package/types/constants/generated.d.ts +4 -16
- package/types/constants/units.d.cts +8 -0
- package/types/deltat/deep-time-chain.d.ts +266 -0
- package/types/deltat/deep-time.d.cts +42 -12
- package/types/deltat/moon-distance-artifact.d.cts +22 -0
- package/types/deltat/moon-distance-history.d.cts +36 -0
- package/types/earth/deep-orbital-history.d.cts +5 -3
- package/types/earth/mass-chain.d.cts +78 -0
- package/types/earth/mean-obliquity-history.d.cts +32 -0
- package/types/earth/precession-composed.d.cts +11 -1
- package/types/index.d.ts +8 -1
- package/types/layer0/derive-params.d.ts +3 -2
- package/types/layer0/index.d.ts +9 -6
- package/types/math/angles.d.cts +18 -0
- package/types/model.d.ts +21 -3
- package/types/moon/arguments.d.cts +2 -6
- package/types/moon/month-chain.d.cts +7 -13
- package/types/time/calendar.d.cts +78 -0
- package/src/deltat/recession-history.cjs +0 -169
- package/types/deltat/recession-history.d.cts +0 -80
package/src/layer0/index.js
CHANGED
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
/**
|
|
33
33
|
* @typedef {Object} EpochParams
|
|
34
34
|
* @property {number} epochYear year at t_Ma = 0 (2000, NOT startmodelYear)
|
|
35
|
-
* @property {number} alpha1PerMa Moon recession, LLR-anchored
|
|
36
|
-
* @property {number} alpha3PerMa3
|
|
37
|
-
* @property {number} alpha4PerMa4
|
|
35
|
+
* @property {number} alpha1PerMa Moon recession, LLR-anchored (the J2000 slope of the cited history)
|
|
38
36
|
* @property {number} moonDistanceNowM a_Moon at J2000, metres
|
|
39
37
|
* @property {number} moonLockDistanceM tidal-lock asymptote, metres
|
|
40
38
|
* @property {number} totalAngularMomentumKgM2S L_tot of the Earth-Moon system
|
|
@@ -53,17 +51,24 @@
|
|
|
53
51
|
/**
|
|
54
52
|
* @typedef {Object} EpochPrimitives
|
|
55
53
|
* @property {(year: number) => number} tMa
|
|
56
|
-
* @property {(year: number) => number} moonDistanceMetres
|
|
54
|
+
* @property {(year: number) => number|null} moonDistanceMetres - null beyond the cited history's span
|
|
57
55
|
* @property {(year: number) => number|null} lodSeconds
|
|
58
56
|
* @property {(year: number) => number} siderealYearSeconds
|
|
59
|
-
* @property {(year: number) => number} tropicalYearSeconds sidereal less one equinox turn per T_p(t) (the composed precession period)
|
|
57
|
+
* @property {(year: number) => number} tropicalYearSeconds sidereal less one equinox turn per T_p(t) (the composed precession period on the RATE of date)
|
|
60
58
|
*/
|
|
61
59
|
|
|
62
60
|
/**
|
|
63
|
-
* @param {{params: EpochParams, alphaAtAgeMa: (tMa: number) => number
|
|
61
|
+
* @param {{params: EpochParams, alphaAtAgeMa: (tMa: number) => number,
|
|
62
|
+
* moonDistanceMetresAtAge: (tMa: number) => number|null,
|
|
63
|
+
* meanObliquityCosRatioAtAge?: (tMa: number) => number|null}} deps —
|
|
64
|
+
* moonDistanceMetresAtAge is the engine's cited distance history
|
|
65
|
+
* (deltat/moon-distance-history: Farhat et al. 2022 as a shape on the
|
|
66
|
+
* J2000 anchor; plan 12 option A — the layer0 quartic twin is deleted);
|
|
67
|
+
* meanObliquityCosRatioAtAge the cited mean obliquity's cos ε̄(t)/cos ε̄(0)
|
|
68
|
+
* (earth/mean-obliquity-history, plan 12 §8 option (a)) — OPTIONAL, absent → 1.
|
|
64
69
|
* @returns {EpochPrimitives}
|
|
65
70
|
*/
|
|
66
|
-
export const createEpochPrimitives = ({ params: p, alphaAtAgeMa }) => {
|
|
71
|
+
export const createEpochPrimitives = ({ params: p, alphaAtAgeMa, moonDistanceMetresAtAge, meanObliquityCosRatioAtAge }) => {
|
|
67
72
|
/**
|
|
68
73
|
* Years before the epoch, in Ma. The ONE place this conversion lives.
|
|
69
74
|
* @param {number} year
|
|
@@ -72,24 +77,29 @@ export const createEpochPrimitives = ({ params: p, alphaAtAgeMa }) => {
|
|
|
72
77
|
const tMa = (year) => (p.epochYear - year) / 1e6;
|
|
73
78
|
|
|
74
79
|
/**
|
|
75
|
-
* Moon
|
|
76
|
-
* are the Farhat 2022 deep-time fit.
|
|
80
|
+
* Moon distance at age t — the cited history (null beyond its span).
|
|
77
81
|
* @param {number} t age in Ma
|
|
78
|
-
* @returns {number} metres
|
|
82
|
+
* @returns {number|null} metres
|
|
79
83
|
*/
|
|
80
|
-
const moonDistanceMetresCore = (t) =>
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
const moonDistanceMetresCore = (t) => moonDistanceMetresAtAge(t);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* cos ε̄(t)/cos ε̄(0) of the cited mean obliquity — the precession RATE's
|
|
88
|
+
* factor on the constant (plan 12 §8); 1 when no history is injected.
|
|
89
|
+
* @param {number} t age in Ma
|
|
90
|
+
* @returns {number|null}
|
|
91
|
+
*/
|
|
92
|
+
const meanObliquityCosRatioCore = (t) => (meanObliquityCosRatioAtAge ? meanObliquityCosRatioAtAge(t) : 1);
|
|
83
93
|
|
|
84
94
|
/**
|
|
85
95
|
* Length of day from angular-momentum conservation: as the Moon recedes it
|
|
86
96
|
* takes orbital angular momentum and Earth's spin slows to compensate.
|
|
87
97
|
* @param {number} t age in Ma
|
|
88
|
-
* @returns {number|null} seconds; null past the tidal-lock asymptote
|
|
98
|
+
* @returns {number|null} seconds; null past the tidal-lock asymptote or the history's span
|
|
89
99
|
*/
|
|
90
100
|
const lodSecondsCore = (t) => {
|
|
91
101
|
const a = moonDistanceMetresCore(t);
|
|
92
|
-
if (a <= 0 || a >= p.moonLockDistanceM) return null;
|
|
102
|
+
if (a === null || a <= 0 || a >= p.moonLockDistanceM) return null;
|
|
93
103
|
const iEarth = alphaAtAgeMa(t) * p.earthMassKg * p.earthRadiusM * p.earthRadiusM;
|
|
94
104
|
return (2 * Math.PI * iEarth)
|
|
95
105
|
/ (p.totalAngularMomentumKgM2S
|
|
@@ -123,7 +133,9 @@ export const createEpochPrimitives = ({ params: p, alphaAtAgeMa }) => {
|
|
|
123
133
|
* Tropical year of date — the sidereal year less the equinox's own motion
|
|
124
134
|
* over one year: one turn per the composed lunisolar precession period
|
|
125
135
|
* T_p(t), i.e. 1/T_trop = 1/T_sid + ψ̇(t)/(1,296,000″ · Julian-year s) with
|
|
126
|
-
* ψ̇(t)
|
|
136
|
+
* ψ̇(t) the RATE of date, spelled as (LOD₀/LOD(t))·p₀·[f_S + (1 − f_S)(a₀/a_M)³]
|
|
137
|
+
* × cos ε̄(t)/cos ε̄(0) — the cited mean obliquity's factor (plan 12 §8 option (a);
|
|
138
|
+
* injected, 1 when absent).
|
|
127
139
|
* Plan 09 step 5d: it was the unit's calendar convention sid·(1 − 13/H(t))
|
|
128
140
|
* (plan 06 D2 kept it as a named device), 0.086 % slow on the equinox term
|
|
129
141
|
* — 1.0 s of year at J2000, integrated by the deep JD↔year calendar. The
|
|
@@ -143,7 +155,8 @@ export const createEpochPrimitives = ({ params: p, alphaAtAgeMa }) => {
|
|
|
143
155
|
const lf = (a === null || !(a > 0)) ? null : Math.pow(p.moonDistanceNowM / a, 3);
|
|
144
156
|
const term = lf === null ? null : p.precessionSolarShareJ2000 + (1 - p.precessionSolarShareJ2000) * lf;
|
|
145
157
|
const p0 = p.precessionRateJ2000ArcsecPerYr;
|
|
146
|
-
const
|
|
158
|
+
const f = meanObliquityCosRatioCore(t);
|
|
159
|
+
const rate = (lod === null || !(lod > 0) || term === null || f === null) ? p0 : (p.lodNowH13Seconds / lod) * p0 * term * f;
|
|
147
160
|
return 1 / (1 / sid + rate / (1296000 * 365.25 * 86400));
|
|
148
161
|
};
|
|
149
162
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angles — ONE home for the degree ↔ radian constants and the wraps
|
|
3
|
+
* (holisticuniverse plan 13 B1). Before B1 the browser carried 27 local
|
|
4
|
+
* `D2R`-style constants and twelve local wrap helpers in three ±180 forms;
|
|
5
|
+
* the package itself a dozen private `D2R`s.
|
|
6
|
+
*
|
|
7
|
+
* The two ±180 forms in use differ only AT the boundary: `wrap180` maps
|
|
8
|
+
* +180 to −180 (the half-open [−180, 180) the longitude-difference sites
|
|
9
|
+
* use), `wrap180Closed` keeps +180 (the (−180, 180] of the residual
|
|
10
|
+
* printers). A site keeps the form it had — B1 moves the formula, never
|
|
11
|
+
* the convention.
|
|
12
|
+
*
|
|
13
|
+
* Pure, no model dependencies.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
/** π/180 — degrees to radians. */
|
|
19
|
+
const DEG2RAD = Math.PI / 180;
|
|
20
|
+
/** 180/π — radians to degrees. */
|
|
21
|
+
const RAD2DEG = 180 / Math.PI;
|
|
22
|
+
/** Arcseconds in a full turn. */
|
|
23
|
+
const ARCSEC_PER_TURN = 1296000;
|
|
24
|
+
/** Arcseconds per radian, 206264.806… */
|
|
25
|
+
const ARCSEC_PER_RAD = (180 / Math.PI) * 3600;
|
|
26
|
+
|
|
27
|
+
/** @param {number} x degrees @returns {number} the same angle in [0, 360) */
|
|
28
|
+
const wrap360 = (x) => ((x % 360) + 360) % 360;
|
|
29
|
+
/** @param {number} x degrees @returns {number} the same angle in [−180, 180) */
|
|
30
|
+
const wrap180 = (x) => ((x + 540) % 360 + 360) % 360 - 180;
|
|
31
|
+
/** @param {number} x degrees @returns {number} the same angle in (−180, 180] */
|
|
32
|
+
const wrap180Closed = (x) => { const w = ((x % 360) + 360) % 360; return w > 180 ? w - 360 : w; };
|
|
33
|
+
/** @param {number} x radians @returns {number} the same angle in [0, 2π) */
|
|
34
|
+
const wrap2pi = (x) => { const tau = 2 * Math.PI; return ((x % tau) + tau) % tau; };
|
|
35
|
+
/** @param {number} x radians @returns {number} the same angle in [−π, π) */
|
|
36
|
+
const wrapPi = (x) => { const tau = 2 * Math.PI; return ((x + Math.PI) % tau + tau) % tau - Math.PI; };
|
|
37
|
+
|
|
38
|
+
module.exports = { DEG2RAD, RAD2DEG, ARCSEC_PER_TURN, ARCSEC_PER_RAD, wrap360, wrap180, wrap180Closed, wrap2pi, wrapPi };
|