Esempio n. 1
0
from scipy.constants import c, epsilon_0, mu_0
from math import sin, pi

name = "tetfsf"
outdir = "result/%s" % name
prepare(outdir)
hdf5 = h5py.File("%s/%s.hdf5" % (outdir, name), "w")
hdf5.attrs["name"] = name
hdf5.require_group("timeline")

length = 201
deltax = 10 ** -9
deltat = deltax / (2 * c)
freq = 6 * 10 ** 15

plane = DispersivePlane(XTFSFPlane(UPMLPlane(PBCPlane(Plane((length, length))))))
plane.pbcx = False
plane.pbcy = False
# plane.pmly = False
plane.pml_thick = 13
plane.set_pml()
plane.teinc.enter = 2
plane.ytfsf = [25, 176]
plane.xtfsf = [25, 176]

for t in range(0, 300):
    plane.teinc.update(sin(2 * pi * freq * t * deltat))

    plane.update_hpbc()
    plane.update_dfield().update_dtfsf()
    plane.update_efield()
Esempio n. 2
0
#!/usr/bin/env python
#-*- mode: python -*-

import sys, os
sys.path.append(".")

from yafdtd.grid import Plane, PBCPlane, UPMLPlane, XTFSFPlane, DispersivePlane, PolarDPlane
from yafdtd.source import gaussian
from yafdtd.utils import *
from scipy.constants import c
from math import pi, sin, cos
from sys import stdout


plane = DispersivePlane(XTFSFPlane(UPMLPlane(PBCPlane(Plane("grating-slit", (301,701))))))

plane.pml( 
    x = True,
    y = False,
    thick = 20 
).pbc( 
    x = False,
    y = True 
).tfsf(
    xtfsf = [50, 301-50],
    ytfsf = [None, None],
    enter = 2
).open(
    "result/grating-slit/result.hdf5"
).dx(
    5e-9
Esempio n. 3
0
from yafdtd.geometry import circle
from scipy.constants import c, epsilon_0, mu_0

name = "silver-rod"
outdir = "result/%s" % name
prepare(outdir)
hdf5 = h5py.File("%s/%s.hdf5" % (outdir, name), "w")
hdf5.attrs["name"] = name 
hdf5.require_group("timeline")

length = 301
deltax = 10**-9
deltat = deltax/(2*c)
freq   = 5*10**14

plane = DispersivePlane(YTFSFPlane(UPMLPlane(PBCPlane(Plane((length,length))))))

plane.pbcx = False
plane.pbcy = False
# plane.pmly = False
plane.pml_thick = 10
plane.set_pml()
plane.tminc.enter = 2
plane.xtfsf = [50,251]
plane.ytfsf = [50,251]

metal = PolarDPlane(plane.shape, a=(9.39*10**15)**2, b=0, c=3.14*10**13, d=1, dt=deltat)
metal.set_factor()
circle(metal.mask, [121,151], 25, 1)
circle(metal.mask, [181,151], 25, 1)
Esempio n. 4
0
from yafdtd.utils import *
from scipy.constants import c, epsilon_0, mu_0

name = "silver-bulk"
outdir = "result/%s" % name
prepare(outdir)
hdf5 = h5py.File("result/%s/%s.hdf5" % (name, name), "w")
hdf5.attrs["name"] = name
hdf5.require_group("timeline")

length = 201
deltax = 10**(-9)
deltat = deltax/(2*c)
freq   = 5*10**14

plane = DispersivePlane(YTFSFPlane(UPMLPlane(PBCPlane(Plane((length,length))))))
plane.pbcy = False
plane.pmlx = False
plane.pml_thick = 20
plane.set_pml()
plane.tminc.enter = 2
plane.xtfsf = [None, None]
plane.ytfsf = [25,176]

# metal = PolarDPlane(plane.shape, a=(1.25663*10**16)**2, b=0, c=5.7*10**13, d=1, dt=deltat)
metal = PolarDPlane(plane.shape, a=(9.39*10**15)**2, b=0, c=3.14*10**13, d=1, dt=deltat)
metal.set_factor()
metal.mask[:,50:80] = 1

for t in range(0,3000):
    print t
Esempio n. 5
0
from scipy.constants import c, epsilon_0, mu_0
from math import sin, pi

name = "teytfsf"
outdir = "result/%s" % name
prepare(outdir)
hdf5 = h5py.File("%s/%s.hdf5" % (outdir, name), "w")
hdf5.attrs["name"] = name 
hdf5.require_group("timeline")

length = 61
deltax = 10**-9
deltat = deltax/(2*c)
freq   = 4*10**15

plane = DispersivePlane(YTFSFPlane(UPMLPlane(PBCPlane(Plane((length,length))))))
plane.pbcy = False
plane.pmlx = False
plane.pml_thick = 5
plane.set_pml()
plane.teinc.enter = 2
plane.xtfsf = [10, length-10]
plane.ytfsf = [10, length-10]

for t in range(0,600):
    plane.teinc.update(sin(2*pi*freq*t*deltat))

    plane.update_hpbc()
    plane.update_dfield().update_dtfsf()
    plane.update_efield()
#!/usr/bin/env python
#-*- mode: python -*-

import sys, os, math, h5py, numpy
sys.path.append(".")

from yafdtd.grid import Plane, PBCPlane, UPMLPlane, XTFSFPlane, DispersivePlane, PolarDPlane
from yafdtd.utils import *
from scipy.constants import c
from math import sin, pi
from yafdtd.geometry import circle

length = 301

plane = DispersivePlane(XTFSFPlane(UPMLPlane(PBCPlane(Plane("silver-rod-25nm-xtfsf-te-dx1nm", (length,length))))))
plane.pml(
    x = True,
    y = True,
    thick = 20
)
plane.pbc(
    x = False,
    y = True
)
plane.tfsf(
    xtfsf = [50, length-50],
    ytfsf = [50, length-50],
    enter = 2
)
plane.circle_e([151,151], 25, 8.926)
plane.open("result/%s/%s.hdf5" % (plane.name, plane.name))
#!/usr/bin/env python
#-*- mode: python -*-

import sys, os, math, h5py, numpy
sys.path.append(".")

from yafdtd.grid import Plane, PBCPlane, UPMLPlane, XTFSFPlane, DispersivePlane, PolarDPlane
from yafdtd.utils import *
from scipy.constants import c
from math import sin, pi
from yafdtd.geometry import circle

length = 301

plane = DispersivePlane(XTFSFPlane(UPMLPlane(PBCPlane(Plane("silicon-rod-25nm-xtfsf-te-dx1nm", (length,length))))))
plane.open("result/%s/%s.hdf5" % (plane.name, plane.name))
plane.wavelength(347.5*10**-9).dx(10**-9).save_attrs()
plane.pbc(x = False, y = False).pml(thick = 13).set_pml()
plane.teinc.enter = 2
plane.ytfsf = [50,length-50]
plane.xtfsf = [50,length-50]
circle(plane.epsilon_rx, [151,151.5], 25, 12)
circle(plane.epsilon_ry, [151.5,151], 25, 12)
circle(plane.epsilon_rz, [151,151],   25, 12)

prepare("result/%s/ex" % plane.name)
prepare("result/%s/ey" % plane.name)
prepare("result/%s/hz" % plane.name)

for t in range(0,2000):
    plane.t = t