@interstellar-tools/equations 1.0.0 → 1.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.
Files changed (85) hide show
  1. package/dist/categories/anomalies/asymptote-true-anomaly.d.ts +50 -0
  2. package/dist/categories/anomalies/asymptote-true-anomaly.d.ts.map +1 -0
  3. package/dist/categories/anomalies/asymptote-true-anomaly.js +55 -0
  4. package/dist/categories/anomalies/asymptote-true-anomaly.js.map +1 -0
  5. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.d.ts +38 -0
  6. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.d.ts.map +1 -0
  7. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.js +49 -0
  8. package/dist/categories/anomalies/hyperbolic-to-true-anomaly.js.map +1 -0
  9. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.d.ts +40 -0
  10. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.d.ts.map +1 -0
  11. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.js +54 -0
  12. package/dist/categories/anomalies/true-to-hyperbolic-anomaly.js.map +1 -0
  13. package/dist/categories/helpers/misc.d.ts +18 -0
  14. package/dist/categories/helpers/misc.d.ts.map +1 -1
  15. package/dist/categories/helpers/misc.js +24 -0
  16. package/dist/categories/helpers/misc.js.map +1 -1
  17. package/dist/categories/kepler/solve-kepler-hyperbolic.d.ts +49 -0
  18. package/dist/categories/kepler/solve-kepler-hyperbolic.d.ts.map +1 -0
  19. package/dist/categories/kepler/solve-kepler-hyperbolic.js +90 -0
  20. package/dist/categories/kepler/solve-kepler-hyperbolic.js.map +1 -0
  21. package/dist/categories/manoeuvres/burn-time.d.ts +63 -0
  22. package/dist/categories/manoeuvres/burn-time.d.ts.map +1 -0
  23. package/dist/categories/manoeuvres/burn-time.js +87 -0
  24. package/dist/categories/manoeuvres/burn-time.js.map +1 -0
  25. package/dist/categories/manoeuvres/gravity-loss.d.ts +48 -0
  26. package/dist/categories/manoeuvres/gravity-loss.d.ts.map +1 -0
  27. package/dist/categories/manoeuvres/gravity-loss.js +74 -0
  28. package/dist/categories/manoeuvres/gravity-loss.js.map +1 -0
  29. package/dist/categories/manoeuvres/initial-mass-for-delta-v.d.ts +60 -0
  30. package/dist/categories/manoeuvres/initial-mass-for-delta-v.d.ts.map +1 -0
  31. package/dist/categories/manoeuvres/initial-mass-for-delta-v.js +79 -0
  32. package/dist/categories/manoeuvres/initial-mass-for-delta-v.js.map +1 -0
  33. package/dist/categories/manoeuvres/mass-flow-rate.d.ts +57 -0
  34. package/dist/categories/manoeuvres/mass-flow-rate.d.ts.map +1 -0
  35. package/dist/categories/manoeuvres/mass-flow-rate.js +73 -0
  36. package/dist/categories/manoeuvres/mass-flow-rate.js.map +1 -0
  37. package/dist/categories/manoeuvres/rocket-thrust.d.ts +48 -0
  38. package/dist/categories/manoeuvres/rocket-thrust.d.ts.map +1 -0
  39. package/dist/categories/manoeuvres/rocket-thrust.js +62 -0
  40. package/dist/categories/manoeuvres/rocket-thrust.js.map +1 -0
  41. package/dist/categories/manoeuvres/thrust-to-weight.d.ts +57 -0
  42. package/dist/categories/manoeuvres/thrust-to-weight.d.ts.map +1 -0
  43. package/dist/categories/manoeuvres/thrust-to-weight.js +73 -0
  44. package/dist/categories/manoeuvres/thrust-to-weight.js.map +1 -0
  45. package/dist/categories/orbits/elements-to-state.d.ts +61 -0
  46. package/dist/categories/orbits/elements-to-state.d.ts.map +1 -0
  47. package/dist/categories/orbits/elements-to-state.js +107 -0
  48. package/dist/categories/orbits/elements-to-state.js.map +1 -0
  49. package/dist/categories/orbits/hyperbolic-eccentricity.d.ts +56 -0
  50. package/dist/categories/orbits/hyperbolic-eccentricity.d.ts.map +1 -0
  51. package/dist/categories/orbits/hyperbolic-eccentricity.js +72 -0
  52. package/dist/categories/orbits/hyperbolic-eccentricity.js.map +1 -0
  53. package/dist/categories/orbits/hyperbolic-semi-major-axis.d.ts +53 -0
  54. package/dist/categories/orbits/hyperbolic-semi-major-axis.d.ts.map +1 -0
  55. package/dist/categories/orbits/hyperbolic-semi-major-axis.js +66 -0
  56. package/dist/categories/orbits/hyperbolic-semi-major-axis.js.map +1 -0
  57. package/dist/categories/orbits/hyperbolic-time-of-flight.d.ts +64 -0
  58. package/dist/categories/orbits/hyperbolic-time-of-flight.d.ts.map +1 -0
  59. package/dist/categories/orbits/hyperbolic-time-of-flight.js +86 -0
  60. package/dist/categories/orbits/hyperbolic-time-of-flight.js.map +1 -0
  61. package/dist/categories/orbits/inclination-from-launch-azimuth.d.ts +64 -0
  62. package/dist/categories/orbits/inclination-from-launch-azimuth.d.ts.map +1 -0
  63. package/dist/categories/orbits/inclination-from-launch-azimuth.js +76 -0
  64. package/dist/categories/orbits/inclination-from-launch-azimuth.js.map +1 -0
  65. package/dist/categories/orbits/launch-azimuth-for-inclination.d.ts +71 -0
  66. package/dist/categories/orbits/launch-azimuth-for-inclination.d.ts.map +1 -0
  67. package/dist/categories/orbits/launch-azimuth-for-inclination.js +87 -0
  68. package/dist/categories/orbits/launch-azimuth-for-inclination.js.map +1 -0
  69. package/dist/categories/orbits/rotating-launch-azimuth.d.ts +49 -0
  70. package/dist/categories/orbits/rotating-launch-azimuth.d.ts.map +1 -0
  71. package/dist/categories/orbits/rotating-launch-azimuth.js +65 -0
  72. package/dist/categories/orbits/rotating-launch-azimuth.js.map +1 -0
  73. package/dist/categories/orbits/state-to-elements.d.ts +82 -0
  74. package/dist/categories/orbits/state-to-elements.d.ts.map +1 -0
  75. package/dist/categories/orbits/state-to-elements.js +131 -0
  76. package/dist/categories/orbits/state-to-elements.js.map +1 -0
  77. package/dist/categories/orbits/surface-rotation-speed.d.ts +61 -0
  78. package/dist/categories/orbits/surface-rotation-speed.d.ts.map +1 -0
  79. package/dist/categories/orbits/surface-rotation-speed.js +74 -0
  80. package/dist/categories/orbits/surface-rotation-speed.js.map +1 -0
  81. package/dist/index.d.ts +19 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +19 -0
  84. package/dist/index.js.map +1 -1
  85. package/package.json +1 -1
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Compute the **burn time** needed for a given delta-v, at constant thrust and mass flow.
3
+ *
4
+ * $$
5
+ * t_b = \frac{m_0 - m_f}{\dot m} = \frac{m_0\, I_{sp}\, g_0}{F}\left(1 - e^{-\Delta v/(I_{sp} g_0)}\right)
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ m_0 $ is the mass at ignition (kg)
10
+ * - $ \Delta v $ is the delta-v of the burn (m/s)
11
+ * - $ F $ is the thrust (N)
12
+ * - $ I_{sp} $ is the specific impulse (s)
13
+ * - $ g_0 $ is standard gravity (m/s²)
14
+ *
15
+ * **Units**
16
+ * - Inputs: `m0` in **kg**, `dv` in **m/s**, `F` in **N**, `Isp` in **s**, `g0` in **m/s²**.
17
+ * - Output: $ t_b $ in **s**.
18
+ *
19
+ * ::: info Notes
20
+ *
21
+ * - The propellant used, $ m_0 - m_f $, comes from the rocket equation; the burn time is that mass divided by the {@link massFlowRate}.
22
+ * - Assumes constant thrust and specific impulse. A throttled engine, like Apollo's descent engine, needs the burn split into steps.
23
+ * - `dv = 0` gives a burn time of 0.
24
+ *
25
+ * :::
26
+ *
27
+ * ::: practice Apollo 11's lunar module, leaving the Moon
28
+ *
29
+ * **439 s**
30
+ *
31
+ * _Ascent stage, 4 888 kg, for 1 850.2 m/s_
32
+ *
33
+ * The flown burn took 434.9 s, 1% less: the thrust and specific impulse used here are the pre-flight predictions.
34
+ *
35
+ * ```ts
36
+ * burnTime(4888, 1850.2, 15_409, 309); // ≈ 439.3 s
37
+ * ```
38
+ *
39
+ * :::
40
+ *
41
+ * @param m0 - Mass at ignition $ m_0 $ in **kg** (finite, > 0).
42
+ * @param dv - Delta-v of the burn $ \Delta v $ in **m/s** (finite, >= 0).
43
+ * @param F - Thrust $ F $ in **N** (finite, > 0).
44
+ * @param Isp - Specific impulse $ I_{sp} $ in **seconds** (finite, > 0).
45
+ * @param g0 - Standard gravity $ g_0 $ in **m/s²** (finite, > 0). Defaults to `9.80665`.
46
+ * @returns Burn time $ t_b $ in **s**.
47
+ * @throws {TypeError} If any input is not a finite number.
48
+ * @throws {RangeError} If `m0 <= 0`, `dv < 0`, `F <= 0`, `Isp <= 0` or `g0 <= 0`.
49
+ * @group Manoeuvres
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * // A 1200 kg spacecraft, 500 m/s with a 400 N engine at Isp = 320 s
54
+ * const t = burnTime(1200, 500, 400, 320);
55
+ * // t ≈ 1200 * 3138.1 / 400 * (1 - e^(-500/3138.1)) ≈ 1387 s
56
+ * ```
57
+ *
58
+ * @see {@link massFlowRate}
59
+ * @see {@link rocketDeltaVFromIsp}
60
+ * @see https://en.wikipedia.org/wiki/Tsiolkovsky_rocket_equation Tsiolkovsky rocket equation
61
+ */
62
+ export const burnTime = (m0, dv, F, Isp, g0 = 9.80665) => {
63
+ for (const [name, v] of [
64
+ ['m0', m0],
65
+ ['dv', dv],
66
+ ['F', F],
67
+ ['Isp', Isp],
68
+ ['g0', g0]
69
+ ]) {
70
+ if (!Number.isFinite(v))
71
+ throw new TypeError(`${name} must be a finite number. Received: ${v}`);
72
+ }
73
+ if (m0 <= 0)
74
+ throw new RangeError(`m0 must be > 0. Received: ${m0}`);
75
+ if (dv < 0)
76
+ throw new RangeError(`dv must be >= 0. Received: ${dv}`);
77
+ if (F <= 0)
78
+ throw new RangeError(`F must be > 0. Received: ${F}`);
79
+ if (Isp <= 0)
80
+ throw new RangeError(`Isp must be > 0. Received: ${Isp}`);
81
+ if (g0 <= 0)
82
+ throw new RangeError(`g0 must be > 0. Received: ${g0}`);
83
+ const ve = Isp * g0;
84
+ // -expm1(-x) = 1 - e^(-x), accurate for small burns
85
+ return ((m0 * ve) / F) * -Math.expm1(-dv / ve);
86
+ };
87
+ //# sourceMappingURL=burn-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"burn-time.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/burn-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,EAAU,EACV,EAAU,EACV,CAAS,EACT,GAAW,EACX,EAAE,GAAG,OAAO,EACJ,EAAE;IACV,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,GAAG,EAAE,CAAC,CAAC;QACR,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,IAAI,EAAE,EAAE,CAAC;KACF,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,IAAI,EAAE,GAAG,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;IAErE,IAAI,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAElE,IAAI,GAAG,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;IAExE,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;IAEpB,oDAAoD;IACpD,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;AACjD,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import type { Radians } from '@interstellar-tools/types';
2
+ /**
3
+ * Compute the **gravity loss** of a burn from samples of gravity and flight-path angle.
4
+ *
5
+ * $$
6
+ * \Delta v_g = \int_0^{t_b} g \sin\gamma \, dt
7
+ * $$
8
+ *
9
+ * integrated with the trapezoidal rule over equally spaced samples.
10
+ *
11
+ * Where:
12
+ * - $ g $ is the local gravitational acceleration (m/s²)
13
+ * - $ \gamma $ is the flight-path angle above the local horizontal (rad)
14
+ * - $ t_b $ is the burn time (s)
15
+ *
16
+ * **Units**
17
+ * - Inputs: `g` in **m/s²**, `gamma` in **radians**, `dt` in **s**.
18
+ * - Output: $ \Delta v_g $ in **m/s**.
19
+ *
20
+ * ::: info Notes
21
+ *
22
+ * - Thrust spent holding a rocket up against gravity doesn't speed it up. The loss is largest for a vertical climb ($ \gamma = 90° $) and zero for a horizontal burn ($ \gamma = 0 $).
23
+ * - The delta-v a rocket must carry is its orbital delta-v plus its gravity, drag and steering losses.
24
+ * - Pass `g` as one number when it's constant over the burn, or as samples matching `gamma`.
25
+ *
26
+ * :::
27
+ *
28
+ * @param g - Gravitational acceleration in **m/s²**: one value, or one sample per entry of `gamma` (finite, >= 0).
29
+ * @param gamma - Flight-path angles $ \gamma $ in **radians**, sampled every `dt` seconds (at least 2 samples, each finite).
30
+ * @param dt - Time between samples in **s** (finite, > 0).
31
+ * @returns Gravity loss $ \Delta v_g $ in **m/s**. Negative when the vehicle is mostly descending.
32
+ * @throws {TypeError} If any input is not a finite number, or `g` and `gamma` have different lengths.
33
+ * @throws {RangeError} If `gamma` has fewer than 2 samples, `dt <= 0` or any `g < 0`.
34
+ * @group Manoeuvres
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * import type { Radians } from '@interstellar-tools/types';
39
+ *
40
+ * // A 10 s vertical climb in constant Earth gravity
41
+ * const vertical = Array.from({ length: 11 }, () => (Math.PI / 2) as Radians);
42
+ * gravityLoss(9.80665, vertical, 1); // ≈ 98.07 m/s
43
+ * ```
44
+ *
45
+ * @see https://en.wikipedia.org/wiki/Gravity_drag Gravity drag
46
+ */
47
+ export declare const gravityLoss: (g: number | readonly number[], gamma: readonly Radians[], dt: number) => number;
48
+ //# sourceMappingURL=gravity-loss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gravity-loss.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/gravity-loss.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,WAAW,GACtB,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,EAC7B,OAAO,SAAS,OAAO,EAAE,EACzB,IAAI,MAAM,KACT,MA2CF,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Compute the **gravity loss** of a burn from samples of gravity and flight-path angle.
3
+ *
4
+ * $$
5
+ * \Delta v_g = \int_0^{t_b} g \sin\gamma \, dt
6
+ * $$
7
+ *
8
+ * integrated with the trapezoidal rule over equally spaced samples.
9
+ *
10
+ * Where:
11
+ * - $ g $ is the local gravitational acceleration (m/s²)
12
+ * - $ \gamma $ is the flight-path angle above the local horizontal (rad)
13
+ * - $ t_b $ is the burn time (s)
14
+ *
15
+ * **Units**
16
+ * - Inputs: `g` in **m/s²**, `gamma` in **radians**, `dt` in **s**.
17
+ * - Output: $ \Delta v_g $ in **m/s**.
18
+ *
19
+ * ::: info Notes
20
+ *
21
+ * - Thrust spent holding a rocket up against gravity doesn't speed it up. The loss is largest for a vertical climb ($ \gamma = 90° $) and zero for a horizontal burn ($ \gamma = 0 $).
22
+ * - The delta-v a rocket must carry is its orbital delta-v plus its gravity, drag and steering losses.
23
+ * - Pass `g` as one number when it's constant over the burn, or as samples matching `gamma`.
24
+ *
25
+ * :::
26
+ *
27
+ * @param g - Gravitational acceleration in **m/s²**: one value, or one sample per entry of `gamma` (finite, >= 0).
28
+ * @param gamma - Flight-path angles $ \gamma $ in **radians**, sampled every `dt` seconds (at least 2 samples, each finite).
29
+ * @param dt - Time between samples in **s** (finite, > 0).
30
+ * @returns Gravity loss $ \Delta v_g $ in **m/s**. Negative when the vehicle is mostly descending.
31
+ * @throws {TypeError} If any input is not a finite number, or `g` and `gamma` have different lengths.
32
+ * @throws {RangeError} If `gamma` has fewer than 2 samples, `dt <= 0` or any `g < 0`.
33
+ * @group Manoeuvres
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import type { Radians } from '@interstellar-tools/types';
38
+ *
39
+ * // A 10 s vertical climb in constant Earth gravity
40
+ * const vertical = Array.from({ length: 11 }, () => (Math.PI / 2) as Radians);
41
+ * gravityLoss(9.80665, vertical, 1); // ≈ 98.07 m/s
42
+ * ```
43
+ *
44
+ * @see https://en.wikipedia.org/wiki/Gravity_drag Gravity drag
45
+ */
46
+ export const gravityLoss = (g, gamma, dt) => {
47
+ if (!Number.isFinite(dt))
48
+ throw new TypeError(`dt must be a finite number. Received: ${dt}`);
49
+ if (dt <= 0)
50
+ throw new RangeError(`dt must be > 0. Received: ${dt}`);
51
+ if (gamma.length < 2)
52
+ throw new RangeError(`gamma must have at least 2 samples. Received: ${gamma.length}`);
53
+ if (typeof g !== 'number' && g.length !== gamma.length)
54
+ throw new TypeError(`g must be a number or have one sample per gamma. Received: ${g.length} for ${gamma.length}`);
55
+ const at = (i) => {
56
+ const gi = typeof g === 'number' ? g : g[i];
57
+ if (!Number.isFinite(gi))
58
+ throw new TypeError(`g must be finite. Received: ${gi} at ${i}`);
59
+ if (gi < 0)
60
+ throw new RangeError(`g must be >= 0. Received: ${gi} at ${i}`);
61
+ if (!Number.isFinite(gamma[i]))
62
+ throw new TypeError(`gamma must be finite. Received: ${gamma[i]} at ${i}`);
63
+ return gi * Math.sin(gamma[i]);
64
+ };
65
+ let loss = 0;
66
+ let previous = at(0);
67
+ for (let i = 1; i < gamma.length; i++) {
68
+ const current = at(i);
69
+ loss += ((previous + current) / 2) * dt;
70
+ previous = current;
71
+ }
72
+ return loss;
73
+ };
74
+ //# sourceMappingURL=gravity-loss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gravity-loss.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/gravity-loss.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,CAA6B,EAC7B,KAAyB,EACzB,EAAU,EACF,EAAE;IACV,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,SAAS,CAAC,yCAAyC,EAAE,EAAE,CAAC,CAAC;IAErE,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAClB,MAAM,IAAI,UAAU,CAClB,iDAAiD,KAAK,CAAC,MAAM,EAAE,CAChE,CAAC;IAEJ,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QACpD,MAAM,IAAI,SAAS,CACjB,8DAA8D,CAAC,CAAC,MAAM,QAAQ,KAAK,CAAC,MAAM,EAAE,CAC7F,CAAC;IAEJ,MAAM,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE;QACvB,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,SAAS,CAAC,+BAA+B,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAEnE,IAAI,EAAE,GAAG,CAAC;YAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAE5E,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,MAAM,IAAI,SAAS,CACjB,mCAAmC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CACtD,CAAC;QAEJ,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC;IAEF,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAErB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAEtB,IAAI,IAAI,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACxC,QAAQ,GAAG,OAAO,CAAC;IACrB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Compute the **mass needed at ignition** to give a final mass a delta-v: the rocket equation solved for $ m_0 $.
3
+ *
4
+ * $$
5
+ * m_0 = m_f\, e^{\Delta v/(I_{sp}\, g_0)}
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ m_f $ is the mass left after the burn (kg)
10
+ * - $ \Delta v $ is the delta-v of the burn (m/s)
11
+ * - $ I_{sp} $ is the specific impulse (s)
12
+ * - $ g_0 $ is standard gravity (m/s²)
13
+ *
14
+ * **Units**
15
+ * - Inputs: `mf` in **kg**, `dv` in **m/s**, `Isp` in **s**, `g0` in **m/s²**.
16
+ * - Output: $ m_0 $ in **kg**.
17
+ *
18
+ * ::: info Notes
19
+ *
20
+ * - The factor $ e^{\Delta v/(I_{sp} g_0)} $ is the price of the burn: every kilogram left after it costs that many kilograms before it.
21
+ * - For a sequence of burns, work backwards from the last one: each burn's $ m_0 $ is the previous burn's $ m_f $.
22
+ * - This is the ideal rocket equation: the result counts propellant, not the tanks and engines that hold and burn it.
23
+ *
24
+ * :::
25
+ *
26
+ * ::: practice Apollo 11's lunar module, before landing
27
+ *
28
+ * **9 905 kg**
29
+ *
30
+ * _To land with a 4 888 kg ascent stage, for 2 112.3 m/s at 305 s_
31
+ *
32
+ * The real lunar module weighed 15 279 kg at undocking: the rest is the descent stage's own structure, engine and legs.
33
+ *
34
+ * ```ts
35
+ * initialMassForDeltaV(4888, 2112.3, 305); // ≈ 9905 kg
36
+ * ```
37
+ *
38
+ * :::
39
+ *
40
+ * @param mf - Mass after the burn $ m_f $ in **kg** (finite, > 0).
41
+ * @param dv - Delta-v of the burn $ \Delta v $ in **m/s** (finite, >= 0).
42
+ * @param Isp - Specific impulse $ I_{sp} $ in **seconds** (finite, > 0).
43
+ * @param g0 - Standard gravity $ g_0 $ in **m/s²** (finite, > 0). Defaults to `9.80665`.
44
+ * @returns Mass at ignition $ m_0 $ in **kg**.
45
+ * @throws {TypeError} If any input is not a finite number.
46
+ * @throws {RangeError} If `mf <= 0`, `dv < 0`, `Isp <= 0` or `g0 <= 0`.
47
+ * @group Manoeuvres
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // 800 kg left after a 1270 m/s burn at Isp = 320 s
52
+ * const m0 = initialMassForDeltaV(800, 1270, 320);
53
+ * // m0 ≈ 800 * e^(1270 / 3138.1) ≈ 1200 kg
54
+ * ```
55
+ *
56
+ * @see {@link rocketDeltaVFromIsp}
57
+ * @see https://en.wikipedia.org/wiki/Tsiolkovsky_rocket_equation Tsiolkovsky rocket equation
58
+ */
59
+ export declare const initialMassForDeltaV: (mf: number, dv: number, Isp: number, g0?: number) => number;
60
+ //# sourceMappingURL=initial-mass-for-delta-v.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initial-mass-for-delta-v.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/initial-mass-for-delta-v.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,oBAAoB,GAC/B,IAAI,MAAM,EACV,IAAI,MAAM,EACV,KAAK,MAAM,EACX,WAAY,KACX,MAoBF,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Compute the **mass needed at ignition** to give a final mass a delta-v: the rocket equation solved for $ m_0 $.
3
+ *
4
+ * $$
5
+ * m_0 = m_f\, e^{\Delta v/(I_{sp}\, g_0)}
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ m_f $ is the mass left after the burn (kg)
10
+ * - $ \Delta v $ is the delta-v of the burn (m/s)
11
+ * - $ I_{sp} $ is the specific impulse (s)
12
+ * - $ g_0 $ is standard gravity (m/s²)
13
+ *
14
+ * **Units**
15
+ * - Inputs: `mf` in **kg**, `dv` in **m/s**, `Isp` in **s**, `g0` in **m/s²**.
16
+ * - Output: $ m_0 $ in **kg**.
17
+ *
18
+ * ::: info Notes
19
+ *
20
+ * - The factor $ e^{\Delta v/(I_{sp} g_0)} $ is the price of the burn: every kilogram left after it costs that many kilograms before it.
21
+ * - For a sequence of burns, work backwards from the last one: each burn's $ m_0 $ is the previous burn's $ m_f $.
22
+ * - This is the ideal rocket equation: the result counts propellant, not the tanks and engines that hold and burn it.
23
+ *
24
+ * :::
25
+ *
26
+ * ::: practice Apollo 11's lunar module, before landing
27
+ *
28
+ * **9 905 kg**
29
+ *
30
+ * _To land with a 4 888 kg ascent stage, for 2 112.3 m/s at 305 s_
31
+ *
32
+ * The real lunar module weighed 15 279 kg at undocking: the rest is the descent stage's own structure, engine and legs.
33
+ *
34
+ * ```ts
35
+ * initialMassForDeltaV(4888, 2112.3, 305); // ≈ 9905 kg
36
+ * ```
37
+ *
38
+ * :::
39
+ *
40
+ * @param mf - Mass after the burn $ m_f $ in **kg** (finite, > 0).
41
+ * @param dv - Delta-v of the burn $ \Delta v $ in **m/s** (finite, >= 0).
42
+ * @param Isp - Specific impulse $ I_{sp} $ in **seconds** (finite, > 0).
43
+ * @param g0 - Standard gravity $ g_0 $ in **m/s²** (finite, > 0). Defaults to `9.80665`.
44
+ * @returns Mass at ignition $ m_0 $ in **kg**.
45
+ * @throws {TypeError} If any input is not a finite number.
46
+ * @throws {RangeError} If `mf <= 0`, `dv < 0`, `Isp <= 0` or `g0 <= 0`.
47
+ * @group Manoeuvres
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // 800 kg left after a 1270 m/s burn at Isp = 320 s
52
+ * const m0 = initialMassForDeltaV(800, 1270, 320);
53
+ * // m0 ≈ 800 * e^(1270 / 3138.1) ≈ 1200 kg
54
+ * ```
55
+ *
56
+ * @see {@link rocketDeltaVFromIsp}
57
+ * @see https://en.wikipedia.org/wiki/Tsiolkovsky_rocket_equation Tsiolkovsky rocket equation
58
+ */
59
+ export const initialMassForDeltaV = (mf, dv, Isp, g0 = 9.80665) => {
60
+ for (const [name, v] of [
61
+ ['mf', mf],
62
+ ['dv', dv],
63
+ ['Isp', Isp],
64
+ ['g0', g0]
65
+ ]) {
66
+ if (!Number.isFinite(v))
67
+ throw new TypeError(`${name} must be a finite number. Received: ${v}`);
68
+ }
69
+ if (mf <= 0)
70
+ throw new RangeError(`mf must be > 0. Received: ${mf}`);
71
+ if (dv < 0)
72
+ throw new RangeError(`dv must be >= 0. Received: ${dv}`);
73
+ if (Isp <= 0)
74
+ throw new RangeError(`Isp must be > 0. Received: ${Isp}`);
75
+ if (g0 <= 0)
76
+ throw new RangeError(`g0 must be > 0. Received: ${g0}`);
77
+ return mf * Math.exp(dv / (Isp * g0));
78
+ };
79
+ //# sourceMappingURL=initial-mass-for-delta-v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initial-mass-for-delta-v.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/initial-mass-for-delta-v.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,EAAU,EACV,EAAU,EACV,GAAW,EACX,EAAE,GAAG,OAAO,EACJ,EAAE;IACV,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,IAAI,EAAE,EAAE,CAAC;KACF,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,IAAI,EAAE,GAAG,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;IAErE,IAAI,GAAG,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;IAExE,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Compute the **mass flow rate** of a rocket engine from its thrust and specific impulse.
3
+ *
4
+ * $$
5
+ * \dot m = \frac{F}{I_{sp}\, g_0}
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ F $ is the thrust (N)
10
+ * - $ I_{sp} $ is the specific impulse (s)
11
+ * - $ g_0 $ is standard gravity (m/s²)
12
+ *
13
+ * **Units**
14
+ * - Inputs: `F` in **N**, `Isp` in **s**, `g0` in **m/s²**.
15
+ * - Output: $ \dot m $ in **kg/s**.
16
+ *
17
+ * ::: info Notes
18
+ *
19
+ * - $ I_{sp}\, g_0 $ is the effective exhaust velocity $ v_e $, so this is $ F = \dot m\, v_e $ solved for $ \dot m $.
20
+ * - `g0` defaults to **9.80665 m/s²** (standard gravity). It converts the units of $ I_{sp} $; it is not the local gravity.
21
+ *
22
+ * :::
23
+ *
24
+ * ::: practice Apollo 11's lunar module, leaving the Moon
25
+ *
26
+ * **5.09 kg/s**
27
+ *
28
+ * _Ascent engine, 15 409 N at 309 s_
29
+ *
30
+ * The ascent stage burned about 5 kg of propellant a second for its 7-minute climb to lunar orbit.
31
+ *
32
+ * ```ts
33
+ * massFlowRate(15_409, 309); // ≈ 5.085 kg/s
34
+ * ```
35
+ *
36
+ * :::
37
+ *
38
+ * @param F - Thrust $ F $ in **N** (finite, > 0).
39
+ * @param Isp - Specific impulse $ I_{sp} $ in **seconds** (finite, > 0).
40
+ * @param g0 - Standard gravity $ g_0 $ in **m/s²** (finite, > 0). Defaults to `9.80665`.
41
+ * @returns Mass flow rate $ \dot m $ in **kg/s**.
42
+ * @throws {TypeError} If any input is not a finite number.
43
+ * @throws {RangeError} If `F <= 0`, `Isp <= 0` or `g0 <= 0`.
44
+ * @group Manoeuvres
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // A 1 kN thruster with Isp = 300 s
49
+ * const mDot = massFlowRate(1000, 300);
50
+ * // mDot ≈ 1000 / (300 * 9.80665) ≈ 0.340 kg/s
51
+ * ```
52
+ *
53
+ * @see {@link burnTime}
54
+ * @see {@link rocketThrust}
55
+ */
56
+ export declare const massFlowRate: (F: number, Isp: number, g0?: number) => number;
57
+ //# sourceMappingURL=mass-flow-rate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mass-flow-rate.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/mass-flow-rate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,EAAE,KAAK,MAAM,EAAE,WAAY,KAAG,MAiBnE,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Compute the **mass flow rate** of a rocket engine from its thrust and specific impulse.
3
+ *
4
+ * $$
5
+ * \dot m = \frac{F}{I_{sp}\, g_0}
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ F $ is the thrust (N)
10
+ * - $ I_{sp} $ is the specific impulse (s)
11
+ * - $ g_0 $ is standard gravity (m/s²)
12
+ *
13
+ * **Units**
14
+ * - Inputs: `F` in **N**, `Isp` in **s**, `g0` in **m/s²**.
15
+ * - Output: $ \dot m $ in **kg/s**.
16
+ *
17
+ * ::: info Notes
18
+ *
19
+ * - $ I_{sp}\, g_0 $ is the effective exhaust velocity $ v_e $, so this is $ F = \dot m\, v_e $ solved for $ \dot m $.
20
+ * - `g0` defaults to **9.80665 m/s²** (standard gravity). It converts the units of $ I_{sp} $; it is not the local gravity.
21
+ *
22
+ * :::
23
+ *
24
+ * ::: practice Apollo 11's lunar module, leaving the Moon
25
+ *
26
+ * **5.09 kg/s**
27
+ *
28
+ * _Ascent engine, 15 409 N at 309 s_
29
+ *
30
+ * The ascent stage burned about 5 kg of propellant a second for its 7-minute climb to lunar orbit.
31
+ *
32
+ * ```ts
33
+ * massFlowRate(15_409, 309); // ≈ 5.085 kg/s
34
+ * ```
35
+ *
36
+ * :::
37
+ *
38
+ * @param F - Thrust $ F $ in **N** (finite, > 0).
39
+ * @param Isp - Specific impulse $ I_{sp} $ in **seconds** (finite, > 0).
40
+ * @param g0 - Standard gravity $ g_0 $ in **m/s²** (finite, > 0). Defaults to `9.80665`.
41
+ * @returns Mass flow rate $ \dot m $ in **kg/s**.
42
+ * @throws {TypeError} If any input is not a finite number.
43
+ * @throws {RangeError} If `F <= 0`, `Isp <= 0` or `g0 <= 0`.
44
+ * @group Manoeuvres
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // A 1 kN thruster with Isp = 300 s
49
+ * const mDot = massFlowRate(1000, 300);
50
+ * // mDot ≈ 1000 / (300 * 9.80665) ≈ 0.340 kg/s
51
+ * ```
52
+ *
53
+ * @see {@link burnTime}
54
+ * @see {@link rocketThrust}
55
+ */
56
+ export const massFlowRate = (F, Isp, g0 = 9.80665) => {
57
+ for (const [name, v] of [
58
+ ['F', F],
59
+ ['Isp', Isp],
60
+ ['g0', g0]
61
+ ]) {
62
+ if (!Number.isFinite(v))
63
+ throw new TypeError(`${name} must be a finite number. Received: ${v}`);
64
+ }
65
+ if (F <= 0)
66
+ throw new RangeError(`F must be > 0. Received: ${F}`);
67
+ if (Isp <= 0)
68
+ throw new RangeError(`Isp must be > 0. Received: ${Isp}`);
69
+ if (g0 <= 0)
70
+ throw new RangeError(`g0 must be > 0. Received: ${g0}`);
71
+ return F / (Isp * g0);
72
+ };
73
+ //# sourceMappingURL=mass-flow-rate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mass-flow-rate.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/mass-flow-rate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,GAAW,EAAE,EAAE,GAAG,OAAO,EAAU,EAAE;IAC3E,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,GAAG,EAAE,CAAC,CAAC;QACR,CAAC,KAAK,EAAE,GAAG,CAAC;QACZ,CAAC,IAAI,EAAE,EAAE,CAAC;KACF,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAElE,IAAI,GAAG,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;IAExE,IAAI,EAAE,IAAI,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IAErE,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;AACxB,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Compute the **thrust** of a rocket engine from its exhaust, including the pressure term.
3
+ *
4
+ * $$
5
+ * F = \dot m\, v_e + (p_e - p_a)\, A_e
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ \dot m $ is the mass flow rate (kg/s)
10
+ * - $ v_e $ is the exhaust velocity at the nozzle exit (m/s)
11
+ * - $ p_e $ is the pressure at the nozzle exit (Pa)
12
+ * - $ p_a $ is the ambient pressure (Pa), 0 in vacuum
13
+ * - $ A_e $ is the nozzle exit area (m²)
14
+ *
15
+ * **Units**
16
+ * - Inputs: `mDot` in **kg/s**, `ve` in **m/s**, `pe` and `pa` in **Pa**, `Ae` in **m²**.
17
+ * - Output: $ F $ in **N**.
18
+ *
19
+ * ::: info Notes
20
+ *
21
+ * - The same engine gives more thrust in vacuum than at sea level: $ p_a $ pushes back on the nozzle exit.
22
+ * - A nozzle with $ p_e < p_a $ is over-expanded, and the pressure term reduces the thrust.
23
+ * - With $ p_e = p_a $ the thrust is $ \dot m\, v_e $, and $ v_e $ equals $ I_{sp}\, g_0 $.
24
+ *
25
+ * :::
26
+ *
27
+ * @param mDot - Mass flow rate $ \dot m $ in **kg/s** (finite, >= 0).
28
+ * @param ve - Exhaust velocity $ v_e $ in **m/s** (finite, >= 0).
29
+ * @param pe - Nozzle exit pressure $ p_e $ in **Pa** (finite, >= 0).
30
+ * @param pa - Ambient pressure $ p_a $ in **Pa** (finite, >= 0).
31
+ * @param Ae - Nozzle exit area $ A_e $ in **m²** (finite, >= 0).
32
+ * @returns Thrust $ F $ in **N**. Can be negative for a badly over-expanded nozzle with little flow.
33
+ * @throws {TypeError} If any input is not a finite number.
34
+ * @throws {RangeError} If any input is negative.
35
+ * @group Manoeuvres
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // 250 kg/s at 3000 m/s, exit at 70 kPa through a 1.2 m² nozzle
40
+ * const vacuum = rocketThrust(250, 3000, 70_000, 0, 1.2); // 834 000 N
41
+ * const seaLevel = rocketThrust(250, 3000, 70_000, 101_325, 1.2); // ≈ 712 410 N
42
+ * ```
43
+ *
44
+ * @see {@link massFlowRate}
45
+ * @see https://en.wikipedia.org/wiki/Rocket_engine_nozzle Rocket engine nozzle (thrust equation)
46
+ */
47
+ export declare const rocketThrust: (mDot: number, ve: number, pe: number, pa: number, Ae: number) => number;
48
+ //# sourceMappingURL=rocket-thrust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rocket-thrust.d.ts","sourceRoot":"","sources":["../../../src/categories/manoeuvres/rocket-thrust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,IAAI,MAAM,EACV,IAAI,MAAM,EACV,IAAI,MAAM,EACV,IAAI,MAAM,KACT,MAeF,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Compute the **thrust** of a rocket engine from its exhaust, including the pressure term.
3
+ *
4
+ * $$
5
+ * F = \dot m\, v_e + (p_e - p_a)\, A_e
6
+ * $$
7
+ *
8
+ * Where:
9
+ * - $ \dot m $ is the mass flow rate (kg/s)
10
+ * - $ v_e $ is the exhaust velocity at the nozzle exit (m/s)
11
+ * - $ p_e $ is the pressure at the nozzle exit (Pa)
12
+ * - $ p_a $ is the ambient pressure (Pa), 0 in vacuum
13
+ * - $ A_e $ is the nozzle exit area (m²)
14
+ *
15
+ * **Units**
16
+ * - Inputs: `mDot` in **kg/s**, `ve` in **m/s**, `pe` and `pa` in **Pa**, `Ae` in **m²**.
17
+ * - Output: $ F $ in **N**.
18
+ *
19
+ * ::: info Notes
20
+ *
21
+ * - The same engine gives more thrust in vacuum than at sea level: $ p_a $ pushes back on the nozzle exit.
22
+ * - A nozzle with $ p_e < p_a $ is over-expanded, and the pressure term reduces the thrust.
23
+ * - With $ p_e = p_a $ the thrust is $ \dot m\, v_e $, and $ v_e $ equals $ I_{sp}\, g_0 $.
24
+ *
25
+ * :::
26
+ *
27
+ * @param mDot - Mass flow rate $ \dot m $ in **kg/s** (finite, >= 0).
28
+ * @param ve - Exhaust velocity $ v_e $ in **m/s** (finite, >= 0).
29
+ * @param pe - Nozzle exit pressure $ p_e $ in **Pa** (finite, >= 0).
30
+ * @param pa - Ambient pressure $ p_a $ in **Pa** (finite, >= 0).
31
+ * @param Ae - Nozzle exit area $ A_e $ in **m²** (finite, >= 0).
32
+ * @returns Thrust $ F $ in **N**. Can be negative for a badly over-expanded nozzle with little flow.
33
+ * @throws {TypeError} If any input is not a finite number.
34
+ * @throws {RangeError} If any input is negative.
35
+ * @group Manoeuvres
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // 250 kg/s at 3000 m/s, exit at 70 kPa through a 1.2 m² nozzle
40
+ * const vacuum = rocketThrust(250, 3000, 70_000, 0, 1.2); // 834 000 N
41
+ * const seaLevel = rocketThrust(250, 3000, 70_000, 101_325, 1.2); // ≈ 712 410 N
42
+ * ```
43
+ *
44
+ * @see {@link massFlowRate}
45
+ * @see https://en.wikipedia.org/wiki/Rocket_engine_nozzle Rocket engine nozzle (thrust equation)
46
+ */
47
+ export const rocketThrust = (mDot, ve, pe, pa, Ae) => {
48
+ for (const [name, v] of [
49
+ ['mDot', mDot],
50
+ ['ve', ve],
51
+ ['pe', pe],
52
+ ['pa', pa],
53
+ ['Ae', Ae]
54
+ ]) {
55
+ if (!Number.isFinite(v))
56
+ throw new TypeError(`${name} must be a finite number. Received: ${v}`);
57
+ if (v < 0)
58
+ throw new RangeError(`${name} must be >= 0. Received: ${v}`);
59
+ }
60
+ return mDot * ve + (pe - pa) * Ae;
61
+ };
62
+ //# sourceMappingURL=rocket-thrust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rocket-thrust.js","sourceRoot":"","sources":["../../../src/categories/manoeuvres/rocket-thrust.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAY,EACZ,EAAU,EACV,EAAU,EACV,EAAU,EACV,EAAU,EACF,EAAE;IACV,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI;QACtB,CAAC,MAAM,EAAE,IAAI,CAAC;QACd,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,IAAI,EAAE,EAAE,CAAC;QACV,CAAC,IAAI,EAAE,EAAE,CAAC;KACF,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrB,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,uCAAuC,CAAC,EAAE,CAAC,CAAC;QAEzE,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;AACpC,CAAC,CAAC"}