这个提交包含在:
John Hartley
2019-08-01 17:21:30 +01:00
父节点 6f4b989277
当前提交 3e8335f6f3

查看文件

@@ -219,10 +219,9 @@ class ModelBuildRun:
elif results['deltavp']: elif results['deltavp']:
printer.print("\nNumerical dispersion analysis: estimated largest physical phase-velocity error is {:.2f}% in material '{}' whose wavelength sampled by {} cells. Maximum significant frequency estimated as {:g}Hz".format(results['deltavp'], results['material'].ID, results['N'], results['maxfreq'])) printer.print("\nNumerical dispersion analysis: estimated largest physical phase-velocity error is {:.2f}% in material '{}' whose wavelength sampled by {} cells. Maximum significant frequency estimated as {:g}Hz".format(results['deltavp'], results['material'].ID, results['N'], results['maxfreq']))
disp_a = update_f.format(model_config.poles, 'A', model_config.precision, model_config.dispersion_type)
# set the dispersive update functions based on the model configuration # set the dispersive update functions based on the model configuration
solver.updates.set_dispersive_updates(model_config) props = self.solver.updates.adapt_dispersive_config(config)
self.solver.updates.set_dispersive_updates(props)
def reuse_geometry(self): def reuse_geometry(self):
printer = Printer(model_config) printer = Printer(model_config)
@@ -231,11 +230,11 @@ class ModelBuildRun:
self.G.reset_fields() self.G.reset_fields()
def tm_grid_update(self): def tm_grid_update(self):
if '2D TMx' in self.model_config.mode: if '2D TMx' == config.general['mode']:
self.G.tmx() self.G.tmx()
elif '2D TMy' in self.model_config.mode: elif '2D TMy' == config.general['mode']:
self.G.tmy() self.G.tmy()
elif '2D TMz' in self.model_config.mode: elif '2D TMz' == config.general['mode']:
self.G.tmz() self.G.tmz()
def build_scene(self): def build_scene(self):
@@ -254,16 +253,18 @@ class ModelBuildRun:
def build_pmls(self): def build_pmls(self):
# build the PMLS # build the PMLS
pbar = tqdm(total=sum(1 for value in G.pmlthickness.values() if value > 0), desc='Building PML boundaries', ncols=get_terminal_width() - 1, file=sys.stdout, disable=not config.general['progressbars']) pbar = tqdm(total=sum(1 for value in self.G.pmlthickness.values() if value > 0), desc='Building PML boundaries', ncols=get_terminal_width() - 1, file=sys.stdout, disable=not config.general['progressbars'])
for pml_id, thickness in G.pmlthickness.items(): for pml_id, thickness in self.G.pmlthickness.items():
build_pml(G, pml_id, thickness) build_pml(self.G, pml_id, thickness)
pbar.update() pbar.update()
pbar.close() pbar.close()
def build_components(self): def build_components(self):
# Build the model, i.e. set the material properties (ID) for every edge # Build the model, i.e. set the material properties (ID) for every edge
# of every Yee cell # of every Yee cell
G = self.G
printer = Printer(self.sim_config)
printer.print('') printer.print('')
pbar = tqdm(total=2, desc='Building main grid', ncols=get_terminal_width() - 1, file=sys.stdout, disable=not config.general['progressbars']) pbar = tqdm(total=2, desc='Building main grid', ncols=get_terminal_width() - 1, file=sys.stdout, disable=not config.general['progressbars'])
build_electric_components(G.solid, G.rigidE, G.ID, G) build_electric_components(G.solid, G.rigidE, G.ID, G)
@@ -275,8 +276,8 @@ class ModelBuildRun:
def update_voltage_source_materials(self): def update_voltage_source_materials(self):
# Process any voltage sources (that have resistance) to create a new # Process any voltage sources (that have resistance) to create a new
# material at the source location # material at the source location
for voltagesource in G.voltagesources: for voltagesource in self.G.voltagesources:
voltagesource.create_material(G) voltagesource.create_material(self.G)
def run_model(self): def run_model(self):