From e818441730a075f0c8a9d24968aff776725f2768 Mon Sep 17 00:00:00 2001 From: nmannall Date: Tue, 10 Dec 2024 11:06:30 +0000 Subject: [PATCH] Move iterations and timewindow to FDTDGrid Grids need to know the number of iterations and the timewindow to calculate waveform values. While waveforms are global in an MPI sense, subgrids will calculate their own waveforms based on the dt value of the subgrid. --- gprMax/grid/fdtd_grid.py | 3 +++ gprMax/model.py | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gprMax/grid/fdtd_grid.py b/gprMax/grid/fdtd_grid.py index de8bea10..0813da0f 100644 --- a/gprMax/grid/fdtd_grid.py +++ b/gprMax/grid/fdtd_grid.py @@ -61,6 +61,9 @@ class FDTDGrid: self.dl = np.ones(3, dtype=np.float64) self.dt = 0.0 + self.iterations = 0 # Total number of iterations + self.timewindow = 0.0 + # Field Arrays self.Ex: npt.NDArray[np.float32] self.Ey: npt.NDArray[np.float32] diff --git a/gprMax/model.py b/gprMax/model.py index 18a837ba..8d7012f5 100644 --- a/gprMax/model.py +++ b/gprMax/model.py @@ -56,8 +56,6 @@ class Model: 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.0 self.srcsteps = np.zeros(3, dtype=np.int32) self.rxsteps = np.zeros(3, dtype=np.int32) @@ -141,6 +139,22 @@ class Model: def dt(self, value: float): self.G.dt = value + @property + def iterations(self) -> int: + return self.G.iterations + + @iterations.setter + def iterations(self, value: int): + self.G.iterations = value + + @property + def timewindow(self) -> float: + return self.G.timewindow + + @timewindow.setter + def timewindow(self, value: float): + self.G.timewindow = value + def _create_grid(self) -> FDTDGrid: """Create grid object according to solver.