Modes.jl
Luna.Modes.AbstractMode — TypeAbstractModeAbstract type representing a single mode of a waveguide.
Luna.Modes.ToSpace — MethodToSpace(ms; components=:xy)Construct a ToSpace for high performance conversion between modal fields and real space.
Arguments
ms::Tuple: a tuple of modescomponents::Symbol: which polarisation components to return: :x, :y, :xy
Luna.Modes.Aeff — MethodAeff(m::AbstractMode; z=0.0)Get effective area of mode m and longitudinal position z.
This is the brute-force implementation valid for any mode.
Luna.Modes.Exy — MethodExy(m::AbstractMode, xs; z=0.0)Get the normalised field components at position xs, z.
Luna.Modes.Exy — MethodExy(m::AbstractMode; z=0.0)Create function that returns normalised (xs) -> (Ex, Ey)
Luna.Modes.N — MethodN(m::AbstractMode; z=0.0)Get mode normalization constant of mode m at longitudinal position z.
Luna.Modes.absE — MethodabsE(m::AbstractMode, xs; z=0.0)Get the field norm $|E|$ at position xs, z
Luna.Modes.absE — MethodabsE(m::AbstractMode; z=0.0)Create function that returns normalised (xs) -> $|E|$.
Luna.Modes.arbitrary — Methodarbitrary(kwargs...)Create an arbitrary mode, which takes its methods from given functions.
The functions given should have the same signature as defined Luna.Modes, except that the first argument (the AbstractMode) is omitted, e.g. for neff the function should be of the form n(ω; z) = ...
To define neff with functions for α and β, create the neff function using neff_from_αβ.
Luna.Modes.chkzkwarg — Methodchkzkwarg(func)Check that function accepts z keyword argument and add it if necessary.
Luna.Modes.dB_per_m — MethoddB_per_m(m::AbstractMode, ω; z=0.0)Calculate the attenuation in dB/m for the mode m at frequency ω and longitudinal position z.
Luna.Modes.delegated — Methoddelegated(mode, kwargs...)Create a delegated mode, which takes its methods from an existing mode except for those which are overwritten
Arguments:
mode::AbstractMode: The wrapped mode to which non-specified methods are delegatedkwargs: functions that override:neff,field,dimlimits,Aeff, orN.
The functions given should have the same signature as the mode methods, i.e. take an AbstractMode as their first argument, even if they do not do anything with it. This is to ensure that the delegated functions can access the data of the wrapped mode if necessary.
To override neff with functions for α and β, create the neff function using neff_from_αβ.
Luna.Modes.dimlimits — Functiondimlimits(m::AbstractMode; z=0.0)Maximum dimensional limits of validity for mode m at position z.
Luna.Modes.dispersion — Methoddispersion_func(m::AbstractMode, order; z=0.0)Calculate the dispersion of a given order at frequency ω.
Luna.Modes.dispersion_func — Methoddispersion_func(m::AbstractMode, order; z=0.0)Get a function βn(ω) which returns the dispersion of a given order at frequency ω.
Luna.Modes.field — Functionfield(m::AbstractMode, xs; z=0.0)Get the field components (Ex, Ey)at positionxs,z`
Luna.Modes.field — Methodfield(m::AbstractMode; z=0)Create function of coords that returns (xs) -> (Ex, Ey) for the mode m.
Luna.Modes.losslength — Methodlosslength(m::AbstractMode, ω; z=0.0)Calculate the losslength ($1/α$) for the mode m at frequency ω and longitudinal position z.
Luna.Modes.neff — Functionneff(m::AbstractMode, ω; z=0.0)Get the full complex refractive index of mode m at frequency ω and longitudinal position z.
Luna.Modes.neff_from_αβ — Methodneff_from_αβ(α, β)Create a closure converting the functions α(ω; z) and β(ω; z) into an effective index.
Luna.Modes.orthogonal — Methodorthogonal(mode1, mode2)Test whether the AbstractModes mode1 and mode2 are orthogonal to each other.
Luna.Modes.orthonormal — Methodorthonormal(modes)Test whether the modes form an orthonormal set.
Luna.Modes.overlap — Methodoverlap(m::AbstractMode, r, E; dim)Calculate mode overlap between radially symmetric field and radially symmetric mode.
Examples
julia> a = 100e-6;
julia> m = Capillary.MarcatiliMode(a, :He, 1.0);
julia> unm = approx_besselroots(0, 1)[end]
julia> r = collect(range(0, a, length=512));
julia> Er = besselj.(0, unm*r/a);
julia> η = Modes.overlap(m, r, Er; dim=1);
julia> abs2(η[1]) ≈ 1
trueLuna.Modes.overlap — Methodoverlap(m::AbstractMode, E)Calculate mode overlap between (analytic) 2D field E and mode m. The field function E(xs) should return the normalised cartesian vector components of the field (Ex, Ey) as an SVector as a function of polar coordinates xs = (r,θ). ```
Luna.Modes.overlap — Methodoverlap(mode1, mode2)Calculate the normalised overlap between two AbstractModes.
Luna.Modes.overlap — Methodoverlap(modes::ModeCollection, newgrid, oldgrid, r, Eωr)Decompose the spatio-spectral field Eωr, sampled on radial coordinate r and time-grid oldgrid, into the given modes and resample onto newgrid via cubic interpolation.
Luna.Modes.to_space! — Methodto_space!(Erω, Emω, xs, ts::ToSpace; z=0.0)Convert from modal fields to real space using provided ToSpace struct.
Arguments
Erω::Array{ComplexF64}: a dimension nω x npol array where the real space frequency domain field will be written toEmω::Array{ComplexF64}: a dimension nω x nmodes array containing the frequency domain modal fieldsxs:Tuple: the transverse coordinates,x,yfor cartesian,r,θfor polarts::ToSpace: the correspondingToSpacestructz::Real: the axial position
Luna.Modes.to_space — Methodto_space(Emω, xs, ms; components=:xy, z=0.0)Convert from modal fields to real space.
Arguments
Emω::Array{ComplexF64}: a dimension nω x nmodes array containing the frequency domain modal fieldsxs:Tuple: the transverse coordinates,x,yfor cartesian,r,θfor polarms::Tuple: a tuple of modescomponents::Symbol: which polarisation components to return: :x, :y, :xyz::Real: the axial position
Luna.Modes.to_space — Methodto_space(Emω, xs, ts::ToSpace; z=0.0)Convert from modal fields to real space using provided ToSpace struct.
Arguments
Emω::Array{ComplexF64}: a dimension nω x nmodes array containing the frequency domain modal fieldsxs:Tuple: the transverse coordinates,x,yfor cartesian,r,θfor polarts::ToSpace: the correspondingToSpacestructz::Real: the axial position
Luna.Modes.transmission — Methodtransmission(m::AbstractMode, ω, L)Calculate the power transmission after propagation through length L in the mode m for radiation at the frequency ω.
Luna.Modes.zdw — Methodzdw(m::AbstractMode, λ0; z=0.0, rtol=1e-4)Calculate the zero-dispersion wavelength (ZDW) of mode m with an initial guess of λ0.
This method is faster than the bounded version if the ZDW is known to be close to λ0.
Luna.Modes.zdw — Methodzdw(m::AbstractMode; λmin=100e-9, λmax=3000e-9, z=0.0)Calculate the zero-dispersion wavelength (ZDW) of mode m within the range ub to lb.
Luna.Modes.α — Methodα(m::AbstractMode, ω; z=0.0)Calculate the attenuation constant $α$ for the mode m at frequency ω and longitudinal position z.
Luna.Modes.β — Methodβ(m::AbstractMode, ω; z=0.0)Calculate the propagation constant $β$ for the mode m at frequency ω and longitudinal position z.
Luna.Modes.β_ret — Methodβ_ret(m::AbstractMode, ω; z=0, λ0)Calculate the propagation constant $β$ for mode m transformed into a frame which moves with the group and phase velocity of m at wavelength λ0.