Further tweaks to inheriting time step stability in subgrids

这个提交包含在:
Craig Warren
2023-05-05 10:03:49 +01:00
父节点 db04947219
当前提交 510ef0f676
共有 3 个文件被更改,包括 6 次插入6 次删除

查看文件

@@ -191,7 +191,7 @@ class TimeStepStabilityFactor(UserObjectSingle):
raise ValueError raise ValueError
G.dt_mod = f G.dt_mod = f
G.dt = G.dt * G.dt_mod G.calculate_dt()
logger.info(f'Time step (modified): {G.dt:g} secs') logger.info(f'Time step (modified): {G.dt:g} secs')

查看文件

@@ -46,7 +46,7 @@ class FDTDGrid:
self.dy = 0 self.dy = 0
self.dz = 0 self.dz = 0
self.dt = 0 self.dt = 0
self.dt_mod = None # Time step stability factor self.dt_mod = 1 # Time step stability factor
self.iteration = 0 # Current iteration number self.iteration = 0 # Current iteration number
self.iterations = 0 # Total number of iterations self.iterations = 0 # Total number of iterations
self.timewindow = 0 self.timewindow = 0
@@ -299,6 +299,9 @@ class FDTDGrid:
# binary representation of floating point number. # binary representation of floating point number.
self.dt = round_value(self.dt, decimalplaces=d.getcontext().prec - 1) self.dt = round_value(self.dt, decimalplaces=d.getcontext().prec - 1)
# Apply any time step stability factor
self.dt = self.dt * self.dt_mod
class CUDAGrid(FDTDGrid): class CUDAGrid(FDTDGrid):
"""Additional grid methods for solving on GPU using CUDA.""" """Additional grid methods for solving on GPU using CUDA."""

查看文件

@@ -91,11 +91,8 @@ class SubGridBase(UserObjectMulti):
self.set_discretisation(sg, grid) self.set_discretisation(sg, grid)
# Set temporal discretisation including inheriting any time step # Set temporal discretisation
# stability factor from the main grid
sg.calculate_dt() sg.calculate_dt()
if sg.dt_mod:
sg.dt = sg.dt * sg.dt_mod
# Set the indices related to the subgrids main grid placement # Set the indices related to the subgrids main grid placement
self.set_main_grid_indices(sg, uip, p1, p2) self.set_main_grid_indices(sg, uip, p1, p2)