0% found this document useful (0 votes)
177 views

1 D Code

This document provides documentation for a 1D Matlab FDTD code called gui_fdtd_1d. It describes how to run the code, which allows simulation and animation of time domain reflection and transmission of a plane wave through homogeneous material slabs. It details the user interface, parameters that can be adjusted, and how various simulation options like material properties, excitation pulse, and boundary conditions can be specified.

Uploaded by

Wasyhun Asefa
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views

1 D Code

This document provides documentation for a 1D Matlab FDTD code called gui_fdtd_1d. It describes how to run the code, which allows simulation and animation of time domain reflection and transmission of a plane wave through homogeneous material slabs. It details the user interface, parameters that can be adjusted, and how various simulation options like material properties, excitation pulse, and boundary conditions can be specified.

Uploaded by

Wasyhun Asefa
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Documentation for 1D Matlab FDTD Code gui_fdtd_1d

Allen W. Glisson [email protected]

Atef Z. Elsherbeni [email protected]

Dept. of Electrical Engineering University of Mississippi University, MS 38677

March 12, 2000

1D FDTD Code: gui_fdtd_1d

Page 2

Introduction This document briefly describes the use of the 1D Matlab Finite Difference Time Domain (FDTD) code gui_fdtd_1d. This code has been developed primarily for educational use. The program animates time domain reflection and transmission of a plane wave through one or two homogeneous material slabs.

System Requirements The user must have Matlab to run this code. The code was developed and tested under Matlab version 5.3. It has not been tested under earlier versions of Matlab. The program consists of two preparsed pseudocode (pcode) Matlab files: gui_fdtd_1d.p gui_fdtd_dataentry.p Both files must be in the Matlab search path.

Usage To run the program, the user should enter the command gui_fdtd_1d from the command window of Matlab. The main simulation window shown in Fig. 1 will appear. Pressing the start button in the main window will begin the simulation with the default parameters. The speed of the simulation can be controlled using the slider bar or by typing a number from 1 (slow) to 100 (fast) in the edit box above the slider control. The speed control can be changed interactively at any time during a simulation. Once the animation has been started, it can be stopped temporarily and continued from its current state using the stop and continue buttons. During the simulation the value of the y component of the electric field at each time step is shown as a function of x/x, where x is the spatial increment used in the simulation. When the simulation is stopped, the time step number and the time index are shown at the top of the graph. Fig. 2 shows the incident pulse after one time step and the material region boundaries using the default parameters. When the animation is stopped the user can open the data entry window to change the simulation parameters by pressing the Set Data button. The data entry window is shown in Fig. 3. When the data entry window is open, the continue button is disabled, so the simulation must be restarted regardless of whether any data was actually changed in the data entry window. The data entry window can be left open while the simulation window is active, if desired, for quick changes to the simulation parameters.

1D FDTD Code: gui_fdtd_1d

Page 3

Figure 1. The main simulation window.

Data Entry Slab Parameters The constitutive parameters r , r , e , and m for each slab are set in the Slab Parameters section of the data entry window. If the parameters of the second slab are those of free space, the boundary lines for the second slab do not appear in the simulation window. The start and end locations of the two slabs are specified in terms of the index location x/x. Rudimentary error checking in the code does not permit the two slabs to overlap. Model and Excitation The Model and Excitation section of the data entry window allows one to control the spatial model in terms of the sampling increment x and the location of the right boundary of the model xmax / x . The left boundary of the model is always at x=0. One

1D FDTD Code: gui_fdtd_1d

Page 4

Figure 2. The incident pulse after one time step and the material region boundaries in the main simulation window using the default parameters.

can also control whether or not media averaging is performed at the slab interfaces, and can set the Courant-Friedrichs-Lewy (CFL) number for the simulation here. A CFL number greater than one is not allowed. The time width and peak location of the incident Gaussian pulse are also specified in this section. The pulse width here refers to the distance between the time points where the Gaussian pulse is down to 0.1% of its peak value. In this code, the incident pulse must appear completely within the computational domain at time t=0, but it must reside within a free-space portion of the computational window as suggested by Fig. 2, and not within the material slab. If any portion of the incident pulse appears outside the computational window or within the slab at time t=0, the user is warned to change the data, and the simulation will not run. The peak plot range value for the electric field can also be set in this section. The incident Gaussian pulse is assumed to have a value of one, so the plot range value is also initially set to one. Depending on the parameters of the material slabs, however, it may be necessary to change to plot range to avoid clipping the time domain response in the graph

1D FDTD Code: gui_fdtd_1d

Page 5

Figure 3. The data entry window.

window. Reducing the plot range value also allows one to view lower amplitude details in the plot. Computation Boundaries The properties of both the left and right boundaries of the computation domain can be chosen in this section. The first order Mur absorbing boundary condition is used when absorbing is chosen. Since the incident pulse starts within the computation domain, it is possible to choose both the left and right boundaries as PEC if desired. Formulation Type In this section the user can choose to use a total field formulation, a scattered field formulation in which the time derivative of the incident field is computed exactly, or a scattered field formulation in which the time derivative of the incident field is computed numerically. When a scattered field formulation is chosen, the simulation window shows plots of both the scattered electric field (as a blue curve) and the total electric field (as a

1D FDTD Code: gui_fdtd_1d

Page 6

red curve). When the scattered electric field and the total electric field are equal, the curve appears in green in the simulation window. In the scattered field formulation one can observe that the scattered field wave must travel through the material slab at a velocity of c to cancel the incident field on the other side of the slab. It may also be observed that use of the numerical derivative is superior to the exact derivative of the incident pulse in cancelling the incident field precursor as the wave moves through the slab.

You might also like