I have started my simulation of the cyclotron in Java but Am facing a problem:

we know that the magnetics filed doesn't affect the magnitude of the velocity vector in the dees , but how can I simulate that in my program if the accelerator vector != zero vector , I mean that how can I applied this role mathematically to prove that when we move from point to another one in the dee that the magnitude of velocity vector is still constant, but the direction and the axis of it is changed ??