How do afterburning turbofan or turbojet planes prevent or minimize the risk of a flameout at nearspace altitudes such as Fedotov's Mig-25M that went higher than 115K ft (35 km) two times? At these altitudes the MiG's engines were shut down already (the plane was floating on inertia like a suborbital spacecraft), but they must have been shut down quite high anyway, 80 or 90 thousand feet perhaps. Is there a way we can get to know accurately the highest possible altitude for a particular jet engine to run? Is there a way for the pilot to know when they could shut the engine down before it does on its own in a flameout?
The engine flamed out on the way up. Inertia alone carried the Ye-155M to its record altitude. Its high speed and its high supersonic load factor of 5 allowed to fly a zoom climb where the pilot pulls into a vertical climb at an altitude which still supports a pull-up maneuver (which requires a flight speed near the airplane's top speed of Mach 3 for best results). This page lists the maximum altitude for sustained flight of the Ye-155M at 24,200 m.
The engine, a R15BF2-300, started life in 1958 as the power plant of several unmanned, supersonic reconnaissance airplanes (R15K, used on Tu-151 and -153 Yastreb). For this purpose it was of rather simple design with only 5 compressor stages and no bleed air for turbine cooling. Later it was upgraded for manned airplanes like the Ye-150 family, being the only low-cost solution to a high-altitude supersonic reconnaissance airplane. For the record-setting Ye-155M a sixth compressor stage was added, turbine temperature increased and reliability improved.
You might ask why so few compressor stages were sufficient for high altitude operation. The reason is supersonic flight: Most compression is from ram pressure in the intake, so the engine does not have to add much compression on top - or if it would, compressor exit temperature would be too high to add much energy from combustion before turbine entry temperature is exceeded.