The simulated models of structures are stored in the `metamaterial_models.py' module; see its code for the description of each structure and command-line parameters accepted. Several of these parameters are not passed to the model; see the definition of `process_param()' in `meep_utils.py'. """ import time, sys, os import numpy as np from scipy.constants import c, epsilon_0, mu_0 import meep_utils, meep_materials, metamaterial_models from meep_utils import in_sphere, in_xcyl, in_ycyl, in_zcyl, in_xslab, in_yslab, in_zslab, in_ellipsoid import meep_mpi as meep #import meep # Model selection model_param = meep_utils.process_param(sys.argv[1:]) model = metamaterial_models.models[model_param.get('model', 'default')](**model_param) ## Initialize volume, structure and the fields according to the model vol = meep.vol3d(model.size_x, model.size_y, model.size_z, 1./model.resolution) vol.center_origin() s = meep_utils.init_structure(model=model, volume=vol, pml_axes=meep.Z) f = meep.fields(s) # Define the Bloch-periodic boundaries (any transversal component of k-vector is allowed) f.use_bloch(meep.X, getattr(model, 'Kx', 0) / (-2*np.pi)) f.use_bloch(meep.Y, getattr(model, 'Ky', 0) / (-2*np.pi)) # Add the field source (see meep_utils for an example of how an arbitrary source waveform is defined) if not getattr(model, 'frequency', None): ## (temporal source shape) #src_time_type = meep.band_src_time(model.src_freq/c, model.src_width/c, model.simtime*c/1.1) src_time_type = meep.gaussian_src_time(model.src_freq/c, model.src_width/c)