CAE Coureware Using VPython
(Tested in VPython 2.7)

Some screen shots of my courseware for electromagnetic fields are listed here.
Most of the executable programs are also available; instructions are not complete.

To run the programs, you need to install first Python and then VPython. You can
website for more details.

Created by Zhengqing Yun.

### 1. Types of Waves

Instructions
Transverse Wave (VPython Program)

Longitudinal Wave (VPython Program)

Water Wave (VPython Program)

Instructions
VPython Program

VPython Program

Instructions
VPython Program

Instructions
VPython Program

### 6. Oblique Incidence: Reference Directions

VPython Program
The program starts with an interface and a normal vector. Then a left button click
will introduce an incident direction (red arrow). Press 'v' key to turn on/off the plane of
incidence. Now you can use 'Up', 'Down', 'Left', and 'Right' keys to change the
incident direction. You can leave this interactive loop by pressing the 'e' key.
The program will display a 3D scene as follows:

• To change the incident direction: Drag the green sphere
• To assign an incident electric field vector: Click on the yellow wavefront with the incident wave.
• To decompose the electric field vector into parallel and perpendicular components: Press the 'p' key.
• You can turn on/off the e-field vector, the wavefronts by pressing keys: 'I','i','r','t'

### 7. Polarization

• To get linear, circular, and elliptical polarizations:
• Drag the three spheres to change Ex, Ey magnitudes and the phase Ey leads Ex, Phi
• Press the 'i' key to enter the exact values of Ex, Ey and Phi (Ex and Ey are normalized to their max)
• In 3D mode, press 'x', 'y', and 't' keys to view/hide the Ex, Ey, and total field curves
VPython Program
• 2D mode (default or by press the '2' key to enter):

• 3D mode (press the '3' key to enter):

### 8. Oblique Incidence on PEC: Total Field

VPython Program
• Drag the green sphere to change incident angle;
• Press the 'x','y','z' key to show/hide x-, y-, z-components (yellow, green, pink arrows);
• Press the 'p' key to show/hide parallel component, Ex+Ez (white arrows);
• Press the 'Up', 'Down' arrow keys to make the field vectors larger, smaller (for visualization purposes);
• Press the '0' key to set t = 0.

### 9. Thin Lens

VPython Program
Drag the object arrow and focal point to interact.

### 10. Linear Antenna: 2D Radiation Pattern

VPython Program
Use the Up/Down keys to change the antenna length (in wavelengths).

### 11. Linear Antenna: 3D Radiation Pattern

Vpython Program
To change antenna length (in wavelengths):
• Drag the top red sphere;
• Use the Up/Down keys;
• Press 'k' key to enter 2L
Press '3' key to get 3D pattern; press '4' to cancel.

### 12. FDTD Grid: 3D visualization

Vpython Program
Simply click and click to build a FDTD grid step by step.

### 13. Skylight Polarization

Vpython Program
Explains sky light polarization using Rayleight scattering patterns

### 14. Propagation in a 2D Hallway

Vpython Program
(f=2.4 GHz; side wall eps_r=3.0)
• Enter maximum number of reflections at the beginning (0 for free space).
• Drag Rx (green) to get the received power along a line.
• Drag Tx (red) along y-axis to change its location.

### 15. Local coordinates for diffraction

Vpython Program
Drag Tx or Rx to view the change of the diffraction point and the field directions

Huygens Principle (for Snell's Law)

Snell's Law

Phasor