Click here to go to the applet.

This java applet is a simulation that demonstrates magnetostatics and electromagnetic waves in two dimensions.

When the applet starts up you will see a white circle (called the "source") emitting red and green circular waves. The color indicates the electric field; green areas are positive (towards you) and the red areas are negative (away from you). (In this applet, the electric field is always perpendicular to the plane of the screen; that means there are no free charges, and all currents have to be perpendicular to the screen as well. It also means the electrostatic potential is zero everywhere.)

In addition to the red and green color, you will see arrows which indicate the direction of the magnetic field (which is always in the plane of the screen).

Also, sources and conductors may show a blue or yellow color, indicating current. Yellow means that current is flowing towards you and blue means it is flowing away from you.

Conductors, dielectrics, and other media will show up as gray. There aren't enough colors or shades of gray to make the different kinds of media look different. Use the Show Material Type menu option to tell them apart.

These are electromagnetic waves, so in real life they would be moving at the speed of light.

This is the TM version of the applet. There is also a TE version.


The Setup popup can be used to view some interesting pre-defined experiments. Once an experiment is selected, you may modify it all you want. The choices are:

  • Single Source: this is a single wire with an alternating current, creating circular waves.
  • Two Sources: this is two wires emitting circular waves, creating an interference pattern between them.
  • Plane Wave: this demonstrates a simple plane wave source.
  • Intersecting Planes: this demonstrates two plane waves intersecting at right angles.

    The following 28 setups are all static, involving steady currents or permanent magnets, with no waves (except at the start). When you select one of them, just wait a bit for the system to reach a steady state.

  • Single Wire: this is a wire with a steady current.
  • Wire Pair: this is two wires with current in the same direction.
  • Dipole Wire Pair: this is two wires with current in opposite directions.
  • Magnet Pair: this is two permanent magnets with the north poles facing up.
  • Magnet Pair, Opp: this is two permanent magnets; the left one has the north pole facing up and the right one has it facing down.
  • Magnet Pair Stacked: this is two permanent magnets stacked on top of each other with the north poles facing up.
  • Magnet Pair Stacked Opp: this is two permanent magnets stacked on top of each other with the north poles facing towards each other.
  • Uniform Field: this is a (fairly) uniform field created by currents on the left and right sides of the screen.
  • Field Near Aperture: this shows a uniform magnetic field leaking through an aperture in a perfect conductor.
  • Solenoid: this shows the cross section of a coil of wire with a current running through it.
  • Toroidal Solenoid: this shows the cross section of a torus (donut) with a coil of wire wrapped around it.
  • Sphere: this shows the cross section of a uniformly magnetized sphere (actually an infinitely long cylinder, since this is 2-D).
  • Thick Wire: this shows a thick wire carrying a current.
  • Hole in Wire 1: this shows a thick current-carrying wire with a hole in it, resulting in no field in the hole.
  • Hole in Wire 2: this shows a thick current-carrying wire with an off-center hole in it, resulting in a uniform field in the hole.
  • Ferromagnet: this is a ferromagnet (like soft iron) near a solenoid. The ferromagnets in this applet are linear and have no hysteresis.
  • Diamagnet: this is a strong diamagnet near a solenoid. The diamagnets in this applet are far stronger than any known diamagnet, to illustrate the effect more clearly.
  • Meissner Effect: this shows a superconductor near a solenoid. The superconductor rejects all magnetic fields (except at the surface). The blue and yellow color in the superconductor indicates the presence of eddy currents. Since this is a superconductor, the eddy currents do not die out.
  • Horseshoe Magnet: this shows an electromagnet in the shape of a horseshoe.
  • Horseshoe + Load: this shows a horseshoe electromagnet carrying a ferromagnetic load.
  • Magnetic Shielding 1: this shows the magnetic field of solenoid being shielded by a ferromagnet. Notice that there is very little field below the ferromagnet. (You will see a somewhat strong magnetic field one grid square below the ferromagnet, but that is a bug and this would not happen in real life.)
  • Magnetic Shielding 2: this shows the magnetic field of solenoid being shielded by a ferromagnetic box. Notice that there is very little field outside of the ferromagnet. The ferromagnet is conducting and thus will reflect the wave generated when the current is first switched on in the solenoid; so you will have to wait a bit for the oscillation to die out.
  • Magnetic Shielding 3: this shows the magnetic field of solenoid being shielded by a ferromagnetic sphere. The field is weaker outside of the ferromagnet; the brightness is turned up so that you can see that the field outside looks like the field of a magnetic dipole (compare it to Dipole Wire Pair and Sphere). You will have to wait even longer for the oscillation to die out because the brightness is turned up and the current is much stronger than in the previous setup.
  • Magnetic Shielding 4: this shows a ferromagnetic box shielding its interior from a uniform external field.
  • Magnetic Circuit 1: this shows a magnetic circuit; the field generated by the solenoid on the right is being "conducted" by ferromagnetic material.
  • Magnetic Circuit 2: this shows a magnetic circuit with an air gap on the left.
  • Monopole Attempt: This is a simulation of what would happen if you tried to make a magnetic monopole (a magnet with only a north pole and no south pole) by taking a bunch of magnets and forcing them into a square with their south poles in the center. Instead of getting a monopole, you would find that the gaps between the magnets would act as south poles, and the field there would be much stronger than on the faces of the magnets. If you could force them together perfectly with no gaps, there would be no field at all anywhere because all the currents would cancel out.
  • Quadrupole Lens: this shows four magnets in the shape of hyperbolas, forced together. This device is used to focus particle beams.
  • Halbach Array: this shows five magnets in a linear Halbach array. The magnetic field is concentrated on the bottom side. To see the orientations of the individual magnets, select Show Magnetization from the Show popup.
  • Halbach Array (long): this shows a longer Halbach array.
  • Halbach Array (dipole): this shows a circular Halbach array with a uniform magnetic field inside.
  • Halbach Array (quadrupole): this shows a circular Halbach array with a magnetic quadrupole inside.

    The rest of the setups are all dynamic, involving changing currents and waves.

  • Dielectric: this shows wave packets being reflected by a dielectric medium. Waves travel slower in a dielectric, causing the incoming wave to be partially reflected and partially refracted.
  • Fair Conductor Reflection: this shows wave packets being reflected by a fairly good conductor. When waves hit a conductor, it causes eddy currents which cause the wave to be mostly reflected. A small fraction of the wave is transmitted, and that part is attenuated almost immediately.
  • Poor Conductor Reflection: this shows wave packets being reflected by a poor conductor. When waves hit the conductor, it causes weak eddy currents which cause the wave to be partly reflected. Part of the wave is transmitted, and that part is quickly attenuated by eddy currents.
  • Skin Effect 1: this shows that waves hitting a conductor will only penetrate a certain distance, called the skin depth. (Actually the strength of the wave falls off exponentially, but the skin depth is a measure of how fast this happens.)
  • Skin Effect 2: this shows that the skin depth is smaller for higher-frequency waves.
  • Resonant Absorption: this creates a medium made up of little resonators. The resonators have a characteristic frequency which is the same as the frequency of the incoming radiation. Since this medium has a resonance frequency, it is dispersive, which means that waves of different frequencies travel at different speeds. Here, since the incoming radiation's frequency is close to the resonance frequency, it is absorbed by the medium, although much of it is reflected because of the discontinuity caused by the strong absorption.
  • Dispersion 1: this setup illustrates dispersion in the resonant medium. The incident wave has a frequency which is much lower than the resonance frequency, so the refractive index is only slightly higher than 1. So it is transmitted largely without reflection.
  • Dispersion 2: Here the incident wave has a frequency which is slightly lower than the resonance frequency, so waves travel much more slowly in the medium, and more of the wave is reflected. Also there is some absorption, so the farther the wave travels into the medium, the weaker it is.
  • Dispersion 3: Here the incident wave has a frequency which is slightly higher than the resonance frequency, so waves have a phase velocity that is faster than in a vacuum. So waves seem to move faster than the speed of light in a vacuum. Still, the signal velocity in the medium is not faster than the speed of light; when the source is first switched on, the initial wave train travels at normal speed.
  • Dispersion 4: Here the incident wave has a frequency which is much higher than the resonance frequency, so waves have a phase velocity that is only slightly faster than in a vacuum. So the medium has very little affect on the incoming wave.
  • Magnetic Diffusion: this shows a magnetic field (generated by a wire) diffusing slowly through a conductor. Wait for the field to slowly build up, then get rid of the wire (the yellow square) by clicking on it. The field will slowly die out; the presence of the conductor causes changes in magnetic field to diffuse slowly rather than happening at the speed of light.
  • Oscillating Ring: this shows the cross section of a ring with an oscillating current running through it. This is approximated by two wires with current running in opposite directions. The oscillating current causes radiation; this is called magnetic dipole radiation.
  • Oscillating Ring Pair: this shows the cross section of two rings with an oscillating current running through them in opposite directions, resulting in magnetic quadrupole radiation.
  • Ring Induction: this shows a ring with an oscillating current running through it, inducing an opposing current in another ring right below it.
  • Wire Induction: this shows a wire with an oscillating current running through it, inducing an opposing current in another wire right below it.
  • Ring + Fair Conductor: this shows a ring with a slowly oscillating current running through it, with a fairly good conductor underneath it. The changing current generates eddy currents in the conductor, causing the magnetic field to diffuse slowly through the conductor to the other side.
  • Ring + Poor Conductor: this shows a ring with a slowly oscillating current running through it, with a poor conductor underneath it. The eddy currents are much weaker, so the magnetic field diffuses quickly through the conductor to the other side.
  • Wire + Fair Conductor: this shows a wire with a slowly oscillating current running through it, with a fairly good conductor underneath it. The changing current generates eddy currents in the conductor, causing the magnetic field to diffuse slowly through the conductor to the other side.
  • Wire + Poor Conductor: this shows a wire with a slowly oscillating current running through it, with a poor conductor underneath it. The eddy currents are much weaker, so the magnetic field diffuses quickly through the conductor to the other side.
  • Rings + Ferromagnet: this is an oscillating ring (in the middle) positioned near two conducting rings. There is a ferromagnetic core present which cause the induced current to be stronger in the lower ring than in the upper ring.
  • Osc. Solenoid: this is a solenoid with an oscillating current running through it.
  • Transformer: this is two coils wrapped around each other, with an oscillating current in the inner one. This induces a current in the outer one. This transformer is rather pointless since the number of turns is the same in the inner and outer coils. This applet cannot demonstrate transformers very well because there is no way to measure voltage, and because the current is always perpendicular to the screen, and none of the conducting grid squares are connected to one another. Also the current in the inner coil is fixed and is not affected by the outer coil.
  • Osc. Toroidal Solenoid: this is a toroidal solenoid with an oscillating current running through it.
  • Coaxial Cable: this is a cross section of a coaxial cable, with an oscillating current running through it. Note that there is very little radiation (assuming the wavelength of the oscillation is small compared to the diameter of the cable). This is part of the reason that coaxial cable is used to carry high frequencies--it reduces the amount of power loss from radiation.
  • Cond. in Osc. Field: this is a small conducting square in a uniform field that is oscillating.
  • Moving Wire: this is a current-carrying wire which is moving at a significant fraction of the speed of light. The magnetic field lines are slightly flattened out. It stops periodically and then starts again so you can see the radiation generated when its velocity changes.
  • Moving Wire in Tube: this is a current-carrying wire which is moving through a conducting tube. When the wire moves it causes a changing magnetic field, which generates eddy currents in the tube. The presence of the tube causes a force on the wire opposing the direction of motion, which you can see by selecting Show Force from the Show menu.
  • Moving Magnet in Tube: this is a magnet which is moving through a conducting tube. When the magnet moves it causes a changing magnetic field, which generates eddy currents in the tube. The presence of the tube causes a force on the magnet opposing the direction of motion, which you can see by selecting Show Force from the Show menu. The magnet stops periodically to give the eddy currents a chance to die out.
  • Rotating Magnet 1: this is a rotating magnet, which emits radiation. Select Show Magnetization to see the direction the magnet is pointing.
  • Rotating Magnet 2: this is a magnet which rotates through 180 degrees and then reverses direction. This causes it to emit radiation.
  • Scattering 1: this shows a plane wave being scattered by a small resonator. The incoming plane wave gets turned off periodically so you can see the scattered wave better. The frequency of the incoming wave is close to the resonant frequency of the resonator, so the scattered wave is relatively strong.
  • Scattering 2: Here the frequency of the incoming wave is not as close to the resonant frequency of the resonator, so the scattered wave is much weaker.
  • Big TM11 Mode: this creates a small superconducting cavity with a standing wave inside it. The electric field is 90 degrees out of phase with the magnetic field. The field in the cavity is oscillating in its TM11 mode.
  • TM11 Modes: this creates a set of small superconducting cavities with TM11 standing waves inside them.
  • TMn1 Modes: this creates a set of small superconducting cavities with TM11, TM21, and TM31 standing waves inside them. (If the resolution is set higher then more cavities are present with higher modes.)
  • TMnn Modes: this creates a set of small superconducting cavities with various TM modes inside them.
  • TMn1 Mode Combos: this creates a set of small superconducting cavities, with various combinations of TMn1 modes inside them.
  • TMnn Mode Combos: this creates a set of small superconducting cavities, with various combinations of TM modes inside them.
  • Triangle Modes: this creates a set of small triangular cavities with standing waves.
  • Circular Modes 1: this creates a set of small circular cavities with standing waves.
  • Circular Modes 2: this creates a circular cavity with two standing waves superimposed 90 degrees out of phase so that the fields appear to rotate.
  • Waveguides 1: This creates a series of waveguides of different widths. Narrower waveguides, like at the left end of the screen, have higher cutoff frequencies.

    Notice that the waves seem to be moving faster in thinner waveguides. They appear to be moving faster than waves normally move in the applet. This is because the phase velocity is faster in thinner waveguides; but the signal velocity is actually slower than normal, as you can verify by clicking the Clear Waves button and watching the wave move down the guide for the first time.

    Since the waveguides are being driven by a plane wave, only the TE01 mode is present. (See the waveguide applet for another way to view waveguide modes.)

  • Waveguides 2: This is just the same set of waveguides with a lower frequency. The waveguide on the left has a cutoff frequency that is higher than the source, so there is no wave motion in it. You can fix this by turning the Source Frequency slider up.
  • Waveguides 3: This is a set of identical waveguides being driven by small holes at different locations. This causes different sets of modes to be excited in different proportions. When the guide is being driven near the center, the TE01 mode is dominant, but when it is driven near the edge, the TE02 mode is more prevalent. The frequency is low enough so that all other modes are cut off. You can fix this by turning the frequency up. By turning the frequency down, you can cut off the TE02 mode as well.
  • Waveguides 4: This is a set of identical waveguides with various modes present. The first waveguide contains the TE01 mode; the second contains the TE02 mode; the third contains the TE03 mode; the fourth contains TE01 and TE02; the fifth contains TE01 and TE03; the sixth contains TE02 and TE03. (There will not be room on your screen for all these modes if your resolution is not set high enough.)

    Notice that the higher modes (TE02 and especially TE03) seem to be moving faster. This is because the phase velocity of TE02 and TE03 is greater than that of TE01. Their signal velocities are slower, though, which is why it takes the TE03 wave so long to make it down to the end of the waveguide. Also if you turn off the source (by setting the source popup to "No Sources") it will take quite a while for the TE03 mode to stop.

  • Resonant Cavities 1: This creates a series of rectangular cavities being driven by a plane wave from above. As you change the frequency you will see the response of each cavity change. Each cavity has a different resonant frequency so it will respond differently. After changing the frequency you may want to wait a bit for things to settle down (or turn the simulation speed way up).
  • Single Slit: this demonstrates diffraction of waves travelling through a slit.
  • Double Slit: this demonstrates diffraction of waves travelling through a double slit.
  • Triple Slit.
  • Obstacle: this demonstrates diffraction of waves travelling around an obstacle.
  • Half Plane: this demonstrates diffraction of waves around the edge of a plane.
  • Lloyd's Mirror: This shows an interferometer which consists of a point source close to a mirror (at the bottom of the window). The waves coming from the source interfere with the waves coming from its mirror image.

The Source popup controls the wave sources (oscillating currents). It has the following settings:

  • No Sources: there will be no sources of wave motion.
  • 1 Src, 1 Freq: there will be a single source of sinusoidal waves at a single frequency (set using the Source Frequency slider). This source can be dragged anywhere on the screen with the mouse.
  • 1 Src, 2 Freq: the source will be emitting two waves, at separate frequencies. The first frequency is set using the Source Frequency slider, and the second frequency is set using 2nd Frequency.
  • 2 Src, 1 Freq: two sources will be created, both at the same frequency. But you can select the phase difference using the Phase Difference slider. If the slider is all the way to the left, the sources will be in phase; if it is all the way to the right, the sources will be 180 degrees out of phase. (The top one will be green while the bottom one is red, and vice versa.)
  • 2 Src, 2 Freq: the two sources will be at different frequencies. The Source 2 Frequency slider can be used to set the second one's frequency.
  • 3 Src, 1 Freq or 4 Src, 1 Freq: 3 or 4 sources will be created, all at the same frequency.
  • 1 Src, 1 Freq (Packet): the source will emit wave packets periodically.
  • x Plane Src, y Freq: the source(s) will emit plane waves rather than circular waves. The location and direction of the plane wave can be modified by dragging one or both of the two white circles. If the white circles are located at the edge of the screen, the plane is extended offscreen; otherwise it is not. Since the waves are not extended infinitely offscreen they are not true plane waves, strictly speaking.
  • 1 Plane 1 Freq (Packet): the source will emit plane wave packets.

The Mouse popup controls what happens when the mouse is clicked. The following settings are possible:

  • Mouse = Add Perf. Conductor: Clicking on a point will create a perfect conductor there. Clicking on an existing conductor will erase it.
  • Mouse = Add Good Conductor: Clicking on a point will create a conductor which is not perfect but is still pretty good.
  • Mouse = Add Fair Conductor: Clicking on a point will create a fairly good conductor.
  • Mouse = Add Current (+): Clicking on a point will create a wire with current flowing in the positive z direction (towards you).
  • Mouse = Add Current (-): Clicking on a point will create a wire with current flowing in the negative z direction (away from you).
  • Mouse = Add Ferromagnet: Clicking on a point will create a ferromagnetic medium. The ferromagnets in this applet are linear and have no hysteresis (except for the permanent magnets).
  • Mouse = Add Diamagnet: Clicking on a point will create a diamagnetic medium. The diamagnets in this applet are far stronger than any known diamagnet, to illustrate the effect more clearly.
  • Mouse = Add Dielectric: Clicking on a point will create a dielectric medium.
  • Mouse = Add Magnet (Down/Up/Left/Right): Clicking on a point will create a permanent magnet with the north pole pointing in the direction indicated.
  • Mouse = Add Resonant Medium: Clicking on a point will create a resonant medium.
  • Mouse = Clear: Clicking on a point will remove whatever is there.
  • Mouse = Adjust Conductivity: Clicking on a point and dragging out a rectangular area will allow you to adjust the conductivity of the conductors in that area using the Conductivity slider. The Show Material Type menu option may come in handy here (and in the following options) to see feedback from the changes you are making and to compare the conductivity of all conductors on the screen.
  • Mouse = Adjust Permeability: Clicking on a point and dragging out a rectangular area will allow you to adjust the permeability of the ferromagnets in that area using the Permeability slider.
  • Mouse = Adjust Current: Clicking on a point and dragging out a rectangular area will allow you to adjust the current flowing through the wires in that area using the Current slider.
  • Mouse = Adjust Dielectric: Clicking on a point and dragging out a rectangular area will allow you to adjust the dielectric constant on the dielectrics in that area using the Dielectric Constant slider.
  • Mouse = Adjust Mag Dir: Clicking on a point and dragging out a rectangular area will allow you to adjust the direction of the permanent magnets in that area using the Direction slider.
  • Mouse = Adjust Mag Strength: Clicking on a point and dragging out a rectangular area will allow you to adjust the strength of the permanent magnets in that area using the Strength slider.

The Show popup determines which fields or other quantities to display, and how to display them.

  • Show Electric Field (E): Show the electric field as green (positive, toward you) or red (negative, away from you).
  • Show Magnetic Field (B): Show the magnetic field as arrows. The arrows go from dark green to light green and then to white as the field gets stronger.
  • Show B Lines: Show the magnetic field as lines. The color of the lines go from dark green to light green and then to white as the field gets stronger. The density of the lines is kept fairly constant, so in order to determine the field strength you need to look at the color of the lines rather than how far apart they are.
  • Show B Strength: Show the magnetic field strength using shades of green.
  • Show Current (j): Show the current density as yellow (positive, toward you) or blue (negative, away from you).
  • Show E/B: Show both the electric field and the magnetic field arrows.
  • Show E/B lines: Show both electric field and the magnetic field lines.
  • Show E/B/j: Show both the electric field and the magnetic field arrows; in conductors, or where the current is nonzero, show the current density instead of the electric field.
  • Show E/B lines/j: Show both the electric field and the magnetic field lines; in conductors, or where the current is nonzero, show the current density instead of the electric field.
  • Show Mag. Intensity (H): Show the magnetic intensity vector, which is equal to the magnetic field minus the magnetization. In linear media (which, in this applet, is everywhere except for inside permanent magnets) this is equal to B divided by the permeability. This will be the same as B unless ferromagnets, diamagnets, or permanent magnets are present.
  • Show Magnetization (M): Show the magnetization vector, which indicates the direction and degree of alignment of magnetic media with an external field. In permanent magnets, the magnetization is constant, and points to the magnet's north pole. In ferromagnets, the magnetization is proportional to the external field and in the same direction; in diamagnets, it is proportional but in the opposite direction. Everywhere else it is zero.
  • Show Material Type: Since all materials show up as gray, you need this option to tell them apart:
    • Diamagnets: red ()
    • Ferromagnets: green () (lighter shades indicate higher permeability)
    • Permanent Magnets: purple ()
    • Dielectrics: orange () (lighter shades indicate stronger dielectrics)
    • Resonant: light orange ()
    • Perfect Conductors: white ()
    • Imperfect Conductors: cyan () (lighter shades indicate better conductors)
    • Wires with Current: blue () or yellow ()
  • Show Vec. Potential: Show the vector potential (A) as green (positive, toward you) or red (negative, away from you). The vector potential is always perpendicular to the screen.
  • Show Poynting Vector: Show the Poynting vector, which indicates the direction of energy transfer. For waves, it is in the direction of wave motion.
  • Show Energy Density: Show the energy density as shades of yellow.
  • Show Poynting/Energy: Show both the energy density and the Poynting vector.
  • Show Force: Show magnetic force. The total force on each object is added up by summing over each grid square (ignoring speed-of-light delay) and the total is shown on every grid square taken up by the object.
  • Show Effective Current: Show the effective current density in magnetic media caused by the alignment of magnetic dipoles. This is equal to the curl of the magnetization. So for example, for permanent magnets, this will show you the current distribution which will generate the same field as the permanent magnet; a square permanent magnet acts the same as a solenoid.
  • Show Magnetic Charge: Show the effective magnetic charge density for any permanent magnets. For setups involving just permanent magnets, we can think of the magnetic field as originating from magnetic charges at the north and south poles of the magnets. Using those magnetic charges, we can calculate a scalar potential for every point on the screen (just like the electrostatic potential) and calculate the magnetic intensity vector (H) from that potential. So if you look the magnetic charge of a permanent magnet you see that the two poles are oppositely charged; if you look at the H it looks like the electric field of two parallel plates with opposite charges on each plate (with the plates located at the poles).
  • Show Curl E: Show the curl of the electric field, which is equal to the change in magnetic field (in the absence of currents), by one of Maxwell's equations.
  • Show Bx: Show the x component of the magnetic field; green indicates positive (to the right) and red indicates negative (to the left).
  • Show By: Show the y component of the magnetic field; green indicates positive (up) and red indicates negative (down).
  • Show Hx,Hy: Show the x or y component of the magnetic intensity vector.

The Clear Fields button magically clears out any fields but does not remove any currents, sources, or materials. The Clear All button clears out everything.

The Stopped checkbox stops the applet, in case you want to take a closer look at something, or if you want to work on something with the mouse without worrying about it changing out from under you.

The Simulation Speed slider controls how far the waves move between frames. If you slide this to the left, the applet will go faster but the motion will be choppier.

The Resolution slider allows you to speed up or slow down the applet by adjusting the resolution; a higher resolution is slower but looks better.

The Brightness slider controls the brightness, just like on a TV set. This can be used to view faint waves more easily.



    Click here to go to the applet.



    java@falstad.com