예제 #1
0
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
).frequency(
    # 1.5e14
    6e14
).save_attrs()

plane.rectangle_e(center=[151,351], xlen=70, ylen=710, value=8.9)
plane.rectangle_e(center=[151,351], xlen=70, ylen=8,   value=1)
plane.rectangle_e(center=[126,251], xlen=20, ylen=8,   value=1)
plane.rectangle_e(center=[126,451], xlen=20, ylen=8,   value=1)
plane.rectangle_e(center=[126,151], xlen=20, ylen=8,   value=1)
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))
plane.wavelength(347.5*10**-9).dx(10**-9).save_attrs()