from KEMP import Basic_FDTD, Dielectric, to_epr, to_SI, to_NU, Gold, Silver, PA from KEMP import structures as stc nm = 1e-9 dx, dy, dz = [.1 * nm, .1 * nm, .1 * nm] nx, ny, nz = [20000, 5, 5] x = np.ones(nx, dtype=np.float64) * dx # 0 ~ 3000 nm y = np.ones(ny, dtype=np.float64) * dy # 0 ~ 1 nm z = np.ones(nz, dtype=np.float64) * dz # 0 ~ 1 nm lx, ly, lz = dx * nx, dy * ny, dz * nz space_grid = (x, y, z) engine_name = 'nvidia_cuda' #engine_name = 'intel_cpu' fdtd = Basic_FDTD('3D', space_grid, dtype=np.complex64, engine=engine_name, device_id=0) pml_apply = {'x': '+-', 'y': '', 'z': ''} pbc_apply = {'x': False, 'y': True, 'z': True} fdtd.apply_PML(pml_apply) fdtd.apply_PBC(pbc_apply) slab_thick = 5. * nm gap = 80 * nm diel = Dielectric(to_epr(fdtd, n=3.)) diep = Dielectric(to_epr(fdtd, n=10.**10)) #slab = stc.Box(diel, ((1000.*nm,0.*nm,0.*nm),(1000.*nm+slab_thick,ly,lz))) slab = stc.Box(Gold, ((1000. * nm, 0. * nm, 0. * nm),
#wavelength = np.arange(400,800,5)*nm freqs = np.arange(0.3, 2.0, 0.01) * THz src_pos = 300 trs_pos = 2700 dx, dy, dz = [1 * um, 1 * um, 1 * um] nx, ny, nz = [50, 50, 3000] x = np.ones(nx, dtype=np.float64) * dx y = np.ones(ny, dtype=np.float64) * dy z = np.ones(nz, dtype=np.float64) * dz space_grid = (x, y, z) lx, ly, lz = dx * (nx + 1), dy * (ny + 1), dz * (nz + 1) fdtd = Basic_FDTD('3D', space_grid, dtype=np.complex64, engine='nvidia_cuda') pml_apply = {'x': '', 'y': '', 'z': '+-'} pbc_apply = {'x': True, 'y': True, 'z': False} fdtd.apply_PML(pml_apply) fdtd.apply_PBC(pbc_apply) wfreq0_NU = to_NU(fdtd, 'angular frequency', 2. * np.pi * freq0) #----------------------------------structure------------------------------------------------------------------- xc = fdtd.x[fdtd.nx / 2] yc = fdtd.y[fdtd.ny / 2] zc = fdtd.z[fdtd.nz / 2]
import sys from KEMP import Basic_FDTD, Dielectric, Dimagnetic, Dielectromagnetic, to_epr, to_SI, to_NU, Gold, Silver, PA from KEMP import structures as stc nm = 1e-9 dx, dy, dz = [10 * nm, 10 * nm, 10 * nm] nx, ny, nz = [2, 2, 2000] x = np.ones(nx, dtype=np.float64) * dx # 0 ~ 20000 nm y = np.ones(ny, dtype=np.float64) * dy # 0 ~ 10 nm z = np.ones(nz, dtype=np.float64) * dz # 0 ~ 10 nm lx, ly, lz = dx * nx, dy * ny, dz * nz space_grid = (x, y, z) engine_name = 'nvidia_cuda' fdtd = Basic_FDTD('3D', space_grid, dtype=np.complex64, engine=engine_name, device_id=0) pml_apply = {'x': '', 'y': '', 'z': '+-'} pbc_apply = {'x': True, 'y': True, 'z': False} fdtd.apply_PML(pml_apply) fdtd.apply_PBC(pbc_apply) #mat = Dielectric(epr=4.) #mat = Dimagnetic(mur=9.) mat = Dielectromagnetic(epr=4., mur=9.) slab = stc.Box(mat, ((-1. * nm, -1. * nm, -1. * nm), (lx + 1. * nm, ly + 1. * nm, lz + 1. * nm))) structures = [slab]
from KEMP import Basic_FDTD, Dielectric, to_epr, to_SI, to_NU, Gold, Silver, PA from KEMP import structures as stc nm = 1e-9 dx, dy, dz = [.1 * nm, .1 * nm, .1 * nm] nx, ny, nz = [2, 2, 5000] x = np.ones(nx, dtype=np.float64) * dx # 0 ~ 3000 nm y = np.ones(ny, dtype=np.float64) * dy # 0 ~ 1 nm z = np.ones(nz, dtype=np.float64) * dz # 0 ~ 1 nm lx, ly, lz = dx * nx, dy * ny, dz * nz space_grid = (x, y, z) engine_name = 'nvidia_cuda' #engine_name = 'intel_cpu' fdtd = Basic_FDTD('3D', space_grid, dtype=np.float32, engine=engine_name, device_id=2) pml_apply = {'x': '', 'y': '', 'z': '+-'} pbc_apply = {'x': True, 'y': True, 'z': False} fdtd.apply_PML(pml_apply) fdtd.apply_PBC(pbc_apply) slab_thick = 5. * nm gap = 80. * nm diel = Dielectric(to_epr(fdtd, n=1.5)) diep = Dielectric(to_epr(fdtd, n=10.**10)) #slab = stc.Box(diel, ((0.*nm,0.*nm,400.*nm),(lx,ly,400.*nm+slab_thick))) #slab = stc.Box(Gold, ((0.*nm,0.*nm,400.*nm),(lx,ly,400.*nm+slab_thick)))