Sheptor / test-issue

0 stars 0 forks source link

test_issue #1

Open Sheptor opened 5 months ago

Sheptor commented 5 months ago

The problem of calculating the S-parameters of Magic tee and a rectangular waveguide

Introduction

Hello! I am engaged in research on the propagation of an electromagnetic wave in a segment of the magic tee waveguide with cross section 23x10mm^2. But in the simulation results, the sum of the squares of the s-parameters is not equal to 1 (figure 2). I tried to create a waveguide in different ways:

  1. Import from stl file;
  2. Creating waveguide metal walls using AddBox;
  3. Filling the simulation space with metal and adding a waveguide cavity using AddBox with epsilon=1 (figure 1).

Figure 1. Magic tee (metall hidden)

magic_tee_image

Figure 2. Magic tee (s-parameters)

magic_tee_s_params

Problem

To verify the results, a rectangular waveguide with a size of 23x10mm^2 was modeled. In the first case: the boundaries of the grid coincide with the section of the waveguide. in the second case, the border is shifted and metal is added to the place of free space (figures 5 - 8).

Question:

How does adding metal walls differ from setting boundary conditions ["PEC", "PEC", "PEC", "PEC", "PML_8", "PML_8"]?

Figгre 3. Empty waveguide

waveguide_filled_metal_and_air

Figure 4. Empty waveguide (s-parameters)

s_params_fill_air

Figure 5. Waveguide with thin metal walls (metal walls hidden)

Waveguide with thin metal walls (metal walls hidden)

Figure 6. Waveguide with thin metal walls (metal walls hidden) (s-parameters)

Waveguide with thin metal walls (metal walls hidden) (s-parameters)

Figure 7. The walls of the waveguide are larger than the cavity of the waveguide

large walls

Figure 8. The walls of the waveguide are larger than the cavity of the waveguide (s-parameters)

large walls (s-parameters)

Code

The simulation was carried out using both the python interface and the octave interface: https://github.com/Sheptor/test-issue

Sheptor commented 5 months ago

I agree that this applies to the discussion section, but due to inattention, this problem has been posted in this section. A few hours later, I noticed this and duplicated it in the discussion section https://github.com/thliebig/openEMS-Project/discussions/194. I conducted additional studies with an smoothed grid, the results of which I added to the discussion.

Sheptor commented 5 months ago

The simulation was performed with a smoothed grid near the waveguide (figures 7, 9) boundary. The result (figure 10) of modeling a rectangular waveguide demonstrates a decrease in reflection and a more similar appearance, as in the case when the walls of the waveguide are described by boundary conditions.

Figure 9. Smoothed mesh

smoothed_mesh

Figure 10. Simulation waveguide with smoothed mesh (s-parameters)

s_params_smooth_waveguide

The result of the magic tee simulation is still significantly different from the analytical one (figures 11, 12).

Figure 11. Magic tee with smoothed mesh

magic_tee_with_ports

Figure 12. Magic tee with smoothed mesh (s-parameters)

s_params_smooth_mesh_05_from_air

Code

Algorithms with a smoothed mesh: waveguide2.py and magic_tee2.py into https://github.com/Sheptor/test-issue

Sheptor commented 5 months ago

The problem was changing the arguments in the AddRectWaveGuidePort function for H-arm and E-arm. It was necessary to swap arguments a and b, as well as change mode from TE10 to TE01.

Python interface:

# from
ports.append(FDTD.AddRectWaveGuidePort(2, start, stop, 'y', a*unit, b*unit, "TE10"))
...
ports.append(FDTD.AddRectWaveGuidePort(3, start, stop, 'x', a*unit, b*unit, "TE10"))

# to
ports.append(FDTD.AddRectWaveGuidePort(2, start, stop, 'y', b*unit, a*unit, "TE01"))
...
ports.append(FDTD.AddRectWaveGuidePort(3, start, stop, 'x', b*unit, a*unit, "TE01"))

Octave interface:

% from
[CSX, port{3}] = AddRectWaveGuidePort( CSX, 0, 3, start, stop, 'y', a*unit, b*unit, 'TE10', ext_port(3));
...
[CSX, port{4}] = AddRectWaveGuidePort( CSX, 0, 4, start, stop, 'x', a*unit, b*unit, 'TE10', ext_port(4));

% to
[CSX, port{3}] = AddRectWaveGuidePort( CSX, 0, 3, start, stop, 'y', b*unit, a*unit, 'TE01', ext_port(3));
...
[CSX, port{4}] = AddRectWaveGuidePort( CSX, 0, 4, start, stop, 'x', b*unit, a*unit, 'TE01', ext_port(4));

Figures 13 and 14 show the results of simulations using python and octave interfaces.

Figure 13. The result of simulation using the python interface

Figure_13

Figure 14. The result of simulation using the octave interface

S-params

The simulation results using the octave interface are consistent with the results [1], but the implementation of the program with the python interface incorrectly calculates port 3.

Python and octane scripts added to repository with names magic_tee3.py and magic_tee3.m respectively. https://github.com/Sheptor/test-issue

References

[1] Sieverding, Thomas, and Fritz Arndt. "Modal analysis of the magic tree." IEEE microwave and guided wave letters 3.5 (1993): 150-152. https://ieeexplore.ieee.org/abstract/document/217212