plfdtd (0.1.0) | 2012-05-14 18:57 |
pylaf (0.5.0) | 2012-10-18 17:20 |
下記のコードを実行するとダイポールアンテナを解析するFDTDシミュレータが立ち上がります。
- # coding: utf-8
- import pylaf.recipes.fdtd
- from plfdtd.solvers.rlsolver import RectilinearYee
- class Dielectric(pylaf.recipes.fdtd.Plugin):
- def __call__(self):
- yee = self.dataset.get()
- # yee.epr[:,:,14] = 2.17
- class Metal(pylaf.recipes.fdtd.Plugin):
- def __call__(self):
- ex, ey, ez = self.dataset.get().e
- #
- ey[20,28:-27,20] = 0.
- class PMC(pylaf.recipes.fdtd.Plugin):
- def __call__(self):
- hx, hy, hz = self.dataset.get().h
- if __name__ == '__main__':
- port = [('y',20,40,20)]
- shape = (40,80,40)
- dt = .01 # [ns]
- maxiter = 2400
- #
- dataset = RectilinearYee(shape=shape,dt=dt) # [ns]
- dx, dy, dz = dataset.axes
- dx[:] = dx * 6 # mm
- dy[:] = dy * 6 # mm
- dz[:] = dz * 6 # mm
- #
- from plfdtd import simulator_for_1p
- simulator_for_1p.invoke(dataset,port,shape,dt,maxiter,Dielectric,Metal,PMC)
- }}}