Allow subgrids to inherit any time step stability factor. Remove get_src function (not used).

这个提交包含在:
Craig Warren
2023-05-05 09:39:56 +01:00
父节点 38316cab4f
当前提交 db04947219
共有 4 个文件被更改,包括 14 次插入10 次删除

查看文件

@@ -189,7 +189,9 @@ class TimeStepStabilityFactor(UserObjectSingle):
logger.exception(f'{self.__str__()} requires the value of the time '
f'step stability factor to be between zero and one')
raise ValueError
G.dt = G.dt * f
G.dt_mod = f
G.dt = G.dt * G.dt_mod
logger.info(f'Time step (modified): {G.dt:g} secs')

查看文件

@@ -287,7 +287,8 @@ class Comments():
# Information on PML thickness
if self.grid.pmls['slabs']:
comments['PMLthickness'] = self.pml_gv_comment()
srcs = self.grid.get_srcs()
srcs = (self.grid.hertziandipoles + self.grid.magneticdipoles +
self.grid.voltagesources + self.grid.transmissionlines)
if srcs:
comments['Sources'] = self.srcs_rx_gv_comment(srcs)
if self.grid.rxs:

查看文件

@@ -46,8 +46,9 @@ class FDTDGrid:
self.dy = 0
self.dz = 0
self.dt = 0
self.iteration = 0
self.iterations = 0
self.dt_mod = None # Time step stability factor
self.iteration = 0 # Current iteration number
self.iterations = 0 # Total number of iterations
self.timewindow = 0
# PML parameters - set some defaults to use if not user provided
@@ -297,9 +298,6 @@ class FDTDGrid:
# hardware maximum. Avoids inadvertently exceeding the CFL due to
# binary representation of floating point number.
self.dt = round_value(self.dt, decimalplaces=d.getcontext().prec - 1)
def get_srcs(self):
return self.hertziandipoles + self.magneticdipoles + self.voltagesources + self.transmissionlines
class CUDAGrid(FDTDGrid):

查看文件

@@ -54,7 +54,7 @@ class SubGridBase(UserObjectMulti):
sg.dz = grid.dz / sg.ratio
sg.dl = np.array([sg.dx, sg.dy, sg.dz])
def set_main_grid_indices(self, sg, grid, uip, p1, p2):
def set_main_grid_indices(self, sg, uip, p1, p2):
"""Sets subgrid indices related to main grid placement."""
# Location of the IS
sg.i0, sg.j0, sg.k0 = p1
@@ -91,11 +91,14 @@ class SubGridBase(UserObjectMulti):
self.set_discretisation(sg, grid)
# Set the temporal discretisation
# Set temporal discretisation including inheriting any time step
# stability factor from the main grid
sg.calculate_dt()
if sg.dt_mod:
sg.dt = sg.dt * sg.dt_mod
# Set the indices related to the subgrids main grid placement
self.set_main_grid_indices(sg, grid, uip, p1, p2)
self.set_main_grid_indices(sg, uip, p1, p2)
"""
try: