diff --git a/meanas/fdfd/__init__.py b/meanas/fdfd/__init__.py index d0d58a9..c9eba8c 100644 --- a/meanas/fdfd/__init__.py +++ b/meanas/fdfd/__init__.py @@ -12,6 +12,14 @@ Submodules: - `scpml`: Stretched-coordinate perfectly matched layer (scpml) boundary conditions - `waveguide_2d`: Operators and mode-solver for waveguides with constant cross-section. - `waveguide_3d`: Functions for transforming `waveguide_2d` results into 3D. + + +=========== + +# TODO FDFD? +# TODO PML + + """ from . import solvers, operators, functional, scpml, waveguide_2d, waveguide_3d # from . import farfield, bloch TODO diff --git a/meanas/fdfd/waveguide_2d.py b/meanas/fdfd/waveguide_2d.py index 49f33ad..6bb3ade 100644 --- a/meanas/fdfd/waveguide_2d.py +++ b/meanas/fdfd/waveguide_2d.py @@ -5,7 +5,144 @@ The propagation direction is chosen to be along the z axis, and all fields are given an implicit z-dependence of the form `exp(-1 * wavenumber * z)`. As the z-dependence is known, all the functions in this file assume a 2D grid - (i.e. `dxes = [[[dx_e_0, dx_e_1, ...], [dy_e_0, ...]], [[dx_h_0, ...], [dy_h_0, ...]]]`). + (i.e. `dxes = [[[dx_e[0], dx_e[1], ...], [dy_e[0], ...]], [[dx_h[0], ...], [dy_h[0], ...]]]`). + + +=============== + +Consider Maxwell's equations in continuous space, in the frequency domain. Assuming +a structure with some (x, y) cross-section extending uniformly into the z dimension, +with a diagonal \\( \\epsilon \\) tensor, we have + +$$ +\\begin{align*} +\\nabla \\times \\vec{E}(x, y, z) &= -\\imath \\omega \\mu \\vec{H} \\\\ +\\nabla \\times \\vec{H}(x, y, z) &= \\imath \\omega \\epsilon \\vec{E} \\\\ +\\vec{E}(x,y,z) = (\\vec{E}_t(x, y) + E_z(x, y)\\vec{z}) e^{-\\gamma z} \\\\ +\\vec{H}(x,y,z) = (\\vec{H}_t(x, y) + H_z(x, y)\\vec{z}) e^{-\\gamma z} \\\\ +\\end{align*} +$$ + +Expanding the first two equations into vector components, we get + +$$ +\\begin{align*} +-\\imath \\omega \\mu_{xx} H_x &= \\partial_y E_z - \\partial_z E_y \\\\ +-\\imath \\omega \\mu_{yy} H_y &= \\partial_z E_x - \\partial_x E_z \\\\ +-\\imath \\omega \\mu_{zz} H_z &= \\partial_x E_y - \\partial_y E_x \\\\ +\\imath \\omega \\epsilon_{xx} E_x &= \\partial_y H_z - \\partial_z H_y \\\\ +\\imath \\omega \\epsilon_{yy} E_y &= \\partial_z H_x - \\partial_x H_z \\\\ +\\imath \\omega \\epsilon_{zz} E_z &= \\partial_x H_y - \\partial_y H_x \\\\ +\\end{align*} +$$ + +Substituting in our expressions for \\( \\vec{E}, \\vec{H} \\) and discretizing: + +$$ +\\begin{align*} +-\\imath \\omega \\mu_{xx} H_x &= \\tilde{\\partial}_y E_z + \\gamma E_y \\\\ +-\\imath \\omega \\mu_{yy} H_y &= -\\gamma E_x - \\tilde{\\partial}_x E_z \\\\ +-\\imath \\omega \\mu_{zz} H_z &= \\tilde{\\partial}_x E_y - \\tilde{\\partial}_y E_x \\\\ +\\imath \\omega \\epsilon_{xx} E_x &= \\hat{\\partial}_y H_z + \\gamma H_y \\\\ +\\imath \\omega \\epsilon_{yy} E_y &= -\\gamma H_x - \\hat{\\partial}_x H_z \\\\ +\\imath \\omega \\epsilon_{zz} E_z &= \\hat{\\partial}_x H_y - \\hat{\\partial}_y H_x \\\\ +\\end{align*} +$$ + +Rewrite the last three equations as +$$ +\\begin{align*} +\\gamma H_y &= \\imath \\omega \\epsilon_{xx} E_x - \\hat{\\partial}_y H_z \\\\ +\\gamma H_x &= -\\imath \\omega \\epsilon_{yy} E_y - \\hat{\\partial}_x H_z \\\\ +\\imath \\omega E_z &= \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_x H_y - \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_y H_x \\\\ +\\end{align*} +$$ + +Now apply \\( \\gamma \\tilde{\\partial}_x \\) to the last equation, +then substitute in for \\( \\gamma H_x \\) and \\( \\gamma H_y \\): + +$$ +\\begin{align*} +\\gamma \\tilde{\\partial}_x \\imath \\omega E_z &= \\gamma \\tilde{\\partial}_x \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_x H_y + - \\gamma \\tilde{\\partial}_x \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_y H_x \\\\ + &= \\tilde{\\partial}_x \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_x ( \\imath \\omega \\epsilon{xx} E_x - \\hat{\\partial}_y H_z) + - \\tilde{\\partial}_x \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_y (-\\imath \\omega \\epsilon{yy} E_y - \\hat{\\partial}_x H_z) \\\\ + &= \\tilde{\\partial}_x \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_x ( \\imath \\omega \\epsilon{xx} E_x) + - \\tilde{\\partial}_x \\frac{1}{\\epsilon_{zz}} \\hat{\\partial}_y (-\\imath \\omega \\epsilon{yy} E_y) \\\\ +\\gamma \\tilde{\\partial}_x E_z &= \\tilde{\\partial}_x \\frac{1}{\\epsilon_zz} \\hat{\\partial}_x (\\epsilon_{xx} E_x) + \\tilde{\\partial}_x \\frac{1}{\\epsilon_zz} \\hat{\\partial}_y (\\epsilon_{yy} E_y) \\\\ +\\end{align*} +$$ + +With a similar approach (but using \\( \\tilde{\\partial}_y \\) instead), we can get + +$$ +\\begin{align*} +\\gamma \\tilde{\\partial}_y E_z &= \\tilde{\\partial}_y \\frac{1}{\\epsilon_zz} \\hat{\\partial}_x (\\epsilon_{xx} E_x) + \\tilde{\\partial}_y \\frac{1}{\\epsilon_zz} \\hat{\\partial}_y (\\epsilon_{yy} E_y) \\\\ +\\end{align*} +$$ + +We can combine this equation for \\( \\gamma \\tilde{\\partial}_y E_z \\) with +the unused \\( \\imath \\omega \\mu_{xx} H_z \\) and \\( \\imath \\omega \\mu_{yy} H_y \\) equations to get + +$$ +\\begin{align*} +-\\imath \\omega \\mu_{xx} \\gamma H_x &= \\gamma^2 E_y + \\tilde{\\partial}_y ( + \\tilde{\\partial}_x \\frac{1}{\\epsilon_zz} \\hat{\\partial}_x (\\epsilon_{xx} E_x) + + \\tilde{\\partial}_x \\frac{1}{\\epsilon_zz} \\hat{\\partial}_y (\\epsilon_{yy} E_y) \\\\ + ) \\\\ +-\\imath \\omega \\mu_{yy} \\gamma H_y &= -\\gamma^2 E_x - \\tilde{\\partial}_x ( + \\tilde{\\partial}_y \\frac{1}{\\epsilon_zz} \\hat{\\partial}_x (\\epsilon_{xx} E_x) + + \\tilde{\\partial}_y \\frac{1}{\\epsilon_zz} \\hat{\\partial}_y (\\epsilon_{yy} E_y) + )\\\\ +\\end{align*} +$$ + +However, based on our rewritten equation for \\( \\gamma H_x \\) and the so-far unused +equation for \\( \\imath \\omega \\mu_{zz} H_z \\) we can also write + +$$ +\\begin{align*} +-\\imath \\omega \\mu_{xx} (\\gamma H_x) &= -\\imath \\omega \\mu_{xx} (-\\imath \\omega \\epsilon_{yy} E_y - \\hat{\\partial}_x H_z) \\\\ + &= -\\omega^2 \\mu_{xx} \\epsilon_{yy} E_y + -\\imath \\omega \\mu_{xx} \\hat{\\partial}_x ( + \\frac{1}{-\\imath \\omega \\mu_{zz}} (\\tilde{\\partial}_x E_y - \\tilde{\\partial}_y E_x)) \\\\ + &= -\\omega^2 \\mu_{xx} \\epsilon_{yy} E_y + +\\mu_{xx} \\hat{\\partial}_x \\frac{1}{\\mu_{zz}} (\\tilde{\\partial}_x E_y - \\tilde{\\partial}_y E_x) \\\\ +\\end{align*} +$$ + +and, similarly, + +$$ +\\begin{align*} +-\\imath \\omega \\mu_{yy} (\\gamma H_y) &= -\\omega^2 \\mu_{yy} \\epsilon_{xx} E_x + +\\mu_{yy} \\hat{\\partial}_y \\frac{1}{\\mu_{zz}} (\\tilde{\\partial}_x E_y - \\tilde{\\partial}_y E_x) \\\\ +\\end{align*} +$$ + +Using these, we can construct the eigenvalue problem +$$ \\beta^2 \\begin{bmatrix} E_x \\\\ + E_y \\end{bmatrix} = + (\\omega^2 \\begin{bmatrix} \\mu_{yy} \\epsilon_{xx} & 0 \\\\ + 0 & \\mu_{xx} \\epsilon_{yy} \\end{bmatrix} + + \\begin{bmatrix} -\\mu_{yy} \\hat{\\partial}_y \\\\ + \\mu_{xx} \\hat{\\partial}_x \\end{bmatrix} \\mu_{zz}^{-1} + \\begin{bmatrix} -\\tilde{\\partial}_y & \\tilde{\\partial}_x \\end{bmatrix} + + \\begin{bmatrix} \\tilde{\\partial}_x \\\\ + \\tilde{\\partial}_y \\end{bmatrix} \\epsilon_{zz}^{-1} + \\begin{bmatrix} \\hat{\\partial}_x \\epsilon_{xx} & \\hat{\\partial}_y \\epsilon_{yy} \\end{bmatrix}) + \\begin{bmatrix} E_x \\\\ + E_y \\end{bmatrix} +$$ + +An equivalent eigenvalue problem can be formed using the \\( H_x, H_y \\) fields, if those are more convenient. + +Note that \\( E_z \\) was never discretized, so \\( \\gamma \\) and \\( \\beta \\) will need adjustment +to account for numerical dispersion if the result is introduced into a space with a discretized z-axis. + + """ # TODO update module docs