magnelio.ports#

Ports — declarative port classes, specs, conductors and reports. PortWaveguide, PortAnalytical and PortLumped are declared on the GeometryModel before meshing; the PortSpec* family covers custom setups passed to an analysis via ports=. The builders and runtime operators behind them are internal.

class magnelio.ports.BboxLateralConductor#

All four lateral bbox-wall nodes — the typical outer conductor.

For a port plane on (say) X_MIN, the lateral walls are the four bbox faces whose normal axis is tangential to the port plane (i.e. Y_MIN, Y_MAX, Z_MIN, Z_MAX). All primal 2D nodes that sit on any of these walls are taken to belong to this conductor — i.e. all nodes with i_u {0, Nu_node−1} or i_v {0, Nv_node−1}.

Useful for rectangular coax (the bbox itself acts as the outer conductor) and any other “outer = bbox boundary” topology.

class magnelio.ports.ExcitationSpec(f_min, f_max, mode_index=0, waveform='modulated_gaussian')#

Soft-source description for a modal port.

Parameters:
  • f_min (float) – Lower / upper passband edges [Hz]. f_max doubles as the Gaussian-pulse bandwidth when waveform == "gaussian".

  • f_max (float) – Lower / upper passband edges [Hz]. f_max doubles as the Gaussian-pulse bandwidth when waveform == "gaussian".

  • mode_index (int, default 0) – Index of the mode to drive (in the spec’s n_modes list).

  • waveform ({"modulated_gaussian", "gaussian"}, default "modulated_gaussian") – modulated_gaussian for band-limited TE/TM excitation; gaussian for DC-inclusive TEM excitation.

class magnelio.ports.Mode(name, mode_type, omega_c, epsilon_r, field_evaluator, z_line=None, discrete_e_u_profile=None, discrete_e_v_profile=None, discrete_h_u_profile=None, discrete_h_v_profile=None)#

A single waveguide eigenmode with closed-form frequency dependence.

A Mode carries its transverse field information in one of two mutually exclusive forms:

  • Analytical (Phase 1)field_evaluator is set to a closure that samples the Poynting-normalised profile at any (u, v) point. All four discrete_*_profile fields are None. Used by CoaxAnalyticalModeSolver and RectWGAnalyticalModeSolver; resampled and B-orthonormalised onto the FIT grid by discretize_modes().

  • Numerical (Phase 2) — all four discrete_*_profile arrays are set to M_ε-orthonormal edge vectors built natively on the port-plane FIT grid; field_evaluator is None. Used by Numerical2DModeSolver; discretize_modes() passes these through unchanged (no resampling, no Gram-Schmidt).

The validity invariant is enforced at construction.

Parameters:
  • name (str) – Human-readable mode identifier, e.g. "TEM" or "TE10".

  • mode_type (ModeType) – Mode classification. Drives the formulas for z_wave and gamma.

  • omega_c (float) – Cut-off angular frequency [rad/s]. Zero for TEM.

  • epsilon_r (float) – Relative permittivity of the (homogeneous) cross-section filling. Required by the wave-impedance and propagation- constant relations.

  • field_evaluator (FieldEvaluator or None) – Analytical-path closure that returns the Poynting-normalised transverse field profile at user-supplied (u, v) sample points. None on the numerical path.

  • z_line (float or None, default None) – Frequency-independent line impedance Z₀ = 2P/I·I* for multi-conductor ports (TEM/QTEM). None for hollow-pipe modes where no inner-conductor current is available. z_modal() returns this value when set; otherwise falls back to z_wave(omega).

  • discrete_e_u_profile (np.ndarray or None, default None) – Numerical-path E_u profile, sampled at the port-plane u-edge midpoints. Shape (N_u,). M_ε-orthonormal by construction.

  • discrete_e_v_profile (np.ndarray or None, default None) – Numerical-path E_v profile, shape (N_v,).

  • discrete_h_u_profile (np.ndarray or None, default None) – Numerical-path H_u profile co-located with v-edges, shape (N_v,).

  • discrete_h_v_profile (np.ndarray or None, default None) – Numerical-path H_v profile co-located with u-edges, shape (N_u,).

Notes

The Phase-1 architecture assumes a homogeneously filled cross- section (single epsilon_r). Phase 2 (QTEM) will extend this to a frequency-dependent effective permittivity.

gamma(omega)#

Propagation constant γ = α + at angular frequency omega.

Above cut-off, the mode is propagating and γ = j β. Below cut-off it is evanescent and γ = α (real).

Parameters:

omega (float) – Angular frequency [rad/s].

Return type:

complex

z_modal(omega)#

Reference impedance for power-wave decomposition.

For multi-conductor modes (TEM/QTEM with z_line set), returns the line impedance Z₀ = 2P/I·I*. For hollow-pipe modes, falls back to z_wave(omega).

This is the impedance to use in V_m^± = (V_m ± Z_modal · I_m) / 2 for the modal-load absorption update.

Parameters:

omega (float) – Angular frequency [rad/s].

Return type:

complex

z_wave(omega)#

Modal wave impedance at angular frequency omega.

  • TEM: Z = η₀ / √ε_r (frequency-independent).

  • TE: Z = j ω μ / γ (real positive above cut-off, reactive below).

  • TM: Z = γ / (j ω ε) (real positive above cut-off, reactive below).

Parameters:

omega (float) – Angular frequency [rad/s]. Must be > 0.

Return type:

complex

class magnelio.ports.ModeRefinementReport(target, history, converged, target_rel_err, extrapolated_value=None, convergence_order=None)#

Refinement convergence history + extrapolated converged value.

The report is purely diagnostic; it carries no operator-bound state. The values stored here are computed on independent 3D meshes (each level rebuilds the mesh) and must not be used to drive the user’s working PortOperatorModal, which remains bound to its own 3D mesh.

Parameters:
  • target (str)

  • history (tuple[LevelResult, ...])

  • converged (bool)

  • target_rel_err (float)

  • extrapolated_value (float | None)

  • convergence_order (float | None)

target#

Name of the convergence target (e.g. "z_line").

Type:

str

history#

Per-level results in refinement order (level 0 first).

Type:

tuple of LevelResult

converged#

True if the last rel_change fell below target_rel_err before max_levels was reached.

Type:

bool

target_rel_err#

The user’s requested relative-error threshold.

Type:

float

extrapolated_value#

Richardson-extrapolated value computed from the last two levels assuming O(h²) convergence: (4 · v_{h/2} - v_h) / 3. None if extrapolation was disabled or fewer than two levels were run.

Type:

float or None

convergence_order#

Empirical convergence order from the last three levels, log2(|Δ_{k-1}| / |Δ_k|) with Δ_k = v_k - v_{k-1}. Should match the expected O(h²) ≈ 2.0 for Dey-Mittra- refined geometries; lower values typically indicate Cartesian-staircase-dominated convergence (≈ 1) or a pathological setup. None if fewer than three levels.

Type:

float or None

property converged_value: float#

Best estimate of the converged value.

Returns the Richardson-extrapolated value when available, otherwise the last level’s value.

property estimated_error: float#

Conservative relative-error estimate for converged_value.

Equal to the last rel_change in history. When Richardson extrapolation is used, the actual error of extrapolated_value is typically smaller than this estimate — it is intentionally conservative.

class magnelio.ports.ModeReport(port_name, name, mode_type, f_cutoff, z_line, _discrete, _plane, _mirrors=(), _h_dual_lengths=())#

One solved port mode, inspectable without a TD run.

Parameters:
  • port_name (str)

  • name (str)

  • mode_type (ModeType)

  • f_cutoff (float)

  • z_line (float | None)

  • _discrete (DiscreteMode)

  • _plane (PortPlane)

  • _mirrors (tuple)

  • _h_dual_lengths (tuple)

port_name#

Label of the port the mode belongs to.

Type:

str

name#

Mode identifier from the 2D solver (e.g. "TE10", "TEM_lap00").

Type:

str

mode_type#

TEM / TE / TM classification.

Type:

ModeType

f_cutoff#

Cut-off frequency [Hz]; 0.0 for TEM modes.

Type:

float

z_line#

Frequency-independent line impedance Z₀ = 2P/(I·I*) for multi-conductor (TEM/QTEM) modes; None for hollow-pipe modes, whose reference impedance is the frequency-dependent wave impedance (use z_modal()).

Type:

float or None

gamma(f)#

Propagation constant γ = α + at frequency f [Hz].

Parameters:

f (float)

Return type:

complex

plot(*, field='E', ax=None, density=20, normalize_arrows=True, threshold=0.0, flip=False, scale_mm=True, title=None, geometry=None)#

Quiver plot of the transverse mode profile on the port plane.

The discrete edge profiles (the B-orthonormal basis vectors the FIT operator actually injects and projects with) are averaged from their staggered edge positions onto the port-plane cell centres and rendered via plot_field_vector().

Parameters:
  • field ({"E", "H"}, default "E") – Which transverse field profile to draw.

  • ax (matplotlib.axes.Axes, optional) – Target axes; a new figure is created when omitted.

  • density (int, default 20) – Number of arrows along the longer axis of the cross-section; the shorter one gets the count that keeps the spacing equal. The raster is deliberately independent of the computational grid, so a locally refined region does not show up as a cluster of arrows — but it also does not gain any. Raise this to read a feature that the default spacing steps over, such as the field in a thin gap.

  • normalize_arrows (bool, default True) – Unit-length arrows with magnitude encoded in colour (port-mode style).

  • threshold (float, default 0.0) – Suppress arrows below this fraction of the peak magnitude.

  • flip (bool, default False) – Swap the horizontal and vertical plot axes.

  • scale_mm (bool, default True) – Axis coordinates in mm instead of m.

  • title (str, optional) – Axes title; default names port, mode, and field.

  • geometry (GeometryModel, optional) – Geometry model for a cross-section overlay of the port plane (conductors filled, air regions as dashed outlines).

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

tuple[‘matplotlib.figure.Figure’, ‘matplotlib.axes.Axes’]

z_modal(f)#

Power-wave reference impedance at frequency f [Hz].

Parameters:

f (float)

Return type:

complex

z_wave(f)#

Modal wave impedance at frequency f [Hz].

Parameters:

f (float)

Return type:

complex

class magnelio.ports.ModeType(value)#

Mode classification for homogeneously-filled waveguides.

class magnelio.ports.PortAnalytical(name, plane, family='coax', inner_radius=None, outer_radius=None, width=None, height=None, epsilon_r=1.0, center=(0.0, 0.0, 0.0), n_modes=1)#

Declarative port with a closed-form analytical reference mode.

Parameters:
  • name (str) – Unique port name.

  • plane (BoxFace or str) – Bbox face the port lives on.

  • family ({"coax", "rect_wg"}) – Which analytical family describes the cross-section.

  • inner_radius (float, optional) – Coax conductor radii [m] (required for family="coax").

  • outer_radius (float, optional) – Coax conductor radii [m] (required for family="coax").

  • width (float, optional) – Rectangular-waveguide cross-section [m] (required for family="rect_wg"); width is the (usually broader) dimension along the lower-numbered global tangential axis.

  • height (float, optional) – Rectangular-waveguide cross-section [m] (required for family="rect_wg"); width is the (usually broader) dimension along the lower-numbered global tangential axis.

  • epsilon_r (float, default 1.0) – Relative permittivity of the (homogeneous) filling.

  • center (tuple of float, default (0.0, 0.0, 0.0)) – Cross-section anchor as an (x, y, z) world-coordinate point [m] — the coax axis, or the lower-left corner of the rectangle. The component along the face’s normal axis is fixed by plane already and is ignored (None is fine there).

  • n_modes (int, default 1) – Number of modes.

class magnelio.ports.PortLumped(name, start, end, Z0=50.0, element=None)#

Declarative lumped port on a straight interior edge path.

The high-level spelling of the lumped Thévenin port: two endpoints and a reference impedance, optionally backed by an RLC companion element. Resolved into a PortSpecLumped by the analysis.

Parameters:
  • name (str) – Unique port name.

  • start (tuple of float) – Endpoints in metres; must differ along exactly one Cartesian axis after grid snapping. Under a clipping symmetry declaration the endpoints stay in full-model coordinates — a port whose chain crosses an electric symmetry plane is clipped to the meshed half automatically.

  • end (tuple of float) – Endpoints in metres; must differ along exactly one Cartesian axis after grid snapping. Under a clipping symmetry declaration the endpoints stay in full-model coordinates — a port whose chain crosses an electric symmetry plane is clipped to the meshed half automatically.

  • Z0 (float, default 50.0) – Power-wave reference impedance [Ω]; without element also the internal Thévenin impedance. Always the full-model value: under symmetry the solver internally halves or doubles it, and every reported quantity stays full-model.

  • element (SeriesRLC or ParallelRLC, optional) – Companion element replacing the pure resistor as the port’s internal impedance. Also declared with full-model values.

class magnelio.ports.PortOperatorReport(z_line_num: 'Optional[float]' = None, z_line_ref: 'Optional[float]' = None, cutoff_num: 'Optional[float]' = None, cutoff_ref: 'Optional[float]' = None, refinement_log: "'Optional[ModeRefinementReport]'" = None, symmetry_faces: 'tuple' = ())#
Parameters:
  • z_line_num (Optional[float])

  • z_line_ref (Optional[float])

  • cutoff_num (Optional[float])

  • cutoff_ref (Optional[float])

  • refinement_log (Optional[ModeRefinementReport])

  • symmetry_faces (tuple)

property power_wave_full_scale: float#

Half-window → full-model scale for modal wave amplitudes.

The port modes are power-normalised on the half window, so a recorded amplitude of 1 √W accounts for the power crossing the meshed half only; the mirror half carries the same power again. Each cutting symmetry plane therefore scales the full-model wave amplitude by √2 (and the excitation by 1/√2 so that a declared injected power is a full-model watt).

property z_line_full_scale: float#

Half-window → full-model scale for the line impedance.

Each cutting magnetic symmetry plane halves the window and its capacitance, so the two halves sit in parallel (z_full = z_half / 2); an electric symmetry plane puts them in series (z_full = 2 · z_half).

class magnelio.ports.PortReport(name, modes, report=None)#

Per-port mode-solution report (no TD run required).

Parameters:
name#

Port label.

Type:

str

modes#

One entry per solved mode, in cut-off-ascending solver order (the same indexing as excited=[(port, mode_idx)]). Empty for lumped ports.

Type:

tuple[ModeReport, …]

report#

The two-path scalar summary attached by build_modal_port(); exposes z_line_num / z_line_ref / cutoff_num / cutoff_ref. For lumped ports a synthetic report carrying z_line_num = Z0.

Type:

PortOperatorReport or None

classmethod from_operator(op, mesh=None)#

Build a report from a built port operator.

Modal operators contribute one ModeReport per discrete_modes entry; lumped operators (no mode solve) yield an empty mode tuple and a synthetic PortOperatorReport with z_line_num = Z0.

Passing the mesh lets the mode plots resolve the symmetry planes cutting the port window, so they show the full cross-section instead of the solved half; without it they show the solved window.

Return type:

PortReport

summary()#

Multi-line human-readable summary (used by str()).

Return type:

str

class magnelio.ports.PortSpecCoax(name, plane, inner_radius, outer_radius, epsilon_r=1.0, center=(0.0, 0.0), n_modes=1, excitation=None)#

Coaxial-line modal port (TEM, Phase 1).

Parameters:
  • name (str) – Port label, used by the recorder and S-parameter post-processing.

  • plane (BoxFace) – Bbox face on which the port lives.

  • inner_radius (float) – Inner and outer conductor radii [m].

  • outer_radius (float) – Inner and outer conductor radii [m].

  • epsilon_r (float, default 1.0) – Relative permittivity of the dielectric.

  • center (tuple[float, float], default (0.0, 0.0)) – Coax-axis location in the global tangential frame (lower-axis first). See module docstring for the convention.

  • n_modes (int, default 1) – Phase 1 supports only n_modes = 1 (TEM).

  • excitation (ExcitationSpec or None) – If given, the port is a soft source. Otherwise it is an absorber-only modal Mur-1st port.

class magnelio.ports.PortSpecLumped(name, start, end, Z0=50.0, element=None)#

Declarative description of a lumped discrete port / RLC element.

Parameters:
  • name (str) – Unique port identifier (used as recorder channel key).

  • start (tuple[float, float, float]) – Endpoints in metres. The two points must differ along exactly one Cartesian axis after grid snapping. Under a clipping symmetry declaration they stay in full-model coordinates; Z0 / element are full-model values throughout, and the builder derives the internally scaled half-model device.

  • end (tuple[float, float, float]) – Endpoints in metres. The two points must differ along exactly one Cartesian axis after grid snapping. Under a clipping symmetry declaration they stay in full-model coordinates; Z0 / element are full-model values throughout, and the builder derives the internally scaled half-model device.

  • Z0 (float) – Power-wave reference impedance [Ω] (default 50 Ω). Without an element it is also the internal Thévenin impedance — the classic discrete port.

  • element (SeriesRLC or ParallelRLC, optional) – Trapezoidal companion element replacing the pure resistor as the port’s internal impedance: an excited port becomes an RLC-backed source, an unexcited one a passive lumped RLC load. None (default) means SeriesRLC(R=Z0) — the behaviour-identical classic port. The element instance is deep-copied per run, so its transient state never leaks between excitations.

class magnelio.ports.PortSpecMultiConductor(name, plane, conductors=None, epsilon_r=None, n_modes=1, excitation=None, window=None)#

Multi-conductor numerical port spec (Phase 2b/c factory cleanup).

Drives the TEM Laplace path (solve_tem_laplace(), when epsilon_r is set) or the QTEM dual-Laplace path (solve_qtem_laplace(), when epsilon_r is None — the factory builds the vacuum reference mass via build_M_eps_vacuum()). Returns the K 1 line modes (K conductor groups), one per signal conductor in input order.

Unified multi-mode port (WP-U2/WP-U6). On a homogeneous scalar filling (epsilon_r set), n_modes > K 1 extends the port by the lowest TE/TM curl-curl modes of the same cross-section, merged by ascending cut-off (TEM channels first, f_c = 0) — the exact continuum decomposition TEM ⊕ TE ⊕ TM; the discrete family cross-orthogonality is at solver tolerance (WP-U1). On an inhomogeneous cross-section (epsilon_r=None, QTEM) no exact family split exists — the higher channels are the true hybrid eigenpairs of the ζ-pencil at f_calc: profiles exact at f_calc, dual-basis projections (the hybrids are not M_ε-orthogonal), termination per the standard defaults (certificates fail on inhomogeneous fillings → modal Mur-1st, loud notice; port_model="band" stays the reflection-critical opt-in for the tracked family). Mode labels stay family-explicit (TEM_lap00, TE_num00, QTEM_lap00, HYB_zp00, …).

Parameters:
  • name (str) – Port label.

  • plane (BoxFace) – Bbox face on which the port lives.

  • conductors (tuple[ConductorSpec, ...] or None, default None) – [ground, signal_1, signal_2, ...] — at least 2 entries when given. conductors[0] is the gauge reference (φ = 0); each subsequent entry spawns one TEM/QTEM mode in input order. When None, the conductor groups are auto-derived from the mesh PEC mask on the port plane via extract_conductor_groups_from_mesh() — useful for OCC geometries (cylinders, arbitrary curved cross-sections) where the declarative ConductorSpec list is awkward.

  • epsilon_r (float or None, default None) – Homogeneous-filling permittivity for the TEM path. If None, the QTEM dispatch is selected: the factory constructs the vacuum-reference mass matrix (build_M_eps_vacuum()) so the dual-Laplace solver can extract ε_eff = C' / C'_0.

  • n_modes (int, default 1) – Number of returned modes. Up to K 1 these are the TEM (or QTEM) line modes; beyond that the port is extended by TE/TM curl-curl modes (homogeneous filling) or ζ-pencil hybrid modes (inhomogeneous filling) — see the class docstring. The QTEM extension requires the requested modes to propagate at f_calc and raises with guidance otherwise.

  • excitation (ExcitationSpec or None, default None) – Soft-source spec; None for an absorber-only port.

  • window (tuple of two corner points, optional) – Sub-rectangle of the face as two opposite corners in global tangential-axis ordering (PortPlane.from_mesh() convention). None (default) covers the whole face. A PEC window boundary (via the legacy edge rule) joins the conductor-group graph as a boundary ring, so it can act as the ground conductor of an embedded port.

Notes

Conductor groups are auto-deduplicated in input order: nodes that belong to an earlier group are removed from later groups. This matches the “ground first wins” semantic — a node on the ground plane is at φ = 0 even if a signal conductor’s region spec nominally covers it.

class magnelio.ports.PortSpecNumerical(name, plane, n_modes=1, epsilon_r=1.0, mode_type=None, excitation=None, window=None)#

Numerical-mode-solver port for hollow homogeneously-filled cross-sections.

Drives the numerical 2D curl-curl / node-Laplace eigenvalue solver (Numerical2DModeSolver) for hollow waveguides whose cross-section has no analytical closed form (ridged, double-ridged, elliptical, circular with PEC bbox padding, …) or where a FIT-grid-native mode is preferred over an analytical projection.

Scope: TE/TM modes on a hollow, homogeneously-filled cross-section. Multi-conductor TEM and inhomogeneous QTEM are served by PortSpecMultiConductor.

PEC walls are read from mesh.pec_mask_edges — the canonical 3D-mesh source. Production setups define the wall geometry via Mesh.from_geometry() (OCC-meshed PEC body) or Mesh.with_pec_boundaries() (BC-consolidated bbox faces); both populate mesh.pec_mask_edges automatically. For bare Mesh.from_grid setups without either, the factory falls back to the standard hollow-waveguide assumption (all four lateral bbox faces are PEC walls).

Parameters:
  • name (str) – Port label.

  • plane (BoxFace) – Bbox face on which the port lives.

  • n_modes (int, default 1) – Number of modes returned by the eigsh solver, ordered by ascending cut-off frequency.

  • epsilon_r (float, default 1.0) – Permittivity of the (homogeneous) cross-section filling. Used for the H-profile bake-in and the sigma heuristic.

  • mode_type (ModeType or None, default None) – None (default) solves both TE and TM families and keeps the n_modes lowest cut-offs, mixed types included — one operator injects/records/terminates every mode on the face (unified multi-mode port, WP-R3). Pass ModeType.TE or ModeType.TM to restrict to one family.

  • excitation (ExcitationSpec or None) – Soft-source spec; None for an absorber-only port.

  • window (tuple of two corner points, optional) – Sub-rectangle of the face as two opposite corners in global tangential-axis ordering (PortPlane.from_mesh() convention). None (default) covers the whole face. The window-boundary BCs follow the legacy edge rule: a port edge on a domain boundary inherits that wall’s BC, an interior edge inherits the port face’s BC (both read from mesh.pec_mask_edges).

class magnelio.ports.PortSpecRectWG(name, plane, width_a, height_b, epsilon_r=1.0, center=(0.0, 0.0), n_modes=1, excitation=None)#

Rectangular-waveguide modal port (TE / TM, Phase 1).

Parameters:
  • name (str) – Port label.

  • plane (BoxFace) – Bbox face on which the port lives.

  • width_a (float) – Cross-section dimension along the lower-numbered tangential global axis [m].

  • height_b (float) – Cross-section dimension along the higher-numbered tangential global axis [m].

  • epsilon_r (float, default 1.0) – Relative permittivity.

  • center (tuple[float, float], default (0.0, 0.0)) – Lower-left corner of the cross-section in the global tangential frame (lower-axis first).

  • n_modes (int, default 1) – Number of modes returned by the analytical solver, ordered by ascending cutoff frequency.

  • excitation (ExcitationSpec or None) – Soft-source spec; None for an absorber-only port.

class magnelio.ports.PortWaveguide(name, plane, corners=None, n_modes=1)#

Generic declarative waveguide port: “solve whatever is on this face”.

The mode-solver path (TEM / QTEM / TE-TM) is selected from the mesh cross-section at analysis-construction time — see the module docstring for the rules.

Parameters:
  • name (str) – Unique port name.

  • plane (BoxFace or str) – Bbox face the port lives on ("zmin", BoxFace.Z_MIN, …).

  • corners (tuple of tuple, optional) – Sub-rectangle of the face, given as two opposite corners ((x0, y0, z0), (x1, y1, z1)) in world coordinates [m] — the same form as from_corners(). Corner order does not matter. The component along the face’s normal axis is fixed by plane already; write it as None (or repeat the same value on both corners — differing values are rejected as a likely axis mix-up). An oversized rectangle is clipped to the domain and snapped to the nearest grid nodes, and a tangential component may be None to reach the domain boundary on that side. The window-boundary BCs follow the legacy edge rule: an edge on a domain boundary inherits that wall’s BC, an interior edge inherits the port face’s BC — so a port embedded in a PEC wall gets a PEC frame, which also counts as a conductor (ground) in the mode-path detection. None (default) covers the whole face.

  • n_modes (int, default 1) – Number of modes to solve on the port.

class magnelio.ports.RegionConductor(axis_a_range, axis_b_range)#

Axis-aligned rectangular conductor region on the port plane.

The two ranges are given in the global axis ordering — the same convention as PortSpecCoax.center and PortSpecRectWG.width_a. Concretely:

  • X-face port (u/v axes are y, z): (y_range, z_range).

  • Y-face port (u/v axes are x, z): (x_range, z_range).

  • Z-face port (u/v axes are x, y): (x_range, y_range).

The factory swaps the pair internally on MAX faces so the user description does not depend on whether the port is MIN or MAX.

Primal 2D nodes whose physical (u, v) coordinate falls inside [range_a_lo, range_a_hi] × [range_b_lo, range_b_hi] (with a small tolerance relative to the port-plane extent) are taken to belong to this conductor.

Typical uses: rectangular inner conductor of rect coax; the strip of a microstrip; a square bond pad.

Parameters:
  • axis_a_range (tuple[float, float])

  • axis_b_range (tuple[float, float])

class magnelio.ports.WallConductor(face)#

Single bbox-wall PEC conductor (e.g. microstrip ground plane).

face must be a bbox face whose normal axis is tangential to the port plane (a “lateral” face from the port plane’s perspective). All primal 2D nodes lying on that wall are taken to belong to this conductor. Mirrors the validation in _build_lateral_pec_edge_mask().

Parameters:

face (BoxFace)