From b2c3e54c1895d88c94f0df6367834526bdbd9715 Mon Sep 17 00:00:00 2001 From: craig-warren Date: Tue, 17 Jul 2018 15:45:11 +0100 Subject: [PATCH] Changed rounding method (to ceil) used to calculate number of iterations. Now guarantees simulation will run beyond specified time window. --- gprMax/input_cmds_singleuse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gprMax/input_cmds_singleuse.py b/gprMax/input_cmds_singleuse.py index 554d38ac..21828b2b 100644 --- a/gprMax/input_cmds_singleuse.py +++ b/gprMax/input_cmds_singleuse.py @@ -187,6 +187,8 @@ def process_singlecmds(singlecmds, G): tmp = tmp[0].lower() # If number of iterations given + # The +/- 1 used in calculating the number of iterations is to account for + # the fact that the solver (iterations) loop runs from 0 to < G.iterations try: tmp = int(tmp) G.timewindow = (tmp - 1) * G.dt @@ -196,7 +198,7 @@ def process_singlecmds(singlecmds, G): tmp = float(tmp) if tmp > 0: G.timewindow = tmp - G.iterations = round_value((tmp / G.dt)) + 1 + G.iterations = int(np.ceil(tmp / G.dt)) + 1 else: raise CmdInputError(cmd + ' must have a value greater than zero') if G.messages: