From f5ca446a1346148a22f18169bd2883793693b2c0 Mon Sep 17 00:00:00 2001 From: ColdingPlasma883 <135501295+ColdingPlasma883@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:23:24 +0900 Subject: [PATCH 1/2] visualization.py plot bug when Yaxis-crosssection. --- fdtd/visualization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdtd/visualization.py b/fdtd/visualization.py index 6e939f7..28b12ae 100644 --- a/fdtd/visualization.py +++ b/fdtd/visualization.py @@ -163,7 +163,7 @@ def visualize( _y = source.z elif y is not None: _x = source.z - _y = source.y + _y = source.x elif z is not None: _x = source.x _y = source.y From 5dc7157e7b85835e6776573c282b9e6308e055eb Mon Sep 17 00:00:00 2001 From: ColdingPlasma883 <135501295+ColdingPlasma883@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:44:29 +0900 Subject: [PATCH 2/2] Point/Line/PlaneSources should update Grid.frequency when _resister_grid() is called. --- fdtd/sources.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fdtd/sources.py b/fdtd/sources.py index 1b7b993..6a8d8e9 100644 --- a/fdtd/sources.py +++ b/fdtd/sources.py @@ -88,6 +88,7 @@ def _register_grid(self, grid: Grid, x: Number, y: Number, z: Number): raise ValueError("a point source should be placed on a single grid cell.") self.x, self.y, self.z = grid._handle_tuple((x, y, z)) self.period = grid._handle_time(self.period) + self.frequency = 1.0 / self.period def update_E(self): """Add the source to the electric field""" @@ -191,6 +192,7 @@ def _register_grid( self.x, self.y, self.z = self._handle_slices(x, y, z) self.period = grid._handle_time(self.period) + self.frequency = 1.0 / self.period L = len(self.x) vect = bd.array( @@ -370,6 +372,7 @@ def _register_grid( self.x, self.y, self.z = self._handle_slices(x, y, z) self.period = grid._handle_time(self.period) + self.frequency = 1.0 / self.period x = bd.arange(self.x.start, self.x.stop, 1) - (self.x.start + self.x.stop) // 2 y = bd.arange(self.y.start, self.y.stop, 1) - (self.y.start + self.y.stop) // 2