Documentation

Docs / Scripting API

Excitations and boundaries#

faces arguments take one face or a list of faces (from obj.face(...) / obj.faces(...)). Boundaries also accept object= to use every face of an object (for example an air box).

Any outer face with nothing assigned is PEC. Every port is excited by default (one solve per port, giving the full S-matrix); pass active=False to make a port a matched load only.

Ports and sources: prj.excitations#

wave_port#

prj.excitations.wave_port(name, faces, modes=1, active=None, impedance=50.0,
                          ground=(), signal=(), deembed=None, renormalize=None,
                          line=None, terminals=None, results="modal")

A port that solves the cross-section's own modes. Put it on the model's outer boundary.

Parameter Meaning
faces One face, or several that make up the cross-section (for microstrip: the substrate face and the air face above it)
modes Number of modes; one per signal conductor for a multi-conductor port
active None/True excited, False a matched load only
impedance Reference impedance in Ω (used for terminal results)
line [signal_point, ground_point]: the integration line. Palace then reports the port impedance Z_PV (port-Z.csv) and the mode's sign is fixed
ground, signal Conductor names, instead of line
deembed A length ("5mm"): moves the reference plane into the model, with the mode's own propagation constant
renormalize An impedance in Ω: results referenced to it (needs the integration line)
results "modal" (default): one S-parameter port per mode (P1:1, P1:2...). "terminal": one per terminal, referenced to impedance (or renormalize), numbered port by port (P1_T1, P1_T2, P2_T1...)
terminals For "terminal": one [signal_point, ground_point] per mode; or use signal / ground

De-embedding and renormalisation apply wherever S-parameters are read (result.network(); network(raw=True) skips them), shown or exported.

p1 = prj.excitations.wave_port("P1", [sub.face("-y"), air.face("-y")],
                               line=[(0, 0, "h"), (0, 0, 0)])        # trace -> ground
diff = prj.excitations.wave_port("D1", end_faces, modes=2, results="terminal",
                                 signal=["TraceP", "TraceN"], ground=["Ground"])

lumped_port#

prj.excitations.lumped_port(name, faces, resistance=50.0, direction="+X", active=None, renormalize=None)

A port on a sheet between two conductors. direction is the current direction: "+X", "-Y"... or a vector string "x, y, z". Keep it small compared with the wavelength.

discrete_port#

prj.excitations.discrete_port(name, start, end, width=None, resistance=50.0, active=None)

A lumped port on a narrow strip between two points; current flows from start to end. Default width: a tenth of the gap.

floquet_port#

prj.excitations.floquet_port(name, face, active=None, polarization="TE", max_order=1,
                             theta=0.0, phi=0.0, reference_frequency=0)

A plane-wave port on the top or bottom of a periodic unit cell (needs periodic boundaries). The excited port's incidence (θ, φ in degrees) holds at reference_frequency (default: the sweep centre). Results are per diffraction order (port-floquet-S.csv).

plane_wave#

prj.excitations.plane_wave(name, theta=0.0, phi=0.0, polarization="theta", amplitude=1.0, direction=None)

A uniform plane wave arriving from (θ, φ) in degrees (θ from +Z, φ from +X). polarization is "theta", "phi", an angle from θ̂ towards φ̂, or a vector; or give direction=[kx, ky, kz] (the propagation direction) with a polarisation vector. Needs a radiation boundary round the model at least λ/2 away (1 λ for RCS within about 0.5 dB). Ports act as receivers. Results: result.rcs().

Boundaries: prj.boundaries#

Method Boundary
pec(name, faces=None, object=None) Perfect electric conductor
pmc(name, faces=None, object=None) Perfect magnetic conductor
radiation(name, faces=None, object=None) First-order absorbing boundary (open space)
conductivity(name, conductivity, faces=None, object=None, thickness=None, roughness=None, radius=None, surface_ratio=None, area_ratio=1.0, rms=None) Lossy metal; conductivity in S/m
impedance(name, rs=0.0, ls=0.0, cs=0.0, faces=None, object=None) Surface impedance: Rs (Ω/sq), Ls (H/sq), Cs (F/sq)
periodic(name, primary, secondary, phase_deg=0.0) secondary is a translated copy of primary (e.g. cell.face("-x"), cell.face("+x")); the phase is the delay of the secondary face

Roughness on conductivity: roughness="huray" with nodule radius and surface_ratio (SR = N·4πa²/A_hex) and optional area_ratio (A_matte/A_flat); or "hammerstad" / "groisse" with rms. See Surface roughness.

air = prj.modeler.box("AirBox", size=(60, 60, 30), origin=(-30, -30, -10))
prj.boundaries.radiation("Open", object=air)
prj.boundaries.conductivity("Cu", 5.8e7, faces=trace.faces(), roughness="huray",
                            radius="0.5um", surface_ratio=2.26)

Monitors and probes#

Monitors are in te10_studio.core.monitors (positions in metres, frequencies in Hz):

from te10_studio.core import monitors

monitors.add(prj.core, monitors.field_monitor("E10G", "E", 10e9))          # save fields at 10 GHz
monitors.add(prj.core, monitors.probe("Pt", "E", (0, 0, 0.002)))
monitors.add(prj.core, monitors.voltage_line("V1", (0, 0, 0.0016), (0, 0, 0)))
monitors.add(prj.core, monitors.current_loop("I1", (0, 0, 0.0008), (0, 1, 0), 0.002))
Function Records
field_monitor(name, kind, frequency_hz) kind: "E", "H", "Surface Current", "Power Flow"; saved at the nearest sweep frequency
probe(name, kind, point) "E" or "H" at a point, every frequency
voltage_line(name, start, end, segments_=20) ∫E·dl from start to end
current_loop(name, center, normal, radius, segments_=36) ∮H·dl (keep it in non-magnetic material)

After a solve, te10_studio.postprocess.monitors.results_for(prj.core, setup_name=None, excitation=None) returns {monitor name: result} (None if not solved). Current monitors need element order 3 (or a finer mesh) for about 1 % accuracy; voltages and E probes are within about 0.5 % at order 2.