slices = [] if not "noepssnapshot" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=(meep.Dielectric), at_t=0, name='EPS')] if "narrowfreq-snapshots" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=meep.Ex, at_y=0, at_t=np.inf, name=('At%.3eHz'%getattr(model, 'frequency', None)) if getattr(model, 'frequency', None) else '', outputpng=True, outputvtk=False)] if "fieldevolution" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=(meep.Ex), at_x=0, name='FieldEvolution', min_timestep=.1/model.src_freq, outputgif=True, outputhdf=True, outputvtk=True)] if "snapshote" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=(meep.Ex, meep.Ey, meep.Ez), at_t=np.inf, name='SnapshotE')] ## Run the FDTD simulation or the frequency-domain solver if not getattr(model, 'frequency', None): ## time-domain computation f.step(); timer = meep_utils.Timer(simtime=model.simtime); meep.quiet(True) # use custom progress messages while (f.time()/c < model.simtime): # timestepping cycle f.step() timer.print_progress(f.time()/c) for monitor in (monitor1_Ex, monitor1_Hy, monitor2_Ex, monitor2_Hy): monitor.record(field=f) for slice_ in slices: slice_.poll(f.time()/c) for slice_ in slices: slice_.finalize() meep_utils.notify(model.simulation_name, run_time=timer.get_time()) else: ## frequency-domain computation f.solve_cw(getattr(model, 'MaxTol',0.001), getattr(model, 'MaxIter', 5000), getattr(model, 'BiCGStab', 8)) for monitor in (monitor1_Ex, monitor1_Hy, monitor2_Ex, monitor2_Hy): monitor.record(field=f) for slice_ in slices: slice_.finalize() meep_utils.notify(model.simulation_name) ## Get the reflection and transmission of the structure if meep.my_rank() == 0:
slices = [] if not "noepssnapshot" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=(meep.Dielectric), at_t=0, name='EPS')] if "narrowfreq-snapshots" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=meep.Ex, at_y=0, at_t=np.inf, name=('At%.3eHz'%getattr(model, 'frequency', None)) if getattr(model, 'frequency', None) else '', outputpng=True, outputvtk=False)] if "fieldevolution" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=(meep.Ex), at_x=0, name='FieldEvolution', min_timestep=.1/model.src_freq, outputgif=True, outputvtk=True)] if "snapshote" in model.comment: slices += [meep_utils.Slice(model=model, field=f, components=(meep.Ex, meep.Ey, meep.Ez), at_t=np.inf, name='SnapshotE')] ## Run the FDTD simulation or the frequency-domain solver if not getattr(model, 'frequency', None): ## time-domain computation f.step(); timer = meep_utils.Timer(simtime=model.simtime); meep.quiet(True) # use custom progress messages while (f.time()/c < model.simtime): # timestepping cycle f.step() timer.print_progress(f.time()/c) for monitor in (monitor1_Ex, monitor1_Hy, monitor2_Ex, monitor2_Hy): monitor.record(field=f) for slice_ in slices: slice_.poll(f.time()/c) for slice_ in slices: slice_.finalize() meep_utils.notify(model.simulation_name, run_time=timer.get_time()) else: ## frequency-domain computation f.solve_cw(getattr(model, 'MaxTol',0.001), getattr(model, 'MaxIter', 5000), getattr(model, 'BiCGStab', 8)) for monitor in (monitor1_Ex, monitor1_Hy, monitor2_Ex, monitor2_Hy): monitor.record(field=f) for slice_ in slices: slice_.finalize() meep_utils.notify(model.simulation_name) ## Get the reflection and transmission of the structure if meep.my_rank() == 0:
'size_y': model.size_y, 'size_z': model.size_z, 'Kx': getattr(model, 'Kx', .0), 'Ky': getattr(model, 'Ky', .0), 'Kz': getattr(model, 'Kz', .0) } monitor1_Ex = AmplitudeMonitorVolume( comp=meep.Ex, **monitor_options ) ## TODO try out how it differs with comp=meep.Dx - this should work, too if not getattr(model, 'frequency_domain', None): ## time-domain computation f.step() dt = (f.time() / c) meep_utils.lorentzian_unstable_check_new(model, dt) timer = meep_utils.Timer(simtime=model.simtime) meep.quiet(True) # use custom progress messages while (f.time() / c < model.simtime): # timestepping cycle f.step() timer.print_progress(f.time() / c) for monitor in (monitor1_Ex, ): monitor.record(field=f) meep_utils.notify(model.simulation_name, run_time=timer.get_time()) else: ## frequency-domain computation f.solve_cw(getattr(model, 'MaxTol', 0.001), getattr(model, 'MaxIter', 5000), getattr(model, 'BiCGStab', 8)) for monitor in (monitor1_Ex, ): monitor.record(field=f) meep_utils.notify(model.simulation_name) ## Get the reflection and transmission of the structure if meep.my_rank() == 0: