I'm trying to calculate the absolute lowest altitude to start burning the engines at full power on a simulated spacecraft so that it will just reach v=0 at the surface of a planet.

The twist here is that the thrust provided by the engines responsible for descelerating is dependent on the thickness of the atmosphere they're in, which in turn depends on the altitude they are at.

Drag is not to be taken into account.

Craft mass does not vary during descent.

Craft falls straight down.

Thrusters providing desceleration are pointed straight down along the gravity vector.

Data available:

planet g: 9.81m/s^2 (variation by altitude is insignificant at practical altitude).

Atmosphere density: Altitude = 0m -> AtmDens = 1 | Altitude = 14400m -> AtmDens = 0

Thruster efficiency: AtmDens = 1 -> ThrustEff = 1 | AtmDens = 0.3 -> ThrustEff = 0

CraftAltitude above surface: xSurf is known at any time

CraftAltitude above seaLevel: xSea is known at any time

CraftVelocity (downwards): vCraft is known at any time

CraftMass: mCraft is known and constant at any time

CraftMaxThrust at seaLevel: cMaxThrustSea is known at any time (in Newton)

What I came up with (so it could be wrong):

CraftMaxThrust at xSea in Newton:

cMaxThrustSea - (cMaxThrustSea / 100) * ((100 / 0.7) * (1 - (1 - xSea / 14400)))

I figure I'm looking for some differential equation that returns an altitude. I try looking at the problem from the bottom up, as to have an initial acceleration at least, but have failed to solve it so far.

Any help would be greatly appreciated.