With flight dynamic equations, how do I return to positive alpha if alpha is always negative with negative w? I'm coding a flight dynamics simulation, but my simulation runs into a problem with negative angles of attack. Once alpha is negative, it is impossible to get back to a state where the plane is generating positive vertical velocity.
At the start of each frame of the simulation we have some forward velocity ($u$) and vertical velocity ($w$), and at the end of each frame we calculate new values for $u$ and $w$. To keep things simple, assume the plane generates 0 lift at 0 alpha, we're always in level flight with no change to pitch or roll, and the pilot only makes changes to $u$ with the throttle.
If $u$ decreases enough that we generate less lift force than gravity, $w$ becomes negative and the plane begins to descend. The usual formula for angle of attack ($$) is a function of $u$ and $w$:
$ = arctan(w / u)$
This means a negative $w$ and positive $u$ will always give a negative $$.
I calculate lift with this equation (simplified. $q$ is dynamic pressure):
$L = 2π *  * q$
This means a negative $$ will always give negative lift.
And finally, the next frame's $w$ is just a function of lift and gravity (in level flight):
$w_{next} = w + L / mass - g$
So it is possible to have positive $$ and lift but end up with a negative $w$ due to gravity.
If a frame of my simulation ends with negative $w$, the simulation is put in a state where it is impossible to ever return to positive $$, because negative $w$ always gives negative $$. Negative $$ always gives negative $L$. And negative $L$ always gives negative $w_{next}$ Negative $w_{next}$ always gives negative $$ on the next frame.
Increasing $u$ eventually should return me to positive $L$ and $w$ as $q$ increases, but doesn't - it only generates more negative lift. What factors am I missing to be able to get back to positive $w$ with just an increase in $u$?
I think your problem is in part, that you assume that $w$ is positive if your aircraft is ascending. The opposite is the case. The aircraft coordinate system is defined as a right-handed system with the z-axis pointing downward.

This means a positive $w$ indicates that your aircraft is descending.
Therefore, if your plane keeps a constant velocity $u$, the body-fixed downward velocity $w$ will get positive because of the gravity pulling you down. This in turn results in a positive $\alpha$ providing lift. Eventually if you have implemented your simulation correctly, the $\alpha$-angle (and $w$) will oscillate for a bit at the beginning of your simulation, but after finding the steady-state, it will steadily descend with a positive angle-of-attack and a positive value of $w$.
P.S.: For the calculation of $\alpha$ it is very helpful to use the atan2() function, as it correctly discerns the various sign cases.