Return the current simulation time in simulation time units (e.g. during a run function). This is not the wall-clock time. Occasionally, e.g. for termination conditions of the form $time < T?$, it is desirable to round the time to single precision in order to avoid
(self)
| 2616 | return total_bytes |
| 2617 | |
| 2618 | def meep_time(self): |
| 2619 | """ |
| 2620 | Return the current simulation time in simulation time units (e.g. during a run |
| 2621 | function). This is not the wall-clock time. |
| 2622 | |
| 2623 | Occasionally, e.g. for termination conditions of the form $time < T?$, it is |
| 2624 | desirable to round the time to single precision in order to avoid small |
| 2625 | differences in roundoff error from making your results different by one timestep |
| 2626 | from machine to machine (a difference much bigger than roundoff error); in this |
| 2627 | case you can call `Simulation.round_time()` instead, which returns the time |
| 2628 | rounded to single precision. |
| 2629 | """ |
| 2630 | if self.fields is None: |
| 2631 | self.init_sim() |
| 2632 | return self.fields.time() |
| 2633 | |
| 2634 | def timestep(self) -> int: |
| 2635 | """Return the number of elapsed timesteps.""" |