From b1c0c744d7392c668b8cbf63589635dc471f299b Mon Sep 17 00:00:00 2001 From: jhdark Date: Mon, 13 Jan 2025 15:02:47 -0500 Subject: [PATCH] accept int or float as input for dt attribute --- festim/generic_simulation.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/festim/generic_simulation.py b/festim/generic_simulation.py index 9c8bbd826..2bae174f3 100644 --- a/festim/generic_simulation.py +++ b/festim/generic_simulation.py @@ -182,6 +182,21 @@ def T(self, value): "accepted types for T attribute are int, float, sympy.Expr or festim.Temperature" ) + @property + def dt(self): + return self._dt + + @dt.setter + def dt(self, value): + if value is None: + self._dt = value + elif isinstance(value, (int, float)): + self._dt = festim.Stepsize(value) + elif isinstance(value, festim.Stepsize): + self._dt = value + else: + raise TypeError("dt must be an int, float, or festim.Stepsize") + def attribute_source_terms(self): """Assigns the source terms (in self.sources) to the correct field (self.mobile, self.T, or traps)