Ejemplo n.º 1
0
TF = space.Basic3D((Nx, Ny, Nz), (dx, dy, dz),
                   dt,
                   Tsteps,
                   np.float32,
                   np.complex64,
                   engine='cupy')  # Total field
IF = space.Basic3D((Nx, Ny, Nz), (dx, dy, dz),
                   dt,
                   Tsteps,
                   np.float32,
                   np.complex64,
                   engine='cupy')  # Incident field
SF = space.Empty3D((Nx, Ny, Nz), (dx, dy, dz),
                   dt,
                   Tsteps,
                   np.float32,
                   np.complex64,
                   engine='cupy')  # Scattered field

TF.malloc()
IF.malloc()
SF.malloc()

# Put structures
radius = 200 * um
height = (500 * um, 700 * um)
center = (640 * um, 640 * um)
cylinder = structure.Cylinder(TF, radius, height, center, 4., 1.)

# Set PML and PBC
TF.set_PML({'x': '+-', 'y': '+-', 'z': '+-'}, 10)
Ejemplo n.º 2
0
interval = 2
spread   = 0.3
pick_pos = 1000
plot_per = 30

wvlens = np.arange(200, 600, interval) * um
freqs = c / wvlens
np.save("../graph/freqs", freqs)

#------------------------------------------------------------------#
#-------------------------- Call objects --------------------------#
#------------------------------------------------------------------#

FDTDspace = space.Basic3D((Nx,Ny,Nz), (dx,dy,dz), dt, Tstep, np.complex64, np.complex64, method='FDTD', engine='cupy')
PSTDspace = space.Basic3D((Nx,Ny,Nz), (dx,dy,dz), dt, Tstep, np.complex64, np.complex64, method='PSTD', engine='cupy')
Diffspace = space.Empty3D((Nx,Ny,Nz), (dx,dy,dz), dt, Tstep, np.complex64, np.complex64)

FDTDspace.malloc()
PSTDspace.malloc()

# Put structures
#Box1_srt = (round(222*um/dx), round( 0*um/dy), round(  0*um/dz))
#Box1_end = (round(272*um/dx), round(96*um/dy), round( 96*um/dz))
#Box = structure.Box(FDTDspace, Box1_srt, Box1_end, 4., 1.)

# Set PML and PBC
FDTDspace.set_PML({'x':'+-','y':'','z':''}, 10)
PSTDspace.set_PML({'x':'+-','y':'','z':''}, 10)

# Save eps, mu and PML data.
#FDTDspace.save_PML_parameters('./')
Ejemplo n.º 3
0
                   Tsteps,
                   np.complex64,
                   np.complex64,
                   method=method,
                   engine=engine)
IF = space.Basic3D((Nx, Ny, Nz), (dx, dy, dz),
                   dt,
                   Tsteps,
                   np.complex64,
                   np.complex64,
                   method=method,
                   engine=engine)
SF = space.Empty3D((Nx, Ny, Nz), (dx, dy, dz),
                   dt,
                   Tsteps,
                   np.complex64,
                   np.complex64,
                   method=method,
                   engine=engine)

TF.malloc()
IF.malloc()

########## Set PML and PBC
thick = 10
pml = {'x': '+-', 'y': '', 'z': ''}
bbc = {'x': False, 'y': False, 'z': False}
pbc = {'x': False, 'y': True, 'z': True}

TF.apply_PML(pml, thick)
TF.apply_BBC(bbc)