你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Work to begin fix dispersive materials & subgrids
这个提交包含在:
@@ -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)
|
||||
|
在新工单中引用
屏蔽一个用户