Input Fields
This module allows to compute input fields. It also implements derivatives of some of them.
See the Theory pdf to know more about the expression used to compute the input fields. In general $N$ represents the number of input positions.
Functions Documentation
Plane Waves
Main.CoupledElectricMagneticDipoles.InputFields.plane_wave_e
— Functionplane_wave_e(krf;khat=[0,0,1],e0=[1,0,0])
Computes the electric field of a monochromatic plane wave evaluated at a set of dimensionless positions krf
. khat
is the direction of propagation and e0
is the polarization. The user is responsible for using physical inputs. krf
is a $N\times 3$ float array. The output is a $N\times 3$ complex array representing the electric field at each of the positions in the krf
array.
Main.CoupledElectricMagneticDipoles.InputFields.plane_wave_e_m
— Functionplane_wave_e_m(krf;khat=[0,0,1],e0=[1,0,0])
Computes the electric and magnetic fields of a monochromatic plane wave evaluated at a set of dimensionless positions krf
. khat
is the direction of propagation and e0
is the polarization. The user is responsible for using physical inputs. krf
is a $N\times 3$ float array. The output is a $N\times 6$ complex array representing the electric and magnetic fields at each of the positions in the krf
array.
Point Dipole Sources
Main.CoupledElectricMagneticDipoles.InputFields.point_dipole_e
— Functionpoint_dipole_e(krf, krd, dip, e0_const=1)
Computes the electric field emitted by an electric point dipole.
Arguments
krf
: 2D float array of size $N\times 3$ containing the dimensionless positions $k\mathbf{r}$ where the field is computed.krd
: 1D float array of size 3 containing the dimensionless position $k\mathbf{r_d}$ where the source is located.dip
: integer defining the dipole moment (dip = 1,2,3
is an electric dipole along x,y,z respectively)
or complex array of size 3 with the components for the electric dipole moment.
e0
: float with the modulus ofdip
.
Outputs
e_dipole
: 2D $N\times 3$ complex array with the electromagnetic field.
Main.CoupledElectricMagneticDipoles.InputFields.point_dipole_e_m
— Functionpoint_dipole_e_m(krf, krd, dip, e0=1)
Computes the electric and magnetic fields emitted by an electric and/or magnetic point dipole.
Arguments
krf
: 2D float array of size $N\times 3$ containing the dimensionless positions $k\mathbf{r}$ where the field is computed.krd
: 1D float array of size 3 containing the dimensionless position $k\mathbf{r_d}$ where the source is located.dip
: integer defining the dipole moment (dip = 1,2,3
is an electric dipole along x,y,z respectively anddip = 4,5,6
is a magnetic dipole along x,y,z respectively)
or complex array of size 6 with the first 3 components for the electric dipole moment and the last 3 components for the magnetic dipole moment.
e0
: float with the modulus ofdip
.
Outputs
phi_dipole
: 2D $N\times 6$complex array with the electromagnetic fields at each position.
Gaussian, Hermite-Gaussian and Laguerre-Gaussian Beams
Main.CoupledElectricMagneticDipoles.InputFields.gaussian_beam_e
— Functiongaussian_beam_e(krf, kbw0,n,m; n = 0, m = 0, kind = "hermite", e0 = 1, kmax = nothing, maxe=Int(5e3))
Computes the electric field distribution of a Gaussian, Hermite-Gaussian and Laguerre-Gaussian beam that propagates along the z-axis and where the electric field is polarized along the x-axis (polarized electric). By default, the Gaussian beam profile is calculated. For another polarization just rotate the field in the xy-plane. Also, for a polarized magnetic field, exchange E with ZH and H with -E.
Arguments
krf
: 2D float array of size $N\times 3$ containing the dimensionless positions $k\mathbf{r}$ where the field is computed.kbw0
: float with the dimensionless beam waist radius ($k\omega_0$, where $\omega_0$ is the beam waist radius).n
: int with the order of the beam.m
: int with the degree of the beam.kind
: string with the kind of beam ("hermite" or "laguerre").e0
: float with the modulus of the electric field at the origin of coordinates of the theoretical field (including evanescent waves).kmax
: float setting the limit of the radial integration (it should bekmax < 1
).maxe
: maximum number of evaluations in the adaptive integral (see Cubature.jl for more details).
Outputs
e_gauss
: 2D complex array of size $N\times 3$ with the value of the electric field at each positions.
Main.CoupledElectricMagneticDipoles.InputFields.gaussian_beam_e_m
— Functiongaussian_beam_e_m(krf, kbw0,n,m; n = 0, m = 0, kind = "hermite", e0 = 1, kmax = nothing, maxe=Int(5e3))
Computes the electromagnetic field distribution of a Gaussian, Hermite-Gaussian and Laguerre-Gaussian beam that propagates along the z-axis and where the electric field is polarized along the x-axis (polarized electric). By default, the Gaussian beam profile is calculated. For another polarization just rotate the field in the xy-plane. Also, for a polarized magnetic field, exchange E with ZH and H with -E.
Arguments
krf
: 2D float array of size $N\times 3$ containing the dimensionless positions $k\mathbf{r}$ where the field is computed.kbw0
: float with the dimensionless beam waist radius ($k\omega_0$, where $\omega_0$ is the beam waist radius).n
: int with the order of the beam.m
: int with the degree of the beam.kind
: string with the kind of beam ("hermite" or "laguerre").e0
: float with the modulus of the electric field at the origin of coordinates of the theoretical field (including evanescent waves).kmax
: float setting the limit of the radial integration (it should bekmax < 1
).maxe
: maximum number of evaluations in the adaptive integral (see Cubature.jl for more details).
Outputs
phi_gauss
: 2D complex array of size $N\times 6$ with the value of the electric and magnetic fields at each positions.
Derivatives of the Beams
Main.CoupledElectricMagneticDipoles.InputFields.d_plane_wave_e
— Functiond_plane_wave_e(kr;khat=[0,0,1],e0=[1,0,0])
Computes the spatial derivatives of an electric field generated with plane_wave_e
(the arguments are the same as for plane_wave_e
). Outputs three 2D arrays of size $N\times 3$ containing the electric field derivatives with respect k*x
, k*y
and k*z
.
Main.CoupledElectricMagneticDipoles.InputFields.d_plane_wave_e_m
— Functiond_plane_wave_e_m(kr;khat=[0,0,1],e0=[1,0,0])
Computes the spatial derivatives of an electromagnetic field generated with plane_wave_e_m
(the arguments are the same as for plane_wave_e_m
). Outputs three 2D arrays of size $N\times 6$ containing the electric and magnetic fields derivatives with respect of k*x
, k*y
and k*z
.
Main.CoupledElectricMagneticDipoles.InputFields.d_point_dipole_e
— Functiond_point_dipole_e(krf, krd, dip, e0=1)
Computes the spatial derivatives of an electric field generated with point_dipole_e
(the arguments are the same as for point_dipole_e
). Outputs three 2D arrays of size $N\times 3$ containing the electric field derivatives with respect k*x
, k*y
and k*z
.
Main.CoupledElectricMagneticDipoles.InputFields.d_point_dipole_e_m
— Functiond_point_dipole_e_m(krf, krd, dip, e0=1)
Computes the spatial derivatives of an electromagnetic field generated with point_dipole_e_m
(the arguments are the same as for point_dipole_e_m
). Outputs three 2D arrays of size $N\times 6$ containing the electric and magnetic fields derivatives with respect of k*x
, k*y
and k*z
.
Main.CoupledElectricMagneticDipoles.InputFields.d_gaussian_beam_e
— Functiond_gaussian_beam_e(krf, kbw0; n = 0, m = 0, kind = "hermite", e0 = 1, kmax = nothing, maxe=Int(5e3))
Computes the spatial derivatives of an electric field generated with gaussian_beam_e
(the arguments are the same as for gaussian_beam_e_m
). Outputs three 2D arrays of size $N\times 3$ containing the electric field derivatives with respect k*x
, k*y
and k*z
.
Main.CoupledElectricMagneticDipoles.InputFields.d_gaussian_beam_e_m
— Functiond_gaussian_beam_e_m(krf, kbw0; n = 0, m = 0, kind = "hermite", e0 = 1, kmax = nothing, maxe=Int(5e3))
Computes the spatial derivatives of an electromagnetic field generated with gaussian_beam_e_m
(the arguments are the same as for gaussian_beam_e_m
). Outputs three 2D arrays of size $N\times 6$ containing the electric and magnetic field derivatives with respect of k*x
, k*y
and k*z
.