Skip to content

Unit cells

A unit cell is one period of a structure that repeats in x and y, such as a frequency-selective surface, an absorber, or a reflectarray element. RayRF simulates one period between periodic boundaries, lights it with a plane wave from above, and reports reflection and transmission against frequency. This page covers the setup, what the run records, the air around the cell, and what a plane-wave run refuses.

Setting up a cell

Draw one period. The domain rectangle is the cell, so uncheck Auto-fit domain and size the domain to the period.

On the Simulate tab:

  1. Set the Boundary Condition Type to Custom.
  2. Set +X, -X, +Y and -Y to Periodic. Selecting Periodic on one face sets the opposite face too. Give each face a spacing: 0 puts the wall on the domain edge, so the period is the domain size.
  3. Leave +Z and -Z on PML.
  4. In the Plane wave card, which appears once a side face is Periodic, check Plane wave from above and select the direction of the E field.
  5. Uncheck Compute Radiation Pattern.

A plane-wave project takes no port. Conductor layers use the Perfect Conductor material. To close the cell with a ground plane, draw the ground as a conductor layer across the whole cell.

The mesh divides each periodic axis into whole cells, so the structure repeats at the drawn period. In Auto mode no cell of a unit cell, on any axis, is larger than the period divided by 20 at Low, 40 at Medium, 60 at High and 100 at Very High. A repeating pattern resonates on the size of its metal, and at the sharp edge of a thin sheet the error only halves when the cell halves, so a unit cell needs many more cells across than a board of the same size. rayrf estimate shows the realized cell size and names "cells per period" when this rule sets it.

The frequency range

A higher-order mode of the cell starts to travel instead of fading at two frequencies: the speed of light divided by the period and by the square root of the largest permittivity in the stackup, inside that dielectric, and the speed of light divided by the period, in air. Above the first, the result can show sharp resonances that come from the dielectric rather than the pattern, and they ring for a long time. Metal on the dielectric slows that wave, so the first of them can sit a few percent lower. Keep the band a little under it. Above the second, the cell also sends waves off at an angle, which S11 and S21 do not hold. validate and the run warn when the band reaches past either frequency and name it. For a 5 mm cell on a permittivity 3 substrate the two are 34.6 GHz and 60 GHz.

What the run records

The run steps the cell twice. The first pass removes every material and records the incident wave, and rayrf estimate prints how many steps it takes. The second pass runs the structure. Two planes record the field averaged over the cell: Above, between the source and the structure, and Below, under the structure.

  • S11 is the reflection, (structure - empty) / empty on the plane Above.
  • S21 is the transmission, structure / empty on the plane Below.

Both are referenced to 376.73 Ω, the wave impedance of free space. The run moves them from the recording planes to the structure: S11 is referenced to the top of the stackup, and S21 runs from the top of the stackup to its bottom. The phase of S11 is the reflection phase at the surface of the structure. Under a ground plane nothing reaches the plane Below, so S21 is zero.

The results appear on the S-Parameters tab the way a ported run's do, and every S-parameter export reads them. See S-parameters. The run directory also holds plane_probes.csv and plane_reference.csv, the recorded time series of the structure pass and the empty pass.

The plane average holds the wave that leaves straight up or straight down. Above c / period the cell also scatters into other directions, and S11 and S21 leave that part out.

A plane-wave run absorbs at the top and bottom with a matched damping layer in place of the PML, the same number of cells deep, and the run log states it.

When the run stops

A plane-wave run stops when S11 and S21 have settled, not when the field energy falls. A sharp resonance near the edge of the band holds little energy but still moves the result there, and a mode the incident wave cannot drive holds energy that never reaches the recording planes. At every check the run estimates how much more S11 and S21 can move at each frequency, from how fast their changes are shrinking. It stops once that is under the square root of the ring-down ratio at every frequency on two checks in a row: 0.0032 at Medium, where the ratio is -50 dB. The run log prints each check, and the Energy Ringdown plot draws the estimate as S-param change against the S-param stop threshold. This line is the stop rule of every plane-wave run, not the convergence study.

Each check covers a window of steps at least two periods of the lowest frequency long, and the first one waits until the incident pulse has passed. Measuring how fast the changes shrink takes eight windows. A cell whose changes over the last four windows are all too small to add up to the threshold before the step cap is settled without that rate, so a cell that goes quiet with the pulse stops after four windows instead of eight.

If the run reaches the step cap first, the log names the frequencies where S11 and S21 were still moving, and by how much over the last quarter of the run. The result is truncated there. A cell with a very sharp resonance can need more steps than the cap allows: raise the step cap or narrow the band.

In a cell without loss, below c / period, the waves that leave straight up and straight down carry all the power the incident wave brought. The run log prints |S11|^2 + |S21|^2 with the share the wave polarized the other way carries, and the run warns where |S11|^2 + |S21|^2 departs from 1 by more than 0.01.

The source and recording planes

The source plane sits 1 cell inside the top absorber, the plane Above 1 cell below the source, and the plane Below 1 cell inside the bottom absorber. The (?) beside Set the plane heights gives the height and the mesh line of each, and rayrf estimate prints the same.

Check Set the plane heights to enter the three heights yourself, in stackup z. Each height lands on the nearest mesh line. When that line is not the height you typed, the height it lands on shows beside the value. The planes keep the order bottom absorber, plane Below, structure, plane Above, source, top absorber, each on its own mesh line.

Air above and below

In auto mode the air between the structure and each z absorber is at least one period. A repeating structure holds fields against itself that reach about a period, and an absorber inside them takes energy from them, which changes the result. validate warns when a z spacing you set is under one period.

Seeing reflection and transmission

Turn on field export to see the waves in the Field Viewer. Above the cell the field is the incident wave plus the reflected one, so a unit cell also writes each field quantity with the incident wave removed above the cell. The run takes the incident wave from the empty-cell pass, which is uniform across the period, and subtracts it on every line above the top of the stackup. Select Ex, incident removed (or E magnitude, incident removed) in the Field Viewer's Source list: the field above the cell is then the reflected wave alone, and below the cell the transmitted wave. The empty-cell pass ends once its pulse has left the cell, which is also where S11 and S21 stop counting the incident wave, so later frames have nothing to remove.

Mesh convergence

Perform Convergence Study runs the cell on finer and finer meshes until S11 and S21 stop moving. Criteria sets what has to settle. S-param magnitude, the default, compares |S11| and |S21| at every frequency in the band. A cell over a ground plane reflects all of the wave, so its |S11| stays at 1 and its resonance shows only in the phase: set Criteria to S-param complex for it, which compares the curves as complex numbers. The study warns when every |S| is flat across the band. The largest change allowed is 0.05 at Low, 0.03 at Medium, 0.02 at High and 0.01 at Very High. Each pass logs how far the curves moved and at which frequency. In advanced mode, Compare on the Mesh / Cell Size card sets the same criteria, and Passes in a row set to 2 asks the result to hold over two refinements. See Advanced mode.

Each pass keeps the period: the mesh divides each periodic axis into whole cells at the finer size.

What a plane-wave run refuses

validate and Run Simulation name each of these before the solver starts:

  • a conductor layer with a finite conductivity
  • a port in the same project
  • the radiation pattern
  • CW excitation
  • the S-parameter early stop
  • Periodic on one face of an axis only, or on a z face
  • a side face that is not Periodic, or a z face that is not PML

From the CLI

A spec sets the same fields. This one is a square patch on a dielectric slab, one period of a frequency-selective surface:

{
  "schema": "rayrf-project-spec/v1",
  "domain": {
    "auto_fit": false,
    "x_mm": 0,
    "y_mm": 0,
    "w_mm": 10,
    "h_mm": 10
  },
  "layers": [
    {
      "name": "Patch",
      "type": "conductor"
    },
    {
      "name": "Slab",
      "type": "dielectric",
      "thickness_mm": 1.5,
      "epsilon_r": 4.4
    }
  ],
  "shapes": [
    {
      "kind": "rect",
      "layer": "Patch",
      "x_mm": 5,
      "y_mm": 5,
      "w_mm": 7,
      "h_mm": 7
    },
    {
      "kind": "rect",
      "layer": "Slab",
      "x_mm": 5,
      "y_mm": 5,
      "w_mm": 10,
      "h_mm": 10
    }
  ],
  "settings": {
    "freq_min_hz": 4000000000.0,
    "freq_max_hz": 12000000000.0,
    "bc_all": "Custom",
    "bc_x_lo": "PERIODIC",
    "bc_x_hi": "PERIODIC",
    "bc_y_lo": "PERIODIC",
    "bc_y_hi": "PERIODIC",
    "bc_x_lo_spacing_enabled": true,
    "bc_x_lo_spacing_mm": 0,
    "bc_x_hi_spacing_enabled": true,
    "bc_x_hi_spacing_mm": 0,
    "bc_y_lo_spacing_enabled": true,
    "bc_y_lo_spacing_mm": 0,
    "bc_y_hi_spacing_enabled": true,
    "bc_y_hi_spacing_mm": 0,
    "bc_z_lo": "PML",
    "bc_z_hi": "PML",
    "plane_wave_enabled": true,
    "plane_wave_polarization": "x",
    "enable_nf2ff": false
  }
}
rayrf project build --spec cell.json --out cell.rfsim
rayrf validate --project cell.rfsim
rayrf estimate --project cell.rfsim
rayrf run --project cell.rfsim --export-sparams all --save-after-run

The run takes a few seconds. The patch array is a low-pass surface: S21 is about -1.6 dB at 4 GHz and falls to about -7.2 dB at 12 GHz as the patches reflect more of the wave. The band stops at 12 GHz because this 10 mm cell on permittivity 4.4 carries a wave sideways from 14.3 GHz. rayrf guide unit-cell prints the same example with the setup rules. In the app it opens from File then Examples, as Unit Cell FSS.