Skip to content

Commit

Permalink
accept int or float as input for dt attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Jan 13, 2025
1 parent 8d6857b commit b1c0c74
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions festim/generic_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b1c0c74

Please sign in to comment.