Reputation: 63
I am doing simulations for
time step = 1.0 e^-7 &
total number of steps ==> nsteps = 1.0 e^8
I have to find the total time of simulation at which n# steps is achieved. Is it ok to multiply both to get the time of simulation?
time of simulation = time step * total number of steps
time of simulation = 1.0 e^-7 * 1.0 e^8
time of simulation = 10
Is this right or wrong? Thanks in advance.
Upvotes: 1
Views: 177
Reputation: 14939
This is a yes/no question, so:
No, (or yes, depending on how accurately you want the answer to be)!
But you are really close... You need to subtract one time_step
, thus the answer is really:
time_of_simulation = time_step * total_number_of_steps - time_step;
You will see the reason if you consider counting seconds. Start with a number and see how far you get if you count one second at a time.
1, 2, 3 => Three measurements, but only 2 seconds.
However, in your case, I guess you are close enough without the last subtraction, because
time of simulation = 9.999999 is pretty close to 10
Upvotes: 2