Work through a matching design with the Smith chart and the L-section procedure, and sooner or later you hit the same wall: the moment the element values on paper become shapes on a board, the story changes.
Component pads, the traces between parts, the vias down to ground — none of these appear in the schematic, yet at GHz they matter as much as the elements themselves. And a circuit simulator will not tell you about them, because what it solves is the schematic, not the board.
So I have published an electromagnetic simulator that solves planar circuits by the method of moments (MoM), running in the browser.
Nothing to install. Open it, draw a conductor pattern on the grid, press "▶ Run simulation", and you get S-parameters and the surface current distribution. All computation happens in the visitor's browser; the pattern you draw is never sent to a server.
This is the first of four articles. It covers how to use the tool and what it shows you; the other three are about what is inside.
- The analysis mesh, and the checks that make the numbers trustworthy
- Solving dense matrices fast in the browser — adaptive frequency sampling and WebGPU
- Solving pixelated circuits — the corner-contact problem found while reproducing a paper
What the method of moments does
This is the method behind commercial planar EM solvers such as Momentum, Sonnet and AXIEM. The idea itself is not hard.
The unknowns are the surface currents on the conductors. Divide the conductors into small cells and call each cell's current an unknown I; the potential and the magnetic vector potential at any point are then the sum of the contributions from every cell's current. Write down the condition that the tangential electric field vanishes on the conductor surface (for a perfect conductor) at each cell, and you get the linear system
Z · I = VZ collects "the electric field that the current in cell m produces at cell n". Solve it and you have the current distribution; the port currents and voltages then give the Y matrix, and from it the S-parameters.
The key point is that the unknowns live only on the conductors. Unlike the finite element method or FDTD, there is no need to fill the whole space with a mesh. That makes it far faster for planar circuits, fast enough to be practical in a browser. The default line preset has 624 unknowns, and a 1001-point frequency sweep finishes in 0.5 s (Apple M1, using the GPU).
The price is that Z is a dense matrix. With N unknowns, memory grows as N² and solve time as N³. That is why finer is not automatically better.
How to use it
The screen has the inputs on the left and two tabs on the right, "Circuit layout" and "Simulation results". "How to use" at the top right starts a tour that walks through each part of the screen.
- Board: set the permittivity, substrate thickness, metal thickness and conductivity, and the size of one grid square (the cell size). The cell size is set either from a "Wavelength" (design frequency and cells per wavelength) or as a "Length". A cross-section of the board you entered is drawn to the right of the layout
- Draw the pattern: click or drag on the 18×18 grid to draw metal. Right-click places a via to ground. P1 and P2 (red outlines) are the ports; in "Port" mode you can move them to any edge cell. You can also start from the "Line", "Gap" or "Grounded stub" presets
- Simulation: choose the frequency range and number of points. The analysis mesh is normally fine on "Automatic (recommended)"
- ▶ Run simulation: when it finishes the view switches to the results tab, with S-parameters on top and the surface current below
Hover over any ? for details. Inputs are saved in the browser automatically, and "Export file" takes them out as JSON.
The default board is FR-4-like (εr = 4.4, 0.8 mm thick, 18 µm copper), swept from 0.5 to 6 GHz. The cell size is 2.199 mm, which gives 20 cells per wavelength at 3.25 GHz, so the 18-cell line is 39.6 mm long.
Checking εeff from the line's resonance spacing
Start with the "Line" preset. A one-cell-wide strip has Z₀ ≈ 39.9 Ω, εeff ≈ 3.434 by the Hammerstad-Jensen closed form (the tool shows these values on the left). Seen from a 50 Ω system it is a mismatch, so it reflects — except at the frequencies where the line is a whole number of half wavelengths long.
Sweep with 1001 points and you find three deep dips in S11:
1.847 GHz : S11 = −58.5 dB
3.805 GHz : S11 = −55.5 dB
5.862 GHz : S11 = −50.4 dBFrom the closed-form εeff = 3.434, the expected spacing of the half-wave resonances is
Δf = c / (2 · L · √εeff) = 3×10⁸ / (2 × 0.0396 × 1.853) = 2.04 GHzThe spacing between the second and third dips is 2.06 GHz, within 1 % of the prediction. A result the method of moments worked out independently agrees with the transmission-line closed form.
The first dip, on the other hand, sits at 1.85 GHz, about 10 % below the predicted 2.04 GHz. The ports feed vertically from the end cell of the line straight down to ground, and this vertical current path, together with the fringing field at the ends of the line, makes the line look electrically longer. That happens on a real board too — and it does not appear in a circuit simulation that just strings closed-form lines together.
Check against a structure with a known answer first, then move on to structures without one. That is the right way to use an electromagnetic simulator. Draw something complicated straight away and nobody can tell whether the numbers that come out are right.
Is the gap "one capacitor"?
The "Gap" preset is the line with one cell cut out of the middle. Its transmission:
0.5 GHz : S21 = −57.6 dB
1.0 GHz : S21 = −52.9 dB
2.0 GHz : S21 = −47.8 dB
3.0 GHz : S21 = −41.4 dBTransmission rising with frequency is the signature of capacitive coupling. For a small series capacitance C in a 50 Ω system,
|S21| ≈ 2·ω·C·Z0so working back from the 0.5 GHz value gives C ≈ 4.2 fF.
But a pure series capacitance would rise by exactly 6 dB per doubling of frequency, and from 0.5 to 1 GHz it rises by only 4.7 dB. Conversely, from 2 to 3 GHz (a factor of 1.5) it rises by 6.4 dB where it should rise by 3.5 dB. The "apparent capacitance" from the same formula moves between 3.2 and 6.5 fF.
The reason is that S21 does not see the gap alone. It sees the whole thing: the 39.9 Ω lines on either side of the gap, and the port feeds. Even at 0.5 GHz each line is about 19 mm long and carries capacitance that is not negligible against 50 Ω. As the frequency rises, the lines' own resonances join in.
To extract the gap capacitance alone you have to remove the effect of the lines on either side (de-embed). That is why commercial solvers can move the port reference planes. The S-parameters of a whole layout and the value of one schematic element are different things — that is the lesson of this preset.
(The first version of this article, in September 2026, said the gap was a constant 4 fF at every frequency. That was an accident of the 17×17 grid at the time, and is corrected as above.)
Grounded stub: even the via's length counts
The "Grounded stub" preset hangs a four-cell stub down from the middle of the line and takes its end to ground through a via.
0.5 GHz : S21 = −11.6 dB
1.0 GHz : S21 = −4.6 dB
4.2 GHz : S21 = −0.07 dB (passes most freely)At low frequencies the stub is just a short to ground, draining the signal away. As the frequency rises, the shorted stub becomes a quarter wavelength long, looks open from the line, and lets the signal through.
The stub is four cells = 8.8 mm long (from the centre of the line to the centre of the via cell), and the closed-form εeff puts its quarter-wave frequency at 4.6 GHz. The simulation puts it at 4.2 GHz, about 8 % lower. Most of the difference comes from the via's series inductance and the T-junction, both of which make the stub electrically longer. This is exactly why stub matching designed on paper ends up low in frequency on the real board.
Looking at the surface current
The lower half of the results tab shows the surface current. In 3D, drag to rotate, use the wheel to zoom, shift+drag to pan and double-click to reset the view. The play button animates one period.
The current shown is with port 1 driven and port 2 terminated in 50 Ω. On the line the wave travels one way along it; in front of the gap it overlaps the reflected wave and forms a standing wave; on the grounded stub the current is drawn into the via, more so at lower frequencies. Click on the S-parameter plot or move the frequency slider to switch to the current at that frequency.
What S11 alone cannot tell you is visible here. When matching moves on to distributed elements such as stubs, having this picture makes all the difference to how quickly it makes sense.
The animation can go straight onto social media. “Export GIF” and “Export MP4” above the plot save exactly one period, phase 0° to 360°, as a file, exactly as the view is on screen (2D or 3D, angle, zoom). Being exactly one period, it loops without a seam. The GIF has 30 frames and is around 700 KB for the default presets; the MP4 covers three periods (6 s by default), and browsers that cannot record MP4 produce WebM instead. Exporting also happens entirely in the browser; nothing is sent to a server.
What is exact and what is approximate
This is a tool for teaching and visualisation, so its limits should be stated plainly.
Treated exactly: the Green's function of a single grounded substrate (image series), the cell surface integrals (closed form, no numerical quadrature), a surface impedance including the conductor's skin effect, and edge meshing at conductor boundaries.
Not treated: radiation, surface waves, dispersion. The formulation is quasi-static, so errors grow at high frequencies where cells become large compared with the wavelength. The only loss is conductor loss in the signal layer; dielectric loss and ground-plane loss are not counted. Mutual inductance between vias is also ignored.
In short, it is not a replacement for a commercial solver. For the final check before building a board, use a proper one. What this tool is good for is getting a feel for trends — "how does the coupling change if I widen the gap by one cell?", "what happens if I add a via at the root of the stub?" — and understanding what is going on by looking at the current.
The details of the numerical model are under "Numerical model (click to expand)" at the bottom of the tool, and the mesh and the validation are covered in the next article.
First published 11 September 2026; fully revised 10 October 2026 (numbers re-measured for the 18×18 grid, automatic meshing, GPU solving and the other changes).