#ifndef TFLN_H #define TFLN_H /* * METRIC --- Mode expansion modeling in integrated optics / photonics * http://metric.computational-photonics.eu/ */ /* * tfln.h * Three layer TFLN slab waveguides, anisotropic core, * X- and Z-cut configurations with varying propagation direction */ enum TflnCut {Xcut, Zcut}; /* TFLN slab waveguide */ class TflnWaveguide { public: // positions of the dielectric interfaces Dvector hx; // get interval index corresponding to position x int layeridx(double x) const; // get layer boundaries corresponding to index l Interval layer(int l) const; // get layer boundaries corresponding to position x Interval layer(double x) const; // vacuum wavelength double lambda; // slab type TflnCut type; // cover layer, refractive index double nc; // substrate layer, refractive index double ns; // TFLN core layer, ordinary refractive index double no; // TFLN core layer, extraordinary refractive index double ne; // TFLN core layer, angle between propagation direction and crystal Y-axis [degrees] double theta; // core permittivity, elements double epsx; double epsy; double epsz; double delta; // initialize TflnWaveguide(); TflnWaveguide(TflnCut c, double d, double tns, double tno, double tne, double tnc, double wavel); // adjust permittivity for propagation at angle theta [deg] versus crystal Y-axis void turnto(double theta); // an isotropic waveguide with the same layering Waveguide toisotropic() const; }; /* a mode of the TFLN slab */ class TflnMode { friend class TflnModeArray; public: // initialize TflnMode(); TflnMode(const TflnWaveguide& g); // the corresponding waveguide TflnWaveguide wg; // vacuum wavenumber double k0; // 1/(omega mu0) double invommu0; // 1/(omega epsilon0) double invomep0; // 1/sqrt(mu0) double invsqrtmu0; // 1/sqrt(epsilon0) double invsqrtep0; // propagation constant double beta; // square of the propagation constant double betaq; // effective mode index double neff; // internal field representation, amplitudes Complex FAa1; Complex FAa2; Complex FAa3; Complex FAa4; Complex FAes; Complex FAhs; Complex FAec; Complex FAhc; // core layer, vertical eigenvectors Complex CVe1, CVe2, CVe3, CVe4; Complex CVh1, CVh2, CVh3, CVh4; // vertical wavenumbers double kappas; double kappac; Complex kappa1, kappa2, kappa3, kappa4; // interval, where the principal field components are at larger than // TFLN_SLAMS_DOMLVL times their levels at the core boundaries Interval domain; // polariztion ratio, 1: pure TE, 0: pure TM double polratio; // mode profile, maxima of absolute electric and magnetic fields double maxE; double maxH; // principal field components Complex pfe(double x) const; Complex pfh(double x) const; // derivatives of the principal field components Complex pfde(double x) const; Complex pfdh(double x) const; // the mode profile, // values of component cp: EX - HZ at transverse coordinate x Complex field(Fcomp cp, double x) const; // adjust global phase of the mode, such that, // at the point in the core with maximum electric field strength, // the largest transverse electric field component becomes real void adjustphase(); // integrate a product of field components cp1 (cc) and cp2 // over the interval [x0, x1] // based on: Numerical Recipes in C --- The Art of Scientific Computing // Press, Teukolsky, Vetterling, Flannery, Cambridge University Press, 1994 Complex integral(Fcomp cp1, Fcomp cp2, double x0, double x1) const; // ... over the domain of the mode Complex integral(Fcomp cp1, Fcomp cp2) const; // longitudinal component of the Poyntingvector, // integrated over the entire cross section // ... the TE-associated part double tepower() const; // ... the TM-associated part double tmpower() const; // full power double power() const; // normalize mode to power() == 1 // set polarizatio ratio & electric and magnetic field maxima void normalize(); // field profile -> MATLAB .m file // cp: EX - HZ // foa: MOD, ORG, SQR, REP, IMP // disp: output window on the x axis // np: number of output points // ext0, ext1: filename id characters // pltype: 'L': geometry information & plot commands (default) // 'V': field, mesh, and plot comand, // to be included into *L.m void plot(Fcomp cp, Afo foa, Interval disp, int np, char ext0, char ext1, char pltype) const; // vectorial field profile, all components void plot(Interval disp, int np, char ext0, char ext1, char ext2, char ext3) const; /* - mode solver routines ---------------------------------- */ // transverse resonance evaluation double travres(double bq, bool fin); // final mode: TR evaluation, residuum Complex residuum; // check mode: interface conditions void check(); }; /* integrate a product of field components cp1 (cc) and cp2 related to modes m1 and m2 over the interval [x0, x1] */ Complex overlap(TflnMode m1, Fcomp cp1, TflnMode m2, Fcomp cp2, double x0, double x1); /* modal orthogonality: overlap of two TflnModes */ Complex overlap(TflnMode m1, TflnMode m2); /* an array of TFLN modes */ class TflnModeArray { public: // number of modes included int num; // initialize TflnModeArray(); // destroy ~TflnModeArray(); // copy constructor TflnModeArray(const TflnModeArray& ma); // assignment TflnModeArray& operator=(const TflnModeArray& ma); // free allocated memory void clear(); // subscripting inline TflnMode& operator() (int i) { return mvec[i]; } inline TflnMode operator() (int i) const { return mvec[i]; } // add a mode void add(TflnMode m); // delete a mode entry void remove(int i); // add an entire TflnModeArray nma, nma is cleared ! void merge(TflnModeArray& ma); // sort the array by squared propagation constants, highest first void sort(); private: TflnMode *mvec; }; /* mode analysis and chracterization: computational parameters */ extern double TFLN_SLAMS_BQSEP; extern int TFLN_SLAMS_STEPS; extern double TFLN_SLAMS_BQTOL; extern double TFLN_SLAMS_TRERROR; extern double TFLN_SLAMS_MINKAPPA; extern double TFLN_SLAMS_DOMLVL; extern double TFLN_SLAMS_NINTSPWL; extern double TFLN_TR_KROOT; /* mode analysis of the TFLN waveguide */ int modeanalysis(TflnWaveguide wg, TflnModeArray& ma, int quiet); #endif // TFLN_H