# Recommended Configuration

Channel: development; package: 2.0.0rc1; source: 2c32b7cf79b796fae825bfa08fc73d9914e61723

Page: https://remilab.ai/rfx/validation/recommended-configuration/
Source: https://github.com/bk-squared/rfx/blob/2c32b7cf79b796fae825bfa08fc73d9914e61723/docs/public/validation/recommended-configuration.mdx

Use this page to choose a starting setup and the right calculator for your
port. Each calculator has its own limits, listed here. What you must check
before reporting any result is on
[Cross-Validation and Accuracy](https://remilab.ai/rfx/guide/validation/).

## Start here

For ordinary RF work, start from the **uniform Cartesian Yee** grid:

- `boundary="cpml"` for open problems and `"pec"` for closed ones;
- point sources, and the port family that matches your structure;
- probes, flux monitors, Harminv resonances, the port calculators below and
  the documented far-field workflows.

This is the configuration with the broadest evidence. A graded mesh, the ADI
solver and multi-device runs each carry narrower limits, listed below and in
[Support Boundaries](https://remilab.ai/rfx/support/).

## Pick the calculator for your port

A port calculator only works for its own port family. Do not substitute one
for another.

| Port | Calculator | Start from | Limits |
|---|---|---|---|
| Lumped or wire `add_port(...)` | `run(compute_s_params=True)`, or `forward(port_s11_freqs=...)` for a differentiable `S11` | about 60 cells per wavelength at the highest frequency | A discrete feed across one gap, not a modal line port. V is read at the port node and I half a cell toward the line, so a two-port `S21` phase is referenced to the port separation less half a cell. Lumped and wire ports return the same `S11`. |
| Microstrip `add_msl_port(...)` | `compute_msl_s_matrix(...)` | at least 4 cells through the substrate (preflight warns below that) | Returns the raw extracted `S`; read `sigma_max_excess` for any passivity breach, or pass `enforce_passivity=True` to project it. Check `probe_clearance` for the probe layout and `settling_db` for the record length. |
| Rectangular waveguide `add_waveguide_port(...)` | `compute_waveguide_s_matrix(...)` | the documented rectangular-guide modes and bands | Single-mode magnitudes have the broadest evidence; phase, junctions, multimode and graded meshes have less. Only `normalize=False` and `normalize="flux"` carry a gradient. |
| Coaxial `add_coaxial_port(...)` | `compute_coaxial_line_reflection(...)` for one port, `compute_coaxial_two_port(...)` for a through line | at least 4 cells across the annulus | Exactly one coaxial port with `face="top"`, `precision="float32"`, a uniform 3-D grid and CPML on all six faces. The calculator builds its own line, source and probes; it is not a general coaxial-network solver. |

Field sources, plane waves, probes, DFT planes and flux monitors have no port
impedance or reference plane. They give fields and power, not S-parameters.

## End a line with its port

A transmission line should end at a port that absorbs it, not in the CPML.
Name the conductor a port ends with `terminates=` on `add_port`,
`add_msl_port` or `add_coaxial_port`; a microstrip port ends the strip under
it by default. The CPML terminates a guided line much less well than a plane
wave. Preflight names any
conductor that runs into the absorber unterminated.

## Non-default configurations

| Configuration | What to know |
|---|---|
| Graded (non-uniform) mesh | Check the limit for each source, port and observable in [Non-Uniform Mesh](https://remilab.ai/rfx/model/domain-mesh/). A plane wave along a graded axis leaks into the scattered-field region (preflight warns); normal incidence along x needs a uniform x axis. `add_refinement` is refused on a graded mesh. |
| Local refinement, `add_refinement` | Takes effect only through `run()` on a uniform mesh. `forward()`, `optimize()`, `topology_optimize()` and the S-parameter calculators refuse a refined model. |
| Multi-device, `run(devices=[...])` | Uses the shard_map runner with `exchange_interval=1`. Lumped RLC elements, MSL ports, refinements, Kerr materials and DFT planes are refused. |
| Differentiable design | The objective is a proxy. Check the final design with a converged forward run of the RF quantity you report. |

When a run argument is not implemented on the path your model takes (for
example `until_decay`, snapshots or conformal walls on some paths), `run()`
raises before the first step. Change the argument or the configuration; the
message names both.

## Limits

- **A completed run is not a validated one.** No warning does not mean
  converged, passive or correctly referenced. Work through the checklist on
  [Cross-Validation and Accuracy](https://remilab.ai/rfx/guide/validation/).
- **Examples and tests cover their own setup.** A committed test pins
  behaviour at its own mesh, band and configuration.
- **Coaxial results computed before the lanes absorbed on all three axes**
  (`cpml_axes="z"`, now refused) came from a line in a closed metal can and do
  not reproduce.
