(d, ph, gp, nmode)
| 30 | |
| 31 | |
| 32 | def pol_grating(d, ph, gp, nmode): |
| 33 | sx = dpml + dsub + d + d + dpad + dpml |
| 34 | sy = gp |
| 35 | |
| 36 | cell_size = mp.Vector3(sx, sy, 0) |
| 37 | |
| 38 | # twist angle of nematic director; from equation 1b |
| 39 | def phi(p): |
| 40 | xx = p.x - (-0.5 * sx + dpml + dsub) |
| 41 | if (xx >= 0) and (xx <= d): |
| 42 | return math.pi * p.y / gp + ph * xx / d |
| 43 | else: |
| 44 | return math.pi * p.y / gp - ph * xx / d + 2 * ph |
| 45 | |
| 46 | # return the anisotropic permittivity tensor for a uniaxial, twisted nematic liquid crystal |
| 47 | def lc_mat(p): |
| 48 | # rotation matrix for rotation around x axis |
| 49 | Rx = mp.Matrix( |
| 50 | mp.Vector3(1, 0, 0), |
| 51 | mp.Vector3(0, math.cos(phi(p)), math.sin(phi(p))), |
| 52 | mp.Vector3(0, -math.sin(phi(p)), math.cos(phi(p))), |
| 53 | ) |
| 54 | lc_epsilon = Rx * epsilon_diag * Rx.transpose() |
| 55 | lc_epsilon_diag = mp.Vector3(lc_epsilon[0].x, lc_epsilon[1].y, lc_epsilon[2].z) |
| 56 | lc_epsilon_offdiag = mp.Vector3( |
| 57 | lc_epsilon[1].x, lc_epsilon[2].x, lc_epsilon[2].y |
| 58 | ) |
| 59 | return mp.Medium( |
| 60 | epsilon_diag=lc_epsilon_diag, epsilon_offdiag=lc_epsilon_offdiag |
| 61 | ) |
| 62 | |
| 63 | geometry = [ |
| 64 | mp.Block( |
| 65 | center=mp.Vector3(-0.5 * sx + 0.5 * (dpml + dsub)), |
| 66 | size=mp.Vector3(dpml + dsub, mp.inf, mp.inf), |
| 67 | material=mp.Medium(index=n_0), |
| 68 | ), |
| 69 | mp.Block( |
| 70 | center=mp.Vector3(-0.5 * sx + dpml + dsub + d), |
| 71 | size=mp.Vector3(2 * d, mp.inf, mp.inf), |
| 72 | material=lc_mat, |
| 73 | ), |
| 74 | ] |
| 75 | |
| 76 | # linear-polarized planewave pulse source |
| 77 | src_pt = mp.Vector3(-0.5 * sx + dpml + 0.3 * dsub, 0, 0) |
| 78 | sources = [ |
| 79 | mp.Source( |
| 80 | mp.GaussianSource(fcen, fwidth=0.05 * fcen), |
| 81 | component=mp.Ez, |
| 82 | center=src_pt, |
| 83 | size=mp.Vector3(0, sy, 0), |
| 84 | ), |
| 85 | mp.Source( |
| 86 | mp.GaussianSource(fcen, fwidth=0.05 * fcen), |
| 87 | component=mp.Ey, |
| 88 | center=src_pt, |
| 89 | size=mp.Vector3(0, sy, 0), |
no test coverage detected