diff --git a/gprMax/cmds_singleuse.py b/gprMax/cmds_singleuse.py index e41caa26..616133ef 100644 --- a/gprMax/cmds_singleuse.py +++ b/gprMax/cmds_singleuse.py @@ -202,11 +202,10 @@ class TimeStepStabilityFactor(UserObjectSingle): ) raise ValueError - G = model.G - G.dt_mod = f - G.dt = G.dt * G.dt_mod + model.dt_mod = f + model.G.dt *= model.dt_mod - logger.info(f"Time step (modified): {G.dt:g} secs") + logger.info(f"Time step (modified): {model.G.dt:g} secs") class TimeWindow(UserObjectSingle): diff --git a/gprMax/grid/fdtd_grid.py b/gprMax/grid/fdtd_grid.py index edef7b9a..403f97f0 100644 --- a/gprMax/grid/fdtd_grid.py +++ b/gprMax/grid/fdtd_grid.py @@ -59,7 +59,6 @@ class FDTDGrid: self.dl: np.ndarray[Any, np.dtype[np.single]] self.dt = 0.0 - self.dt_mod = 1.0 # Time step stability factor self.iteration = 0 # Current iteration number self.iterations = 0 # Total number of iterations self.timewindow = 0 diff --git a/gprMax/model.py b/gprMax/model.py index f7ef08c1..06211c11 100644 --- a/gprMax/model.py +++ b/gprMax/model.py @@ -60,6 +60,8 @@ class Model: self.gny = 0 self.gnz = 0 + self.dt_mod = 1.0 # Time step stability factor + self.G = self._create_grid() # Monitor memory usage self.p = None @@ -126,6 +128,14 @@ class Model: def dl(self, value: np.ndarray[Any, np.dtype[np.single]]): self.G.dl = value + @property + def dt(self) -> float: + return self.G.dt + + @dt.setter + def dt(self, value: float): + self.G.dt = value + def _create_grid(self) -> FDTDGrid: """Create grid object according to solver.