I'm a student working on fiber optics, and want to use openEMS as a simulation tool. Although even a small piece of optical fiber is too large for FDTD method, it still makes sense when on other software is available. So thanks for your hard work!

Since the fundamental mode of a single mode fiber is HE11 (LP01) mode, a customized port is needed to excite the source. I tried to use AddWaveGuidePort function to set a customized port with the learning of AddCircWaveGuidePort. The Bessel function of the first kind (J_alpha) and the modified Bessel function of the second kind (K_alpha) will be used to calculate the electric and the magnetic field. However, seems the use of the Bessel function is different from Matlab code when I read the AddCircWaveGuidePort function. For example, in line 92 of AddCircWaveGuidePort.m, the magnetic field is:

I suppose "rho" is the radius, j0(...) is the Bessel function of the first kind of with order 0, jn(2, ...) is the Bessel function of the first kind with order 2, is this right? And how can I express the modified Bessel function of the second kind? I tried to use k0(...) but seems it is incorrect.func_Hr = [ num2str(-1/kc_draw,15) '*sin(' angle ')*0.5*(j0(' num2str(kc_draw,15) '*rho)-jn(2,' num2str(kc_draw,15) '*rho))'];

I'll be appreciate for your help, Thanks much!

Fengfeng