# Analytical Solution: Infinite Magnetic Line-source

A comparison of the 2D “analytic” solution of an Infinite Magnetic Line-source sine wave (with a carrier frequency of 5 GHz) to the output of the 2D FDTD Yee simulation.

## Analytical Solution

The analytical solution to the Infinite Magnetic Line Source problem is from Balanis, Advanced Engineering Electromagnetics, pp.570-574 and is: Eqn:6.1

where, magnetic line source constant current  angular frequency electric permittivity (farads/meter) magnetic permeability (Henrys/meter) distance from source Hankel function of the second kind of order 0.

### Scilab Code

The algorithm was run using scilab (an open source numerical computation software package, similar to Matlab).

Scilab code:

```
//
//  Code for infinite magnetic line source
//  usage: scilab
//    getf hello.sci
//    hello
//
function hello

mu = 1.256637061e-06;
epsilon = 8.854187818e-12;
omega = 3.141592654e+10;
dx = 0.003;
current = 7.0;

bta = omega * sqrt( mu * epsilon );
temp = bta * bta / (4.0 * omega * mu);
phaseadj = 2.0 * dx * bta;

fd = mopen( 'foo1.txt' , 'w');
for istep = 1.0 : 1.0 : 500
x = istep * dx;
j = besselj(0,x);
y = bessely(0,x);
h = besselh(0,2, bta * x + phaseadj);  // hankel function 2nd kind 0th order
hz = -current * temp * h;
//    mfprintf(fd, 'i: %f x: %f  j0: %f   y0: %f   h0: %f hz:%fn', istep,x,j,y,h,hz);
mfprintf(fd, '%d %fn', istep,hz);
end
mclose(fd);

endfunction
```

## Results

A 2d FDTD (TE) simulation was run with a grid area of 1000 x 1000.

The source excitation was placed int the center (x=500,y=500) and was an Infinite Magnetic Line-source sine wave with a carrier frequency of 5 GHz.

The simulation was run for 5000 time steps (to allow the simulation to reach steady state) and then a “snapshot” of the values from x = 500 to 1000 was recorded.

The results of the FDTD simulation are compared with the analytical solution: As can be seen, the FDTD simulation matches the analytical solution.