Work to begin fix dispersive materials & subgrids

这个提交包含在:
Craig Warren
2022-11-18 13:17:26 +00:00
父节点 d57af6ca80
当前提交 b142746d08
共有 2 个文件被更改,包括 11 次插入23 次删除

查看文件

@@ -57,20 +57,22 @@ def create_solver(G):
if config.sim_config.general['subgrid']:
updates = create_subgrid_updates(G)
props = updates.adapt_dispersive_config()
updates.set_dispersive_updates(props)
updates.updaters[0].set_dispersive_updates(props)
# upx = updates.updaters
# upx.append(updates)
# for up in upx:
# up.set_dispersive_updates()
solver = Solver(updates, hsg=True)
elif config.sim_config.general['solver'] == 'cpu':
updates = CPUUpdates(G)
updates.set_dispersive_updates()
solver = Solver(updates)
props = updates.adapt_dispersive_config()
updates.set_dispersive_updates(props)
elif config.sim_config.general['solver'] == 'cuda':
updates = CUDAUpdates(G)
#TODO: check/add dispersive updates for CUDA
solver = Solver(updates)
elif config.sim_config.general['solver'] == 'opencl':
updates = OpenCLUpdates(G)
#TODO: check/add dispersive updates for OpenCL
solver = Solver(updates)
return solver

查看文件

@@ -175,30 +175,16 @@ class CPUUpdates:
self.grid.Ey,
self.grid.Ez)
def adapt_dispersive_config(self):
"""Sets properties for disperive materials.
Returns:
props: dict of dispersive material properties.
"""
def set_dispersive_updates(self):
"""Sets dispersive update functions."""
poles = 'multi' if config.get_model_config().materials['maxpoles'] > 1 else '1'
precision = 'float' if config.sim_config.general['precision'] == 'single' else 'double'
dispersion = 'complex' if config.get_model_config().materials['dispersivedtype'] == config.sim_config.dtypes['complex'] else 'real'
props = {'poles': poles, 'precision': precision, 'dispersion_type': dispersion}
return props
def set_dispersive_updates(self, props):
"""Sets dispersive update functions.
Args:
props: dict of dispersive material properties.
"""
update_f = 'update_electric_dispersive_{}pole_{}_{}_{}'
disp_a = update_f.format(props['poles'], 'A', props['precision'], props['dispersion_type'])
disp_b = update_f.format(props['poles'], 'B', props['precision'], props['dispersion_type'])
disp_a = update_f.format(poles, 'A', precision, dispersion)
disp_b = update_f.format(poles, 'B', precision, dispersion)
disp_a_f = getattr(import_module('gprMax.cython.fields_updates_dispersive'), disp_a)
disp_b_f = getattr(import_module('gprMax.cython.fields_updates_dispersive'), disp_b)