I have tried the second code and total time is still changing with every next time step. Apparently that if-else statement is not working. Any suggestion? Again what I want is to simulate 5 differnt inlet velocities at each time step before it change to next time step!n