Geometry should stay explicit in public examples. The documented API includes the shapes and named materials below. An available constructor alone does not establish RF accuracy; pair it with a configuration listed in Recommended Configuration and Support Boundaries.
Shapes
| Shape | Signature | Typical use |
|---|---|---|
Box | Box(corner_lo, corner_hi) | substrates, ground planes, patch metal, dielectric blocks |
Sphere | Sphere(center, radius) | resonators, scatterers, simple inclusions |
Cylinder | Cylinder(center, radius, height, axis="z") | vias, posts, cylindrical inclusions |
PolylineWire | polyline-defined wire geometry | wire-like studies and routed conductors |
Via | Via(center=..., drill_radius=..., pad_radius=..., layers=..., material="pec") | PCB-style interconnects |
CurvedPatch | CurvedPatch(center=..., length=..., width=..., radius=..., axis="x") | curved-conductor studies; constructor arguments are keyword-only |
MeshShape | MeshShape.from_file(path, scale=..., translate=(0,0,0)) | CAD import — STL/OBJ/PLY, plus STEP/STP via the cad extra. Rasterizes host-side (trimesh containment): NOT differentiable — a traced coordinate raises, so CAD geometry cannot carry gradients |
Material registration
Setup used by the snippets below:
from rfx import Simulation
sim = Simulation( freq_max=5e9, domain=(0.04, 0.03, 0.02), dx=2e-3, boundary="cpml", cpml_layers=6,)from rfx import DebyePole, LorentzPole
sim.add_material("fr4", eps_r=4.3, sigma=0.02)sim.add_material("resistive_medium", sigma=5.0e5)sim.add_material( "custom_dielectric", eps_r=6.0, debye_poles=[DebyePole(delta_eps=12.0, tau=9.4e-12)],)Material arguments
| Argument | Meaning | Notes |
|---|---|---|
eps_r | relative permittivity | default is 1.0 |
sigma | conductivity | lossy dielectrics and below-threshold conductors; sigma >= 1e6 S/m is represented by the PEC mask |
mu_r | relative permeability | default is 1.0 |
debye_poles | dispersive Debye terms | DebyePole(delta_eps, tau) |
lorentz_poles | dispersive Lorentz terms | LorentzPole(omega_0, delta, kappa) |
chi3 | third-order nonlinearity | specialized nonlinear-material workflows |
Materials such as the built-in "copper" and "aluminum" have conductivity
above the 1e6 S/m threshold and therefore behave as PEC in the compiled grid;
their bulk skin depth and ohmic loss are not resolved. Use
add_thin_conductor(...) when a subcell sheet model is appropriate. That helper
also maps sigma_bulk >= 1e6 S/m (including its default copper value) to PEC;
a finite sheet resistance requires an explicitly justified
sigma_bulk < 1e6 S/m. Use a below-threshold volumetric conductivity only when
its cells and loss model match the intended physical approximation.
Configuration limits
Geometry and materials are covered only when paired with a documented boundary, source or port, mesh, and observable combination. Check Support Boundaries before reporting RF accuracy for a structure that uses a limited configuration.
Two current opt-in conductor realizations have narrower contracts:
add(shape, material="pec", two_plane=True)is hard-PEC-only and face-registers a one-cell PEC body on both node planes. A non-PEC material raisesValueError. It is supported only on the uniformrun()/forward()scan and the single-device non-uniform runner.add_thin_conductor(shape, surface_impedance_f0=...)applies a band-centre Leontovich sheet resistance to any rasterizable patterned shape that occupies exactly one cell layer and at least one cell. Unsupported solver, boundary, overlap, and port-family combinations fail explicitly.
