Skip to content

Commit 7e3ba91

Browse files
author
Jon Schlipf
committed
sign reversal
1 parent cb2d5c0 commit 7e3ba91

File tree

1 file changed

+4
-44
lines changed

1 file changed

+4
-44
lines changed

src/Common/Common.jl

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -248,24 +248,6 @@ function e2p(ex,ey,ez,Kz,kz0)
248248
end
249249

250250

251-
"""
252-
a2p2(a,W,Kx,Ky,Kz,kz0)
253-
254-
Converts an amplitude vector (in substrate or superstrate) to Poynting power flow in z direction
255-
# Arguments
256-
* `a` : amplitude vector
257-
* `W` : eigenmodes of the halfspace
258-
* `Kx` : x component of the wavevector in the medium
259-
* `Ky` : y component of the wavevector in the medium
260-
* `Kz` : z component of the wavevector in the medium
261-
* `kz0` : z component of the plane wave wavevector in the superstrate
262-
# Outputs
263-
* `P` : power flow
264-
"""
265-
function a2p2(a,W,Kx,Ky,Kz,kz0)
266-
ex,ey,ez=a2e(a,W,Kx,Ky,Kz)
267-
return e2p(ex,ey,ez,Kz,kz0)
268-
end
269251
"""
270252
a2p(a,b,W,Kx,Ky,kz0)
271253
@@ -290,7 +272,6 @@ end
290272
a2e2d(a,W)
291273
292274
Converts an amplitude vector to reciprocal-space electric fields Ex and Ey.
293-
This is a "light" version of the "a2e" method.
294275
# Arguments
295276
* `a` : amplitude vector
296277
* `W` : eigenmodes of the halfspace
@@ -305,27 +286,6 @@ function a2e2d(a,W)
305286
return ex,ey
306287
end
307288

308-
"""
309-
a2e(a,W,Kx,Ky,Kz)
310-
311-
converts an amplitude vector (in substrate or superstrate) to reciprocal-space electric fields
312-
# Arguments
313-
* `a` : x amplitude vector
314-
* `W` : eigenmodes of the halfspace
315-
* `Kx` : x component of the wavevector in the medium
316-
* `Ky` : y component of the wavevector in the medium
317-
* `Kz` : z component of the wavevector in the medium
318-
# Outputs
319-
* `ex` : x-component of the electric field
320-
* `ey` : y-component of the electric field
321-
* `ez` : z-component of the electric field
322-
"""
323-
function a2e(a,W,Kx,Ky,Kz)
324-
ex,ey=a2e2d(a,W)
325-
#Plane wave, E⊥k, E*k=0
326-
ez=-Kz\(Kx*ex+Ky*ey)
327-
return ex,ey,ez
328-
end
329289

330290
"""
331291
getfields(ain,bout,em::Eigenmodes,grd::RCWAGrid,xypoints,zpoints,λ,window,padding)
@@ -365,10 +325,10 @@ function getfields(ain,bout,em::Eigenmodes,grd::RCWAGrid,xypoints,zpoints,λ,win
365325
a=exp( (em.q*2π/λ*zpoints[zind]))*ain
366326
b=exp(-(em.q*2π/λ*zpoints[zind]))*bout
367327
#convert amplitude vectors to electric fields
368-
ex,ey,ez=a2e(a+b,em.W,grd.Kx,grd.Ky,grd.Kz0)
369-
hx,hy,hz=a2e(a-b,em.V,grd.Kx,grd.Ky,grd.Kz0)
370-
ez=1im*(grd.Kx*hy-grd.Ky*hx)
371-
hz=1im*(grd.Kx*ey-grd.Ky*ex)
328+
ex,ey=a2e2d(a+b,em.W)
329+
hx,hy=a2e2d(a-b,em.V)
330+
ez=-1im*(grd.Kx*hy-grd.Ky*hx)
331+
hz=-1im*(grd.Kx*ey-grd.Ky*ex)
372332
#convert from reciprocal lattice vectors to real space distribution
373333
efield[:,:,zind,1]=recipvec2real(Array(grd.nx),Array(grd.ny),Array(ex),nx,ny,windowfunction)
374334
efield[:,:,zind,2]=recipvec2real(Array(grd.nx),Array(grd.ny),Array(ey),nx,ny,windowfunction)

0 commit comments

Comments
 (0)