Wave Guides - exercice 16

C.Delaere

\(<< Graphics`PlotField3D`
<< Calculus`VectorAnalysis`\)

Some parameters

\(w = 10; 
a = 1; 
b = 0.5; 
m = 1; 
n = 1; 
H = 1; 

    g2 = Pi^2*\((m^2/a^2 + n^2/b^2)\)\)\(k = 	\((w^2 - g2)\)^\((1/2)\)	\)

Magnetic field

\(Hz[x_, y_, z_, t_] := H*Cos[m*Pi*x/a]*Cos[n*Pi*y/b]*Cos[k*z - w*t]; 

    Hx[x_, y_, z_, t_] := 
      \(-k\)/g2*H*m*Pi/a*Sin[m*Pi*x/a]*Cos[n*Pi*y/b]*Sin[k*z - w*t]; 

    Hy[x_, y_, z_, t_] := 
      \(-k\)/g2*H*n*Pi/b*Cos[m*Pi*x/a]*Sin[n*Pi*y/b]*Sin[k*z - w*t]; \)

Electric field

\(Ex[x_, y_, z_, t_] := 
      \(-k\)/w*\(CrossProduct[{0, 0, 1}, {Hx[x, y, z, t], Hy[x, y, z, t], 0}]
            \)[\([1]\)]; 

    Ey[x_, y_, z_, t_] := 
      \(-k\)/w*\(CrossProduct[{0, 0, 1}, {Hx[x, y, z, t], Hy[x, y, z, t], 0}]
            \)[\([2]\)]; 
Ez[x_, y_, z_, t_] := 0; \)

Behaviour of Electric and Magnetic fields for fixed time/z-position

ContourPlot[
      Ex[xx, yy, 2, 0]^2 + Ey[xx, yy, 2, 0]^2, {xx, 0, a}, {yy, 0, b},  
      AspectRatio -> Automatic]Plot3D[Ex[xx, yy, 2, 0]^2 + Ey[xx, yy, 2, 0]^2, {xx, 0, a}, {yy, 0, b}, 
       AspectRatio -> Automatic]

ContourPlot[
      Hx[xx, yy, 2, 0]^2 + Hy[xx, yy, 2, 0]^2 + Hz[xx, yy, 2, 0]^2, {xx, 0, 
        a}, {yy, 0, b},  AspectRatio -> Automatic]Plot3D[
      Hx[xx, yy, 2, 0]^2 + Hy[xx, yy, 2, 0]^2 + Hz[xx, yy, 2, 0]^2, {xx, 0, 
        a}, {yy, 0, b},  AspectRatio -> Automatic]

Time evolution of the fields

\(Do[

      PlotVectorField3D[{Ex[xx, yy, zz, ti], Ey[xx, yy, zz, ti], 
          Ez[xx, yy, zz, ti]}, {xx, 0, 1}, {yy, 0, 0.5}, {zz, 0, 2}]
, {ti, 
        0, 2*Pi, 1}]\)

\(Do[

      PlotVectorField3D[{Hx[xx, yy, zz, ti], Hy[xx, yy, zz, ti], 
          Hz[xx, yy, zz, ti]}, {xx, 0, 1}, {yy, 0, 0.5}, {zz, 0, 2}]
, {ti, 
        0, 2*Pi, 1}]\)

Polarisation

\(deltaa = 0.995*a; deltab = 0.995*b; 

    Plot3D[ArcTan[Ex[xx, yy, 1, 0]/Ey[xx, yy, 1, 0]], {xx, a/2 - deltaa, 
        a/2 + deltaa}, {yy, b/2 - deltab, b/2 + deltab}]\)

Movement of a charged particle in the guide

the force (Lorentz)

F[x_, y_, z_, t_, vxx_, vyy_, vzz_] := 
      q*({Ex[x, y, z, t], Ey[x, y, z, t], Ez[x, y, z, t]} + 
            CrossProduct[{vxx, vyy, vzz}, {Hx[x, y, z, t], Hy[x, y, z, t], 
                Hz[x, y, z, t]}])

Initial parameters

\(dt = 0.01; 
tf = 50; 
Clear[posxv]; 
Clear[posyv]; 
Clear[poszv]; 

    posxv = {}; 
posyv = {}; 
poszv = {}; 
posx = 0.2; 
posy = 0.2; 

    posz = 0.2; 
vx = 0; 
vy = 0; 
vz = 0; 
q = 1; 
m = 1; \)

Iteration

\(Do[
	
      vx\  = \ vx\  + \ 
          \(F[posx, posy, posz, ti, vx, vy, vz]\)[\([1]\)]*dt/m; 
	
      vy\  = \ vy\  + \ 
          \(F[posx, posy, posz, ti, vx, vy, vz]\)[\([2]\)]*dt/m; 
	
      vz\  = \ vz\  + \ 
          \(F[posx, posy, posz, ti, vx, vy, vz]\)[\([3]\)]*dt/m; 
	
      posx = posx + vx*dt; 
	posy = posy + vy*dt; 
	posz = posz + vz*dt; 
      
	posxv = Append[posxv, posx]; 
	posyv = Append[posyv, posy]; 
	
      \(poszv = Append[poszv, posz]; \)
	, {ti, 0, tf, dt}]\)

\(ListPlot[posxv]; 
ListPlot[posyv]; 
ListPlot[poszv]; 

    ParametricPlot3D[{posxv[\([Round[t/dt]]\)], posyv[\([Round[t/dt]]\)], 
        poszv[\([Round[t/dt]]\)]}, {t, dt, tf}]; \)