<!-- TE10 Studio documentation: /docs/app/tutorial-waveguide -->
# Tutorial: your first simulation

You will model a WR-90 rectangular waveguide (22.86 × 10.16 mm) with a 10 mm PTFE slab inside it,
solve it from 8 to 12 GHz, and look at how much the slab reflects. It takes about 15 minutes, and the
solve itself under a minute on a laptop.

![The finished model, with the electric field plotted](/docs/img/app/main-field-plot.webp)

The finished project is in the examples as `WR90_PTFE_Insert` (**File › Open Examples...**) if you want
to compare.

## 1. Start a project

1. Choose **File › New from Template...**
2. Pick **Waveguide or connector (closed)**. The frequency range is already 8 to 12 GHz.
3. Click **OK**.

The project is in millimetres, its solver is a Driven (frequency-domain) solve, and every outer face of
the model will be a metal wall. In a waveguide those walls are the guide itself.

## 2. Draw the waveguide

1. On the **Geometry** tab, open **Templates** (in the Create group) and choose **WR-90 Waveguide...**
2. Leave the broad side at 22.86 mm and the narrow side at 10.16 mm. Set the **Length** to 60 mm.
3. Click **OK**.

TE10 adds a box of air along Z, centred on the origin and named `WR90_Air`, and a **wave port** on each
end: `WR90Port1` at z = −30 mm and `WR90Port2` at z = +30 mm. Wave ports launch and absorb the guide's own modes, so the solve gives S-parameters
referenced to those ends. You can see both under **Ports & Sources** in the project tree.

![The WR-90 project: the air box with its two ports](/docs/img/app/main-wr90.webp)

## 3. Add the PTFE slab

1. On the **Geometry** tab click **Box** (the first button in the Create gallery).
2. The status bar asks for the first corner of the base. Type it in the **X**, **Y** boxes at the
   bottom right: `-11.43`, <kbd>Tab</kbd>, `-5.08`, and press <kbd>Enter</kbd>. Depending on the
   drawing plane you may also need **Z**: put the base at `-5`.
3. For the opposite corner type `11.43`, `5.08` and press <kbd>Enter</kbd>.
4. For the height type `10` (10 mm, up to z = +5 mm) and press <kbd>Enter</kbd>.

You can also click roughly in the view and fix the numbers afterwards: in the project tree, open the new
box and click its **CreateBox** step. **Properties** shows its position and size, and you can type exact
values (or expressions of [parameters](/docs/app/geometry#parameters-and-expressions)) there.

Then give it a material:

1. Select the box (click it in the view, or in the tree under **Solids**).
2. In **Properties**, rename it `Slab` and set **Material** to `Teflon_PTFE`.

The slab sits wholly inside the air box. Where two objects overlap, the one lying inside the other wins,
so the slab's space is PTFE and the rest stays air. See
[Overlapping objects](/docs/app/geometry#overlapping-objects).

## 4. Set up the solve

Choose **Solver Setup** on the **Simulation** tab (or double-click the setup under **Solver** in the tree).

![Solver setup, General tab](/docs/img/app/dlg-setup.webp)

| Tab | Set | Why |
|---|---|---|
| General | Element order **2**, Processor cores **4** | Order 2 is accurate for most models. Use as many cores as your computer has, up to the number of physical cores |
| Frequency Sweep | Start **8 GHz**, Stop **12 GHz**, Linear Step **0.25 GHz**, Sweep type **Uniform** | 17 points, each solved exactly. For many points, choose **Adaptive** instead |
| Adaptive Meshing | Leave it on | The mesh is refined at the highest frequency, 12 GHz, until the S-parameters change by less than 0.02 between passes |

![Solver setup, Frequency Sweep tab](/docs/img/app/dlg-setup-tab2.webp)

Click **OK**.

## 5. Check and run

1. Click **Check Model** on the quick bar (or the Simulation tab). It checks the geometry, materials,
   boundaries, ports and setup and lists anything that would stop the solve.

   ![Check Model: everything passed](/docs/img/app/dlg-check-model.webp)

2. Click **Run** (or press <kbd>F5</kbd>). **On: This computer** means it runs here.

The **Progress** panel shows the mesh, each adaptive pass with its ΔS, and the frequency sweep. The
**Messages** panel logs what happens.

## 6. Look at the S-parameters

Click **S-Parameters** on the **Results** tab. The **S-Parameters** tab opens next to the Model View. It starts with three plots: **Insertion loss**
(S21), **Return loss** (S11) and **TDR**. Click a plot in the list on the left to show it.

![Return loss of the PTFE slab](/docs/img/app/sparams-plot2.webp)

The slab reflects most near 8 GHz. Near 11.2 GHz, the slab is half a guided wavelength thick, the
reflections from its two faces cancel, and S11 drops below −40 dB. Click **Marker** above the plot and
click the curve to read exact values. See [S-parameter plots](/docs/app/results#s-parameters).

## 7. Plot the field

1. Go back to the **Model View** tab.
2. On the **Results** tab, open **Field Plot ▾** and choose **E Magnitude...**
3. Pick the surfaces to plot on (the default is every model surface), the frequency and the phase, and
   click **OK**.

The field shows the standing wave in front of the slab and the travelling wave behind it. Change the
phase in the plot's properties to animate it by hand, or right-click the plot under **Field Plots** in the
tree for its commands. See [Fields](/docs/app/results#field-plots).

## 8. Save

Press <kbd>Ctrl</kbd>+<kbd>S</kbd>. The project is saved as a `.te10` file with its results in a
`.te10results` folder beside it.

## Next steps

- Change the slab thickness: open **Edit › Parameters › Parameters...**, add a parameter `t = 10mm`, type
  `t` as the slab's height, then try a [Parameter Sweep](/docs/app/solving#parameter-sweeps) over `t`.
- Build the same model in Python: see the [Scripting API quick start](/docs/api/quickstart).
- Draw a [microstrip line](/docs/app/rf-tools) with the built-in RF tools.
