Skip to content

Mesh regions

A mesh region is a span of one axis with its own cell size, used to refine selected areas and coarsen the surrounding mesh. RayRF reports cell count, time step, and estimated memory before the run.

Two ways to grade a mesh

The Mesh strategy control on the Simulate tab selects either Ratio grading or Custom profile for the project.

  • Ratio grading is the default and needs no drawing. You give a per-axis refinement multiplier for the board region and a maximum cell-to-cell ratio for the transition out to the air, and RayRF builds the regions for you.
  • Custom profile is the drawn mesh. You place mesh lines by hand in Mesh View, give each span between them a multiplier, and RayRF realizes exactly what you drew.

Use Ratio grading when the geometry is one board and the interesting fields are on it. Use a Custom profile when you know where the fine cells belong: a coupled edge, a narrow gap, a via barrel, the layers of a stack that differ by an order of magnitude in thickness.

Ratio grading

The Mesh / Cell Size card in Advanced mode carries the whole control set. In Auto mode the Quality & Geometry card has the Mesh strategy selector only.

  • Refine margin (mesh_grading_margin_mm, default 1.0): how far the fine-cell region extends past the board in every direction.
  • Per-axis multiplier (mesh_grading_x_mult, _y_mult, _z_mult, default 1.0): the board-region refinement factor. 1.0 means no refinement, so a fresh project is uniform until you raise one.
  • Per-axis maximum ratio (mesh_grading_x_max_ratio, _y_max_ratio, _z_max_ratio, default 1.3): the largest step in cell size allowed between neighboring cells in that axis' transition. It must exceed 1.0 or no transition can satisfy it.

The max-ratio row for an axis, and the refine margin, appear once at least one axis carries a multiplier above 1.0. An axis at 1.0 has no transition, so its ratio has nothing to bound.

Custom profiles and Mesh View

Mesh View overlays the Custom profile on the geometry in the Edit tab. Open it from either location:

  • Open Mesh View on either Simulate mode card, shown while the Custom profile is the selected strategy, because Mesh View edits the Custom profile and nothing else.
  • Mesh View under the layer list in the Edit tab's Stackup section. If Ratio grading is selected, confirm the switch to Custom profile to continue.

Inside Mesh View you work on the two rails at the edges of the viewport. Click a rail to place a mesh line, drag a line to move it, and click the badge on a span to set that span's multiplier. A line can be constrained to a primitive, and then it follows when the primitive moves, in the editor and through the CLI alike: right-click the pin for Constrain, or arm Vertical, Horizontal, Dimension, or Fix from the Constraints panel and click the pin, on its rail or anywhere along its line, as one of the participants.

The Mesh Controls section is where Z lives. While Mesh View is on it takes the place of the layer list in the left panel: it holds the stackup drawn against its realized mesh lines, the per-layer multipliers in physical order from the air above the stack to the air below it, the per-axis max ratios, and a boundary row for every face. Clicking a layer bar selects that layer, dragging a bar reorders the stack, and New Layer and Delete Selected sit under the bars. Right-click a layer bar for the usual layer actions, double-click to rename it, or press Del while the bar is selected to remove it. Click inside its multiplier box to edit the multiplier. Dielectric and air-gap layer multipliers both affect the realized Z mesh and cell count. A boundary label in the viewport opens the same type and spacing fields on a double-click. The free-space rows and the dielectric rows report the cells the mesh actually realized, and a boundary edited here is the same setting the Simulate tab's Boundary Condition matrix edits. A spacing left blank on a checked face turns its box red. The footer button returns to the mesh card on the Simulate tab. When the profile cannot be realized, the last mesh that could stays on screen, the reason sits in red under the cell readout, and the pin or multiplier it names is painted red. A clicked pin deletes with Del or Backspace.

What the numbers mean

The Mesh View heads-up display shows four facts, and rayrf mesh explain prints them:

grid           : 104 x 104 x 27 = 292,032 cells
cell range     : 0.304 mm minimum, driven by X region 0
timestep       : 6.02592683e-13 s
memory         : 0.36 GB VRAM, 0.11 GB RAM

Both Simulate mode cards show the grid, the cell count, and the memory for the selected backend.

The grid, the cell count, and the time step are exact. They are not a forecast of the mesh: they are the mesh, generated by the same code the exporter runs, so the number on the card is the number the solver receives. mesh diff proves it by comparing a project against the case that was exported from it.

Memory is the one number that is not exact. It starts from the exact padded grid and adds mesh storage, the CPML shell, whatever captures the run requested, a fixed allowance, and headroom, because allocator behavior is not one fixed count.

The cell range names which region owns the smallest cell, which is the region that sets the time step. Halving one span's cells doubles the run length of the entire simulation, so know which span you are paying for.

Where to put a mesh line

Every pin becomes a mesh line, so pinning a feature edge is how you make the solver see that edge exactly where you drew it. Pin freely for that.

What matters is where the cell size *changes*. A pin between two regions with the same multiplier is only a line, and putting it on a conductor edge is fine. A pin between two different multipliers is a transition, and a transition sitting on a conductor edge biases the result, because the cells on one side of that edge are a different size from the cells on the other. RayRF warns when a primitive edge lands within half a local cell of a multiplier change, and names the primitive and the position. The fix is to extend the fine region past the feature so the step happens in empty space.

The maximum ratio is a maximum

RayRF grades each transition at or below the configured maximum cell-to-cell ratio. If a region is too short, the run is refused with the axis, region, and reason. When a higher ratio would fit, the error gives that ratio. Increase the maximum to the reported ratio, widen the region, or adjust its multiplier to reduce the cell-size change.

Refusals appear in the Notices tab beside the console in the desktop app, and on stdout from validate and run.

From the CLI

The whole feature is authorable and inspectable headless. Mesh lines, multipliers, and constraints are part of the project spec, so project build and project export-spec round-trip them like any other authored content.

rayrf mesh explain --project patch.rfsim              regions, cost, timestep owner
rayrf mesh lines --project patch.rfsim --axis z       the exact line positions
rayrf mesh diff --project patch.rfsim --against DIR   project against exported case
rayrf estimate --project patch.rfsim --json           exact cells, memory

mesh explain reports every region on every axis with its span, multiplier, target cell size, realized minimum and maximum cell, and cell count, so a profile can be checked without opening the desktop app. mesh diff tolerates only serialization-scale drift, so it answers whether two meshes are the same mesh rather than whether they look similar.

Mesh regions and convergence

A convergence study refines the mesh each pass and re-solves until the S-parameters stop moving. It starts from the mesh you built, Ratio or Custom, so a profile is the starting resolution rather than something the study replaces. See Advanced mode for the study controls.