Public
Edited
Apr 3, 2023
Insert cell
Insert cell
G = math.gravitationConstant.toNumber('m^3 / (kg s^2)') // [m^3 / (kg s^2)] Gravitational constant
Insert cell
mbody = 5.9724e24 // [kg] Mass of Earth
Insert cell
mu = G * mbody // Standard gravitational parameter
Insert cell
g0 = math.gravity.toNumber('m / s^2') // Standard gravity: used for calculating propellant consumption (dmdt)
Insert cell
r0 = 6371 // [km] Mean radius of Earth
Insert cell
t0 = 0 // [s] Simulation start
Insert cell
dt = 0.5 // [s] Simulation timestep
Insert cell
tfinal = 149.5 // [s] Simulation duration
Insert cell
isp_sea = 282 // [s] Specific impulse (at sea level)
Insert cell
isp_vac = 311 // [s]Specific impulse (in vacuum)
Insert cell
gamma0 = 89.99970 // [deg] Initial pitch angle (90 deg is vertical)
Insert cell
v0 = 0.9 // [m/s] Initial velocity (must be non-zero because ODE is ill-conditioned)
Insert cell
phi0 = 0 // [deg] Initial orbital reference angle
Insert cell
m1 = 433100 // [kg] First stage mass

Insert cell
m2 = 111500 // [kg] Second stage mass

Insert cell
m3 = 1700 // [kg] Third stage / fairing mass

Insert cell
mp = 5000 // [kg] Payload mass

Insert cell
m0 = m1+m2+m3+mp // Initial mass of rocket

Insert cell
dm = 2750 // [kg/s] Mass flow rate

Insert cell
rocket_radius = 3.66 // [m]
Insert cell
A = rocket_radius^2 * math.pi // Area of the rocket

Insert cell
dragCoef = 0.2 // Drag coefficient
Insert cell
math = import("https://cdn.skypack.dev/mathjs@11.8")
Insert cell
function rk4(func, X, Y) {
X.slice(1,length(X)).forEach(
a = math.multiply()
x =>
)
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more