For the first (right-most, i = 0) position, if we need the wall temperature to calculate the convective heat transfer coefficient 'h', the hot side wall temperature is assumed to be the freestream temperature, and the cold side wall temperature is assumed to be the coolant bulk temperature.
All subsequent points (i = 1, i = 2, etc..) then use the previous wall temperature (T_w[i-1]) to calculate any convective heat transfer coefficients.
It would be better to use iteration just on the first point, until wall temperatures are converged on. Then proceeding to do the other points as they are currently done.
For the first (right-most, i = 0) position, if we need the wall temperature to calculate the convective heat transfer coefficient 'h', the hot side wall temperature is assumed to be the freestream temperature, and the cold side wall temperature is assumed to be the coolant bulk temperature.
All subsequent points (i = 1, i = 2, etc..) then use the previous wall temperature (T_w[i-1]) to calculate any convective heat transfer coefficients.
It would be better to use iteration just on the first point, until wall temperatures are converged on. Then proceeding to do the other points as they are currently done.