Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes monitor size bug for time domain (ignoring interval) #211

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tidy3d/components/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ def time_inds(self, tmesh: Array) -> Tuple[int, int]:

return (tind_beg, tind_end)

def num_steps(self, tmesh: Array) -> int:
"""Compute number of time steps for a time monitor."""

tind_beg, tind_end = self.time_inds(tmesh)
number_of_steps = int((tind_beg - tind_beg) / self.interval)
return number_of_steps


class AbstractFieldMonitor(Monitor, ABC):
""":class:`Monitor` that records electromagnetic field data as a function of x,y,z."""
Expand Down Expand Up @@ -282,8 +289,7 @@ class FieldTimeMonitor(AbstractFieldMonitor, TimeMonitor):

def storage_size(self, num_cells: int, tmesh: Array) -> int:
# stores 1 real number per grid cell, per time step, per field
time_inds = self.time_inds(tmesh)
num_steps = time_inds[1] - time_inds[0]
num_steps = self.num_steps(tmesh)
return BYTES_REAL * num_steps * num_cells * len(self.fields)


Expand Down Expand Up @@ -324,8 +330,7 @@ class FluxTimeMonitor(AbstractFluxMonitor, TimeMonitor):

def storage_size(self, num_cells: int, tmesh: Array) -> int:
# stores 1 real number per time tep
time_inds = self.time_inds(tmesh)
num_steps = time_inds[1] - time_inds[0]
num_steps = self.num_steps(tmesh)
return BYTES_REAL * num_steps


Expand Down