Onset of reversal and chaos thermally driven cavity flow