Mars Reentry Simulation

Quick Link --- Start

I've made a simulation of reentry and landing with a spaceship at least resembling the starship - a spaceX space ship that I think was designed to at least be compatible with a mars landing, and might plausibly land on mars within a decade.
As with all simulations, parts of this are inaccurate:
Atmosphere DensityThe atmosphere density has a simple but realistic exponential profile with a realistic scale height of 11km.
AerodynamicsI've used a simple formula (following this: Drag Coefficinent) for air friction that is applicable but approximate for simple shapes, but ignores mach effects. Overall, the drag is probably only correct to maybe a factor of 3 or thereabouts. The air friction in the forward, vertical and lateral directions is different, so the spaceship does have lift --- you can fly it like a plane when the speed is high and the altitude is low.
Attitude ControlVery simple here, no aerodynamic control, unlimited RCS control.
Atmospheric HeatingVery approximate. I've used a v^3 formula, which is roughly the right functional form, I think, and callibrated it so that a clumsy reentry causes damage. It also differentiates between the heat shield, the body of the spaceship, and the engines. If you try to reenter engine first, your engines will be damaged.
Mars heightsI've used a real mars height map, but it's been compressed lossily to 20Mb, and perlin noise and other fictional features have been added. Large scale structures are real.
Ship mass and sizeThis ship is 40m long, 9m diameter and 100 tons dry mass, with 1000 tons of fuel. This is vaguely plausible.
Landing strengthI've calibrated the strength of the spaceship so that if you land it well, it doesn't break. I haven't set it up to known parameters from any spaceship.
Mars rotationThe sun goes round mars, mars doesn't rotate.
Initial conditionsThe initial velocity is broadly realistic.
Mars colouringThe colour of the planet is just a function of the height. I felt that this shows features more clearly without changing the simulation too negatively.



Land somewhere, and then relaunch and achieve a circular orbit. It doesn't tell you when you have succeeded.
Any red "damage" listed alongside the info bar at the bottom left means that the mission failed - the spaceship will not return to Earth.


You need to use the spaceship's lift to get the altitude down to about 25km - 35km - any lower risks excessive heating, and higher risks leaving mars. Then you can use the lift to control flight until the speed is bled off. This is also a period in which you can choose a landing point. Then when you are going just a few hundred metres per second, you can point the spaceship against its direction of travel and use the thrusters to reduce speed, then point it upwards and use the thruster get a gentle landing. For most of this, the navball in the bottom left is very useful, since it shows your direction (both pointing and travel) and the up, down and horizon vectors.
If this is very difficult, I would recommend trying KSP as a way to get more practice landing.
You can fly down the Valles Marineris by moving the trajectory slightly to the south (using the spaceship's lift)

---> Start <---

Other Articles:

Atomistic Simulation of Metals

This presents an interactive simulation of atoms making up a nanoscopic particle of metal.

Moon Formation

A Kotlin N-Body code, and lots of animations of the collision between Earth and a hypothetical Theia that people think created the moon.

Quantum Mechanics for programmers

A quick demo showing how to make simulations of simple quantum mechanics systems in javascript.

© Hugo2015. Session @sessionNumber