The URI of TUHH Docker Registry changed from "docker.rz.tu-harburg.de:5000" to "docker.rz.tu-harburg.de". Please update your gitlab-ci.yml files if you use images from this registry.

Commit 67dde742 authored by Hendrik Preuß's avatar Hendrik Preuß

Added an app to find the influence of a glue below the substrate

parent 593811a7
......@@ -8,4 +8,5 @@ These are apps for the Metric mode solver from: https://metric.computational-pho
- p_air: find the medium-specific absorption factors p for slab modes, such that \alpha = p1*\alpha1 + p2*\alpha2 +...
- p_air: find p for the different materials in a three layered slab waveguide
- max_p_air: searches for the core thickness, which maximizes p of the cladding in a three layered salb waveguide
- max_p_air: searches for the core thickness, which maximizes p of the cladding in a three layered slab waveguide
- p_4l: estimate the influence of a glue below the substrate for different substrate thicknesses
#!/bin/bash
cd ../
cp MyApps/$1/$2.cpp s.cpp
make
cp s bin/$2
/*
* METRIC-Application:
* Guided wave propagation along a slab waveguide
*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include"metric.h"
#include<vector>
#include<cstring>
#include<cstdlib>
#include<algorithm>
// #define Pol TM // light polarization
// #define Wsub 1.70 // substrate refractive index
// #define Wcore 3.43 // core refractive index
// #define Wsuper 1.0 // superstrate refractive index
// #define Wdiff 0.01 // substrate refractive index
// #define WPwstart 0.1 // core height /mum
// #define WPwstop 1.0 // core height /mum
// #define WPwstep 0.1 // core height /mum
// #define Wavel 3.3 // vacuum wavelength /mum
#define quiet true
enum Section {Substrate, Core, Superstrate, Glue};
/* ------------------------------------------------------------------------ */
/* a slab waveguide */
Waveguide wgdef(double n_glue, double n_substrate,
double n_core, double n_superstrate,
double height_substrate, double height_core,
double wavelength) {
Waveguide wg(2);
wg.hx(0) = -height_substrate;
wg.hx(1) = 0.0;
wg.hx(2) = height_core;
wg.n(0) = n_glue;
wg.n(1) = n_substrate;
wg.n(2) = n_core;
wg.n(3) = n_superstrate;
wg.lambda = wavelength;
return wg;
}
double f_p (double wavelength,
Polarization pol,
double n_glue,
double n_substrate,
double n_core,
double n_superstrate,
double n_diff,
double height_substrate,
double height_core,
Section sec) {
double neff[2];
int found_modes = 0;
for (int i = 0; i < 2; i++) {
Waveguide wg;
if (sec == Glue) {
wg = wgdef(n_glue + i * n_diff,
n_substrate,
n_core,
n_superstrate,
height_substrate,
height_core,
wavelength);
}
else if (sec == Substrate) {
wg = wgdef(n_glue,
n_substrate + i * n_diff,
n_core,
n_superstrate,
height_substrate,
height_core,
wavelength);
}
else if (sec == Core) {
wg = wgdef(n_glue,
n_substrate,
n_core + i * n_diff,
n_superstrate,
height_substrate,
height_core,
wavelength);
}
else if (sec == Superstrate) {
wg = wgdef(n_glue,
n_substrate,
n_core,
n_superstrate + i * n_diff,
height_substrate,
height_core,
wavelength);
}
// find the guided modes
ModeArray ma;
modeanalysis(wg, pol, ma, 1);
if (ma.num >= 1) {
quiet ? 0 : fprintf(stderr, "neff = %g\n", ma(0).neff);
neff[i] = ma(0).neff;
found_modes ++;
}
}
if (found_modes == 2) {
double p = (neff[1] - neff[0]) / n_diff;
quiet ? 0 : fprintf(stderr, "p = %g\n", p);
return p;
}
else {
return -1;
}
}
int main(int argc, char *argv[]) {
if (strcmp(argv[1], "-h") == 0) {
printf("\nUsage: (Wavelength and slab_height are in microns.)\n\n"
"p_air polarization wavelength n_glue n_substrate n_core n_superstrate heigth_core\n\n");
return 0;
}
else if (argc != 8) {
printf("\nNot the right amount of arguments.\n\n");
return 1;
}
Polarization pol;
if (strcmp(argv[1], "TE") == 0) {
pol = TE;
}
else if (strcmp(argv[1], "TM") == 0) {
pol = TM;
}
else {
return 1;
}
double wavelength = atof(argv[2]);
double n_glue = atof(argv[3]);
double n_substrate = atof(argv[4]);
double n_core = atof(argv[5]);
double n_superstrate = atof(argv[6]);
double height_core = atof(argv[7]);
double n_diff = 0.0001;
double height_sub_min = height_core;
double height_sub_max = 10 * height_core;
double steps = 1000;
if (!quiet) {
fprintf(stderr, "\nWaveguide:\n");
fprintf(stderr, "----------\n");
fprintf(stderr, "lambda = %g um\n", wavelength);
fprintf(stderr, "n_glue = %g\n", n_glue);
fprintf(stderr, "n_substrate = %g\n", n_substrate);
fprintf(stderr, "n_core = %g\n", n_core);
fprintf(stderr, "n_superstrate = %g\n", n_superstrate);
fprintf(stderr, "core height =%g um\n", height_core);
if (pol == TM) {
fprintf(stderr, "polarization = TM\n\n");
}
else if (pol == TE) {
fprintf(stderr, "polarization = TE\n\n");
}
}
printf("# substrate_height p_glue p_substrate p_core p_cladding\n");
for (int i = 0; i < steps; i++) {
double height_substrate = height_sub_min + i * (height_sub_max - height_sub_min) / (steps - 1);
quiet ? 0 : fprintf(stderr, "height_substrate = %g\n", height_substrate);
double p_glue = f_p(wavelength, pol,
n_glue,
n_substrate,
n_core,
n_superstrate,
n_diff,
height_substrate,
height_core,
Glue);
double p_substrate = f_p(wavelength, pol,
n_glue,
n_substrate,
n_core,
n_superstrate,
n_diff,
height_substrate,
height_core,
Substrate);
double p_core = f_p(wavelength, pol,
n_glue,
n_substrate,
n_core,
n_superstrate,
n_diff,
height_substrate,
height_core,
Core);
double p_cladding = f_p(wavelength, pol,
n_glue,
n_substrate,
n_core,
n_superstrate,
n_diff,
height_substrate,
height_core,
Superstrate);
printf("%g ", height_substrate);
printf("%g ", p_glue);
printf("%g ", p_substrate);
printf("%g ", p_core);
printf("%g\n", p_cladding);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment