Development of the Virtual Lab Module for Understanding the Concepts of Electric and Magnetic Field Patterns in Rectangular Waveguides and Cavities

A LabVIEW based general purposed module to understand and visualize the electromagnetic field patterns inside commonly used microwave devices is developed. The module provides both the electric and magnetic field patterns for any arbitrary mode configuration inside the rectangular waveguide and the cavity, which are the microwave devices mostly being taught at undergraduate levels in the electrical engineering. The developed module helps the user in gaining a better and deeper understanding of the electric and magnetic field patterns and modes inside the guiding and closed structures.


I. INTRODUCTION
The modern day tools of today's Electrical Engineer such as the wireless communications, RF and Microwave Circuits, etc. require engineering students to have deeper understanding of the concepts related to the electromagnetic theory and microwave techniques. But, the courses in these areas are today becoming less interesting to students of electrical engineering. The reason behind the lack of interest stems from the fact that these courses are quite involved, and require deeper understanding of advanced mathematical concepts. The reason for the lesser interest shown by students is probably also due to the conventional way these courses are being taught in undergraduate classes. Now, with the advent of modern visualization tools, these courses can be made quite interesting and appealing to students, which would go a long way in popularizing the electromagnetics and microwaves education to young undergraduates. The development of Virtual RF and Microwave Laboratory at the Indian Institute of Technology, Kanpur is the first step in this direction, where the main aim is to help the students in understanding the basic concepts of electromagnetic field theory and microwave engineering using a number of developed visualization modules (http://www.iitk.ac.in/mimt_lab/vlab/index.php?pg=wave guide/aim&usr=&enc=). The developed virtual lab is aimed at assisting the student through simulation and virtual experiments using a number of microwave devices.
The electromagnetic field theory and microwave engineering usually deal with the high frequency analysis, where the dimensions of the object or wire are comparable to the operating wavelength. The electric and magnetic field patterns in various structures at microwave frequencies become quite relevant in order to predict the behavior of various devices at these frequencies, and hence studying the electric and magnetic field patterns, also known as modes, becomes important. These fields are vector quantities, and are usually analyzed using advanced calculus concepts. In the developed module, the electric and magnetic fields have been represented in vector form with arrows indicating both magnitude and direction, so that the user can make a one to one correspondence with the fields and their equations.
The developed module is also a supplement to lab work, which is obviously quite complicated for electromagnetic field quantities. The proposed interactive simulations seem to be obviously more interesting compared to both the classroom and the lab work, although they are no substitute for real experiments. The flexibility in varying different parameters and viewing the field patterns gives the user enough knowledge to extend his understanding to other microwave devices and more complicated structures. Finally, these tools can be remotely accessed without requiring any complicated hardware at the user end, and hence we can target the much wider section of the society in minimum time frame requiring least resources.
The main aim of this work is to develop visualizations simulation tools for understanding various concepts of electromagnetics and microwave engineering by students at remote places. It may be mentioned here that the engineering education in India is increasing at a very fast rate, and it is continuously becoming quite difficult for all these new engineering colleges to have expertise in specialized areas such as the electromagnetic theory and microwave engineering. The development of the proposed simulation tools is mainly targeted at these students and groups, who can access and perform the virtual experiments from their remote places.
It may be noted that the significance of graphical aid tools and the virtual lab development in imparting the engineering education has recently been reported by few groups such as [1]. It has also been reported that the LabVIEW is one of the most versatile graphical tools for understanding some concepts in the field of electrical engineering [2]. The virtual lab concept has recently been employed in the field of microwaves and Antennas, where the students can remotely access the radio telescope using custom made receivers [3]. However, to the best of our knowledge, the visualization tools or the virtual experiments have till now not been developed to visualize the electromagnetic field patterns inside various structures such as rectangular waveguides and cavities at microwave frequencies. The understanding of these field patterns, and to know their significance, is obviously the first and the foremost step in order to gain deep knowledge about the operation of various RF and microwave structures. In the present work, a general purpose simulation module using LabVIEW is developed to visualize and understand various electromagnetic field patterns inside a rectangular waveguide and the microwave cavity resonator. The overall paper is organized as follows. First of all, the basic theoretical concepts about the electromagnetics, microwaves, rectangular waveguides, cavity resonators etc., which are required for the development of proposed module, are briefly discussed in section II. In section III, a brief introduction of the virtual simulation module is presented. The main theme of the presented work, which is the development of appropriate virtual lab modules, is described in detail in sections IV and V. Finally, some concluding remarks are provided.

A. Electromagnetic fields and the Rectangular
Waveguide Electromagnetic fields propagate in a waveguide forming electric and magnetic field patterns. The waveguide imposes boundary conditions on the wave forming TE (Transverse Electric) and TM (Transverse Magnetic) mode patterns in the waveguide. These electric and magnetic fields patterns vary with both time and space. The propagation of the electromagnetic wave inside the waveguide is governed by the continuous exchange of energy between the electric and magnetic fields. The curl operation on electric field produces a time varying magnetic field, and in the same way curl of the magnetic field produces time varying electric field sustaining the energy required for propagation.
In free space and the conventional two conductor lines, usually the most basic field pattern, widely known as TEM (Transverse-Electric-Magnetic) mode, prevails where both the electric and magnetic fields are perpendicular to the direction of propagation. However, the waveguides, which are basically hollow metal pipes of either rectangular or circular cross-section, do not support the basic TEM mode because of the presence of only one conductor and hence the fields are arranged in either TE (Transverse Electric) or TM (Transverse Magnetic) modes. These TE(TM) modes have zero electric (magnetic) fields in the direction of propagation.
The waveguides are quite important class of devices for electromagnetic energy transfer at microwave frequencies specifically for high power applications. The electric and magnetic field patterns are quite well behaved in a waveguide, and hence their detailed study provides insight into the wide variety of patterns formed by guided electromagnetic waves. The energy in this case is conveyed by means of transverse components of the electric and magnetic fields governed by Maxwell's equations along with the appropriate boundary conditions. Both simple and higher order field patterns of the rectangular waveguides are analyzed here using the simple Cartesian co-ordinate system. However, the overall procedure can be well extended to the analysis of field arrangements in circular waveguides. As the paper deals with the field patterns of guided electromagnetic waves, a brief summary of the deduction of the electromagnetic field pattern beginning from the preliminary wave equation follows. The four Maxwell's equations for electromagnetic waves in their differential form have gradient and curl functions, which lead to the wave equation where A stands for either electric or magnetic field [4]. mode. Other higher order field modes can be formed by the combination of different integer values 'm' and 'n', with each of them pertaining to their own cut off frequency and a unique field pattern. The rectangular waveguide is one of the most basic structures being taught at the undergraduate level in the electromagnetics course, and the TE 10 mode is the commonly used mode in rectangular waveguides. An understanding of modes and field patterns in waveguides is, therefore, fundamental and is a prerequisite for the analysis of more advanced components in the field of RF and Microwave Engineering.

B. Rectangular Waveguide Resonant Cavities
The resonant cavity is an energy storage device and is capable of maintaining oscillations of selective frequencies. A rectangular(circular) waveguide resonator is formed by shorting the rectangular(circular) waveguide at its open ends as shown in Fig. 2, thus forming a confined box and delivering electromagnetic energy into the cavity using suitable excitation methods.
In a resonant cavity, there is continuous exchange between the electric and magnetic energies of the wave confined inside the cavity similar to the LC parallel resonant circuit, where the inductors and capacitors are present. Hence, the waveguide resonant cavity at high frequencies can also be represented by an equivalent LC resonant circuit with distributed inductance and capacitance [4]. The capacitance and the inductance in the above circuit select the frequency of resonance.
The cavities satisfy the Laplace's equations in a similar way as waveguides, and hence have eigen values which form their characteristic equations similar to the rectangular waveguides. These eigen values form the fundamental mode frequencies or the resonant frequencies of the cavity, which in turn depend on the dimensions of the cavity box as given by (5), where 'm', 'n' and 'p' give the discrete eigen values representing different mode patterns in the cavity.

A. Measurement of Dielectric Constant using Cavity Perturbation Method in Cavity Resonators
The dielectric properties of materials can be measured using the rectangular waveguide cavity by perturbation technique, where the test sample is inserted into the designed cavity as shown in Fig. 3 in order to find the change in the quality factor and the resonance frequency. The resonant frequency of the cavity, which depends on its electrical and physical parameters, changes when the sample is inserted in the cavity. Likewise, the quality factor, being the ratio of the stored energy to the energy dissipated in the cavity, mainly depends on the losses present inside the cavity. Hence, the change in the quality factor of the cavity after insertion of the sample mainly provides an idea about the losses present inside the sample, with its value decreasing for lossy samples.
The mode preferred in this experiment is the TE 10p mode with p being odd, where the odd value of p ensures that the electric field is maximum at the position where the sample has been inserted, which is advantageous to get maximum perturbation for dielectric samples. The iris  [5] coupling is used on either sides of the end plate to efficiently excite the particular TE 10p mode. The real and imaginary parts of the complex permittivity are calculated using the formulas given below [5]: where, f s :Resonant frequency of the cavity loaded with the sample (Hz) f c :Resonant frequency of the empty cavity (Hz) V c :Volume of the empty cavity V s :Volume of the cavity loaded with sample Q c :Quality factor of the empty cavity Q s :Quality factor of the loaded cavity.
The real part of the permittivity is related to the energy storage, while the imaginary part usually provides idea about the losses present in the material.
It may be mentioned here that similar to the procedure described above, a rectangular waveguide cavity can be designed to measure the permeability of a material, where the mode selection should be in such a way that the test specimen is inserted at the position of maximum magnetic field.

A. RF and Microwave Virtual lab at Indian Institute of Technology-Kanpur
The RF and microwave virtual lab at Indian Institute of Technology Kanpur is a distance learning lab where the simulations and experiments most basic to undergraduate engineering students in the field of RF, Microwaves and electromagnetics are under development as depicted in This initiative aims at explaining the basic theoretical and experimental aspects of RF and Microwave Engineering to students in a non-conventional way using virtual simulation tools. The developed modules in the framework of this program usually employ the transmission lines, and some basic RF components along with the appropriate mathematical tools. The present paper mainly deals with the study of field patterns of various modes in waveguides, and measurement of dielectric properties using the rectangular cavity, which are listed on the web site of our Virtual Lab site.

A. National Instruments LabVIEW
The LabVIEW [6] is an ideal tool to develop user friendly simulation modules for various science and engineering applications. It has two main interfacing windows, the front panel and the block diagram. The front panel is where user accessible controls and display panels are designed for input and output data viewing. The block diagram on the other hand is used to create the arithmetic and logical steps in the program flow utilizing the powerful built in functions. The LabVIEW built in function are available in the form of pallets, which form the basic building for higher level programming. The pallets in the front panel are wired within the block diagram to complete the data flow from input front panel via block diagram back to the output to be viewed at the front panel again. The LabVIEW runtime engine available from the NI website is free of cost and can be used to run the VI files which are in executable format [6]. In the present work, it is always ensured that the exe file of the module is developed for each case, which can be executed using the LabVIEW runtime engine.

A. The module to generate Electric and Magnetic Fields in the Rectangular Waveguide
The program flow for the VI, which generates the electric and magnetic field patterns for a mode selected by the user, is shown in Fig.5. The program flow has three main steps as shown in this figure in order to generate the appropriate field patterns for the particular mode The user interface for viewing the field patterns inside the rectangular waveguide is shown in Fig. 6, where various annotations are as follows: A. Select TE/TM B. Select Electric/Magnetic Field C. Enter mode number m and n D. Field pattern in the xy plane on picture box1 E. Field pattern in the xz plane on picture box 2 F. Field pattern in the yz plane on picture box 3 Here x is along the width, y is along the height and z is the direction of propagation of the wave. By keeping any two of the three variables constant from A, B and C, the variation with respect to the third variable can be studied.

B. Brief description of the developed module by considering the field patterns of the TE10 mode
The electric field pattern of the dominant TE 10 mode along the cross-section of the rectangular waveguide as observed in the developed LabVIEW module is shown in Fig. 7. The field lines appearing in Fig. 7 can be understood using the following guidelines: I. The strength and the direction of the field w.r.t. position along the xy plane is represented by arrows, the higher the electric field magnitude the more prominent the arrow size. In Fig 7, the electric field strength is maximum at the center and goes to zero along the boundary. II.
The continuity condition at the boundary y=0 and y=b of the conductor waveguide shows the normal component of the field strength along the y axes. III.
The tangential electric field goes to zero at x=0 and x=a, which is the boundary of the conductor waveguide representing side walls. IV.
The mode pattern of the 10 TE mode along the xy plane shows that the electric field exists only in negative y direction and there is one half wavelength variation along the x axis, while the half wavelength variation along the y axis is zero; For n=0 at time t=0 the only nonzero component of the electric field is the y component, which is given by: [4] (8) For xy plane, the electric field is evaluated for z=π/2β. Hence the expression for the nonzero electric field component can be modified as: . (9) The 'sine' variation along the x axis in Fig. 7 is highlighted by drawing a sine curve (yellow in color). This variation shows that at any constant 'y' position, the magnitude of the field starts increasing from zero and reaches its maximum position at centre (x=a/2) as indicated by the red color. Afterwards, the field strength starts diminishing (as seen by the decrease in the arrow size) as we move away from the center, and finally the electric field again becomes zero for x=a.
The electric field pattern along the yz plane at x=a/2 is shown in Fig. 8. It can be observed from Fig. 8 that the direction of the electric field arrow for TE 10 mode is along the y axis in the yz plane. Also, n=0 implies that there is no variation of the electric field along y-direction. It is also to be noted that the field density is higher in the vicinity of z=π/2β and z=3π/2β as indicated by the red color and the field strength diminishes (as seen by the decrease in the arrow size) as we move towards z=0, z=π/β and z=2π/β, where they finally become zero. These kinds of behavior of the field lines can be understood from the expression of electric field. For the yz plane, the electric field is evaluated for x=a/2, and the expression is given by: . (10) Thus the field exists in -y direction for z<π/β and in +y direction for z> π/β. This field is maximum at z=π/2β, 3π/2β, and it becomes zero at z=0 , z= π/β and z= 2π/β. The electric field pattern for the TE 10 mode along xz plane is shown in Fig. 9. The dot pattern in this figure corresponding to the xz plane shows that the electric field pattern is perpendicular to this plane. The strength of the field is higher near x=a/2 and z= π/2β (as indicated by the red color) and field strength diminishes as we move towards z=0, z= π/β and z= 2π/β along the z direction, and towards x=0 and x=a along the x direction.
The magnetic field pattern for the TE 10 mode along the three planes is shown in Fig. 10. It can be observed from this figure that the magnetic field lies along the x axis in xy plane and along z axis in yz plane.
The magnetic field has only x and z components, and it has a circular pattern in the xz plane as shown by the closed circular arrows.

C. Brief description of the developed module by considering the field patterns of the TE 11 mode
The electric field pattern of dominant TE 11 mode along the cross-section of the rectangular waveguide as observed in the developed LabVIEW module is shown in Fig. 11. Figure 11. The arrow electric field pattern for TE 11 mode in the xy plane at constant z value Following points should be noted in order to understand the arrow electric field pattern of the higher order mode shown for TE 11 mode in this section: I. It can be seen from Fig. 11 that the field lines lie in the xy plane. In the vicinity of x=0, the field lines are mostly along +x direction as indicated by the arrows pointing towards right in direction of positive x axis. This field is maximum at y=b/2 (as indicated by the red color) and diminishes as we move towards y=0 and y=b (as indicated by decreasing arrow sizes). In the vicinity of x=a/2, the field is along the -y direction for y<b/2 indicated by arrows pointing downwards, and it is along the +y direction for y>b/2 indicated by arrows pointing upwards.
The expression of the electric field in xy plane at z=π/2β, for m=1 & n=1is given by [4]: (11) From the field expressions, it can be seen that the electric field has only y component at y=0, and its value is higher in the vicinity of x=a/2. Similarly, the field has only E x component at x=0, and its strength is higher in the vicinity of y=b/2. These findings match with the plot shown in Fig. 11. Figure 12. The electric field pattern for TE 11 mode in the xz and yz planes II. Fig.12. shows the electric field pattern for the TE 11 mode in yz and xz planes. The dot pattern in these two planes indicates that the electric field is perpendicular to both planes. The field strength in the xz plane is higher near x=a/2, while in the yz plane it is maximum at y=b/2. III. The tangential electric field is zero at the boundaries as indicated by absence of any field near the boundaries of the xz and yz planes in Fig.12. IV. The generated magnetic field pattern for the TE 11 mode is shown in Fig.13. It can be seen that the field follows circular loop patterns in the xz and yz planes. The field pattern in the 3 planes indicates presence of all three components of the magnetic field for this mode.
It may be noted here that although explanations in this section are mostly related to the TE 11 mode, but the similar concept can be used to understand the field patterns of any higher order mode having more than one nonzero electric and magnetic field components.

D. Understanding the field pattern for any Arbitrary Higher Order Mode
The electric field pattern of the dominant mode is quite easy to plot and visualize because of the presence of only one component as explained in section IV-B. However, the plot of the field pattern for any higher order mode is not very straight forward due to the presence of more than one electric/magnetic field components as seen in section IV-C. The aim of this section is to explain in detail the procedure adopted in the developed module to obtain the field pattern for any arbitrary higher order mode.
The complete field pattern for any higher order mode in the developed module is obtained by linear superposition of the field patterns in different directions. For example, the field pattern along the xy plane for any arbitrary mode is obtained by first computing the individual 'x' and 'y' components of the field, and then performing vector addition of these components. The overall process of formation of these field patterns in our module is explained here by considering a typical example of the magnetic field pattern for the TM 21 mode is shown in Fig. 16. It can be observed from Figs. 14 and 15 that the magnetic field pattern for this mode shows two half wavelength variation along the x axis representing 'm=2' (according to sin(2πx/a)), and single half wavelength variation along the y axis representing 'n=1' (according to cos(πy/b)). The magnetic field pattern along the x axis (y axis) is formed by the simultaneous multiplication of sine (cosine) variation in x direction, and cosine (sine) variation in y direction obeying the conventional equations for the fields inside the rectangular waveguide. The module developed in this work to plot and visualize the field component for any arbitrary mode is based on first computing the individual components of that particular mode similar to the procedure shown in Figs. 14 and 15.
The actual electric (magnetic) field component of the particular mode is obtained by taking the vector addition of all the individual electric (magnetic) field components. This process of vector addition for the TM 21 mode is shown clearly in Fig. 16, where the magnetic field plot is obtained by the superposition of results obtained in Fig. 14 and 15.
The procedure explained in this section obviously helps in understanding how the higher mode patterns are formed, which are otherwise quite difficult to be understood and visualized.

E. Current distribution in a rectangular waveguide
A module is also developed here to visualize the surface current distribution on different walls of the rectangular waveguide. The current flows along the walls of the waveguide because of the magnetic field, as by Ampere's law the curl of the magnetic field produces a current .An idea about the surface current distribution on any wall helps us in analyzing the areas on the waveguide, where, e.g., slots can be cut to insert some measuring probes with minimum power loss.
For a general TE mn mode, the surface current density is evaluated in the yz plane at x=0 and xz plane at y=b. The respective surface current density expressions can be derived to have following expressions [4]: For TE 10 mode, the surface current density exists along the y direction for yz plane. For xz plane, at z=0 J z =0 and J is along the -x direction for x<a/2, and along the +x direction for x>a/2 following cosine distribution. For z=π/2β, 3π/2β J x is zero (since cos(βz)=0) and J is in +z direction for z= π/2β and -z direction for z= 3π/2β (according to sin(βz) variation). This can also be seen from the surface current density pattern in Fig.17.

A. Electric and Magnetic Field patterns in the Rectangular Cavity
The rectangular cavity has been implemented in LabVIEW, and the electric and magnetic field patterns along with the surface current density on all three planes have been plotted for the general TE mnp and TM mnp modes. The front panel of the VI is shown in Fig. 18.
The Here x is along the length, y is along the height and z is along the direction of propagation of the wave. By keeping any two of the three variables constant, the variation with respect to the third variable can be studied.
The developed rectangular cavity module has the capability to plot the electric field, the magnetic field and the surface current density patterns for any arbitrary mode in the cavity.

B. Electric and Magnetic Field patterns in the Rectangular Cavity for the Characterization of Dielectric Samples
As explained briefly in section-II, the rectangular waveguide cavity can be used for the measurement of permittivity and permeability of materials. At microwave frequencies, the materials are usually nonmagnetic; hence the measurement of complex permittivity of materials becomes more important. The selection of the particular mode for the material measurement is decided by many factors. The prime consideration in the mode selection is to know whether the parameters of the interest are the permittivity or the permeability of the test specimen. If the permittivity of the sample is the desired parameter, then the mode should be selected in such a way that the test specimen can quite conveniently be placed at the position of maximum electric field. Similarly, for the permeability measurement, the mode selection should be primarily decided by the fact that the sample has to be inserted at the position of maximum magnetic field.
In the present work, the module is primarily developed for the permittivity measurement. The TE 10p mode (p being odd) is selected for this purpose, which ensures the maximum value of the electric field at the centre. The sample is inserted at this position for maximum sensitivity. The electric field pattern for this mode along the XY plane inside the rectangular cavity is shown in Fig. 19. The electric field pattern for the TE 10p mode along the XZ and YZ planes with 'p=3' is shown in Fig.  2 0 , where it can again be seen that the electric field is maximum at the centre. It can also be seen from this figure that the dielectric sample is inserted at the position of maximum electric field, which is exactly at the center of both xz and yz planes. The idea of inserting the sample at the position of maximum electric/magnetic field stems from the fact that the placement of the sample at this position provides the maximum sensitivity of the desired parameter of interest.

C.
The permittivity measurement using the TE 10n mode of Rectangular Waveguide Cavity As explained in section II, the determination of dielectric constant and the loss tangent of the test sample using the cavity approach requires the measurement of the resonant frequency and the Q factor of the cavity with and without the sample. Hence, the frequency response of the rectangular cavity (with and without the dielectric sample) is obtained using the full 3D electromagnetic field simulator. The generated frequency response was used to calculate the resonant frequency and Q factor of the cavity, which ultimately provides the dielectric constant and the loss tangent of the test sample. Now, based on the above principle, an appropriate module using LabVIEW is developed to calculate the dielectric properties of the test sample in the microwave frequency range as shown in Fig. 21. Fig. 21 shows the front panel of the developed module, where various options of the module are marked with different tabs, which are explained in the later part of the text. The simulation is carried out for a number of commonly used dielectric samples, and these data are stored in a pre-defined array. In a way, these data represent the measured values so that when a user selects the particular material in order to find its dielectric properties, the stored data corresponding to the test sample are loaded into the module. These data representing the frequency response of the cavity are also shown on the screen, which are then used to compute the complex permittivity of the selected test sample. Various tabs indicated in Fig. 18   It may be mentioned here that after plotting the frequency response of the empty cavity and the cavity loaded with the sample, their respective peak frequency and Quality factor are observed as shown in Fig. 21. Equations (6) and (7) are then employed to calculate the value of the dielectric constant and the loss tangent of the test samples from the observed peaks [5]. The developed module to determine the dielectric constant of the test sample can be accessed online for better understanding of the overall procedure at http://www.iitk.ac.in/mimt_lab/ vlab/index.php?pg=cavity/aim&usr=&enc= VI. CONCLUSION The easy to understand visualization modules have been developed in order to observe the electric and magnetic field patterns inside the waveguide and cavity structures. The simulation modules provide students an opportunity to visualize and understand various concepts related to the electric and magnetic field mode patterns, which are otherwise quite difficult to conceptualize. The main emphasis in the proposed work has been the visualization of field patterns inside the rectangular waveguide and the cavity, but the overall procedure can equally be applied to other RF and microwave structures. The visualization modules are available online as a part of the RF and Microwave Virtual Laboratory currently being developed at IIT Kanpur, and can be accessed at (http://www.iitk.ac.in/mimt_lab/vlab/index.php) Apart from the field visualization, one practical application of the rectangular waveguide cavity has been shown in the proposed work by developing an appropriate module for the electromagnetic material characterization in the microwave frequency band. The developed module in this case helps in finding the dielectric constant and loss tangent of the material under test by inserting a small piece of sample inside the rectangular cavity. The module helps the student in understanding the permittivity measurement process using the rectangular waveguide cavity without requiring any expensive hardware at the user end.
The main emphasis of the proposed work has been the development of visual aid tools for under graduate students in order to assist them in understanding some vital concepts in the field of RF, electromagnetic field theory and Microwave Engineering. However, the overall process is ongoing, and this task can only be improved by getting valuable feedbacks from users. The students are, therefore, encouraged to visit the web page of our virtual lab at the address given earlier, and perform the actual experiment using the procedure and guidelines provided on the site. After performing the experiment, they can provide the feedback online at the web site of the lab.