Move time step stability factor into Model

这个提交包含在:
nmannall
2024-05-15 15:26:57 +01:00
父节点 332a1204b6
当前提交 ba9e16d8db
共有 3 个文件被更改,包括 13 次插入5 次删除

查看文件

@@ -202,11 +202,10 @@ class TimeStepStabilityFactor(UserObjectSingle):
)
raise ValueError
G = model.G
G.dt_mod = f
G.dt = G.dt * G.dt_mod
model.dt_mod = f
model.G.dt *= model.dt_mod
logger.info(f"Time step (modified): {G.dt:g} secs")
logger.info(f"Time step (modified): {model.G.dt:g} secs")
class TimeWindow(UserObjectSingle):

查看文件

@@ -59,7 +59,6 @@ class FDTDGrid:
self.dl: np.ndarray[Any, np.dtype[np.single]]
self.dt = 0.0
self.dt_mod = 1.0 # Time step stability factor
self.iteration = 0 # Current iteration number
self.iterations = 0 # Total number of iterations
self.timewindow = 0

查看文件

@@ -60,6 +60,8 @@ class Model:
self.gny = 0
self.gnz = 0
self.dt_mod = 1.0 # Time step stability factor
self.G = self._create_grid()
# Monitor memory usage
self.p = None
@@ -126,6 +128,14 @@ class Model:
def dl(self, value: np.ndarray[Any, np.dtype[np.single]]):
self.G.dl = value
@property
def dt(self) -> float:
return self.G.dt
@dt.setter
def dt(self, value: float):
self.G.dt = value
def _create_grid(self) -> FDTDGrid:
"""Create grid object according to solver.