Tweaks to inherit any time step mods from main grid to subgrid

这个提交包含在:
Craig Warren
2023-05-05 10:36:04 +01:00
父节点 510ef0f676
当前提交 a4da5ed146
共有 4 个文件被更改,包括 8 次插入7 次删除

查看文件

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

查看文件

@@ -46,7 +46,7 @@ class FDTDGrid:
self.dy = 0
self.dz = 0
self.dt = 0
self.dt_mod = 1 # Time step stability factor
self.dt_mod = None # Time step stability factor
self.iteration = 0 # Current iteration number
self.iterations = 0 # Total number of iterations
self.timewindow = 0
@@ -299,9 +299,6 @@ class FDTDGrid:
# binary representation of floating point number.
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):
"""Additional grid methods for solving on GPU using CUDA."""

查看文件

@@ -294,4 +294,4 @@ class SubGridHSG(SubGridBaseGrid):
f'(({self.nwx} x {self.nwy} x {self.nwz} = {self.nwx * self.nwy * self.nwz} cells)')
logger.debug(f'[{self.name}] Total region: {self.nx:d} x {self.ny:d} x {self.nz:d} = ' +
f'{(self.nx * self.ny * self.nz):g} cells')
logger.info(f'[{self.name}] Time step (at CFL limit): {self.dt:g} secs')
logger.info(f'[{self.name}] Time step: {self.dt:g} secs')

查看文件

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