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 5e6a68b5 authored by Hendrik Preuß's avatar Hendrik Preuß

added a p_air app for the DFG-Antrag

parent 266f0b9f
......@@ -12,16 +12,6 @@
#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};
......
/*
* 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>
// Switch verbose output
#define quiet true
/**
Defines a layed stack of slabs, to defiene a slab waveguide.
The constructor of the wg calss takes the number of inner layers.
Args:
layers (int): the number of inner layers.
layer (int): The layer to which the refractive indes change is applied.
n_diff (double): Refractive index perturbation.
Notes:
Length(wg.hx) = layers + 1 <- These are the positions of the material
interfaces.
Length(wg.n) = layers + 2 <- These are the material refractive indeces,
including the ideces of the materials above and below the inner layers.
All distances are in micro meters.
*/
Waveguide wgdef(int layers, int layer, double n_diff) {
Waveguide wg(layers);
wg.hx(0) = 0;
wg.hx(1) = 0.140;
wg.n(0) = 1.38;
wg.n(1) = 3.43;
wg.n(2) = 1;
wg.n(layer) = wg.n(layer) + n_diff;
wg.lambda = 3.3;
return wg;
}
/**
Returns an array of the medium-specific refractive index sensitivites.
*/
void f_p (double p[], int layers, Polarization pol, double n_diff) {
double neff1;
double neff2[layers+2];
Waveguide wg;
ModeArray modes;
wg = wgdef(layers, 0, 0);
modeanalysis(wg, pol, modes, 1);
quiet ? 0 : printf("neff = %g\n", modes(0).neff);
neff1 = modes(0).neff;
printf("%-11.5g", neff1);
for (int i = 0; i < layers + 2; i++) {
wg = wgdef(layers, i, n_diff);
modeanalysis(wg, pol, modes, 1);
quiet ? 0 : fprintf(stderr, "neff = %g\n", modes(0).neff);
neff2[i] = modes(0).neff;
p[i] = (neff2[i] - neff1) / n_diff;
quiet ? 0 : printf("p = %g\n", p[i]);
}
}
int main(int argc, char *argv[]) {
// Number of layers excluding the upper and lower materials
int layers = 1;
// refractive index perturbation
double n_diff = 0.01;
// light polarization (TE or TM)
Polarization pol = TE;
// just for printing
Waveguide wg = wgdef(layers, 0 ,0);
printf("# Wavelength: %g\n", wg.lambda);
if (pol == TE) {
printf("# Polarization: TE\n");
} else if (pol == TM) {
printf("# Polarization: TM\n");
}
printf("# Refractive index perturbation: %g\n", n_diff);
printf("# Layer thicknesses: ");
for(int i = 0; i < layers; i++) {
printf("%-9g", wg.hx(i+1)-wg.hx(i));
}
printf("\n# Refractice indeces: ");
for(int i = 0; i < layers + 2; i++) {
printf("%-9g", wg.n(i));
}
// layer names as used in wgdef (length = layers + 2)
printf("\n#\n# %-11s %-11s %-11s %-11s\n", // %-11s\n",
"n_eff",
"Substrate",
"Slab",
// "SiO2",
"Air");
// output array for the sensitivies
double p[layers + 2];
// For a sweep the following section can be put into a loop.
// The function f_p needs to be adapted to include the sweep parameter.
// calcualte the refractive index sensitivity
f_p(p, layers, pol, n_diff);
// print the sensitivites
for(int i = 0; i < layers + 2; i++) {
printf("%-11.5g ", p[i]);
}
printf("\n");
}
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