Boundaries

Release · v2.2.0MarkdownLLM docs
이 페이지의 내용

What it is for

Every FDTD domain ends somewhere, and what happens to a wave at that end is part of the model. An open structure (an antenna, a scatterer, a line that should look infinitely long) needs an absorber that takes the wave without reflecting it. A closed cavity needs metal walls. A symmetry plane can be a metal (PEC) or magnetic (PMC) wall that halves the domain. An array or a metasurface needs periodic walls. This page is how you declare each of them, face by face, and the rules that ports and plane waves put on them.

How to use it

Simulation(boundary=...) takes one word for all six faces: "cpml" (the default), "upml" or "pec". For different faces, pass a BoundarySpec with one entry per axis; an entry is a word for both faces of that axis, or a Boundary(lo=..., hi=...) for two different faces. The words for a face are "cpml", "upml", "pec", "pmc" and "periodic".

A board over a ground plane, open on top and at the sides, with a thinner absorber on top:

from rfx import Simulation
from rfx.boundaries.spec import Boundary, BoundarySpec
spec = BoundarySpec(
x="cpml",
y="cpml",
z=Boundary(lo="pec", hi="cpml", hi_thickness=8),
)
sim = Simulation(freq_max=10e9, domain=(0.03, 0.03, 0.015), dx=0.5e-3,
boundary=spec, cpml_layers=12)
for axis, side, token in spec.faces():
print(axis, side, token)
try:
Boundary(lo="periodic", hi="cpml")
except ValueError as err:
print(err)
else:
raise AssertionError("expected a refusal")
x lo cpml
x hi cpml
y lo cpml
y hi cpml
z lo pec
z hi cpml
periodic must be symmetric on an axis; got lo='periodic' hi='cpml'. Use Boundary(lo='periodic', hi='periodic') or rename the asymmetric side.

The rules the spec enforces when you build it:

  • A periodic axis is periodic on both faces.
  • lo_thickness and hi_thickness apply only to absorbing faces. They set that face’s layer count and may not exceed cpml_layers (preflight refuses it), which is the largest depth rfx allocates; a face without its own thickness gets cpml_layers.
  • CPML and UPML cannot be mixed in one model.
  • Boundary(lo="pec", hi="pec", conformal=True) adds the Dey–Mittra conformal correction at the two walls. The axis is still a wall axis, so the cell-count rule below applies to it: under the default snap="strict" a length more than 1 % off a whole number of cells is refused, and snap="declared" accepts it with a warning.

The 1.x arguments pec_faces= and set_periodic_axes() are gone; the error names the replacement (see Upgrading to 2.0).

Where the absorber sits

The absorber is added outside the domain you declare: the box from 0 to domain on each axis is free of absorber, and each absorbing face adds its layers beyond it. A metal, magnetic or periodic face adds nothing. So the domain is the region you model, solved in whole cells (see How the domain becomes cells), and the absorber’s depth is extra memory, not lost space.

What an absorber needs from the model:

  • Depth. cpml_layers defaults to 16. The CPML reflects less with more layers (see Accuracy). Preflight warns below 8 layers (thin_absorber).
  • Room. Keep shapes inside the domain: a shape that reaches past the domain edge enters the absorber (geometry_in_absorber). Preflight also warns when a probe, source or port is within two cells of the absorber (absorber_proximity), where the fields carry the absorber’s own error; more room is better.
  • A uniform medium next to each face. On a graded mesh, keep the cells next to each absorbing face uniform over as many cells as the face has layers (nu_grading_reaches_absorber). A substrate that runs into the absorber on purpose (a line meant to look infinitely long) is reported too; read the warning and decide.
  • CPML for most uses. UPML is accepted on a uniform mesh on one device only, is refused with a plane wave, and does not read cpml_kappa_max. Use CPML unless you have a reason not to.

How the domain becomes cells

The grid holds whole cells, so a declared length is solved as a whole number of them:

  • An axis closed by walls on both faces (PEC, PMC, or faces with no absorber layers) is solved at the nearest whole number of cells. If that is more than 1 % off the declared length, the default snap="strict" refuses the model and the message names the nearest dx that fits; snap="declared" runs it with a wall_axis_off_node warning. When you leave dx unset, rfx looks for a cell size that fits the walls, no smaller than 0.75 of the one it would otherwise choose. If none fits, it refuses and names the largest smaller dx that does, searching down to 1/16 of its own choice; below that the message says no fitting spacing was found. A WR-90 cross-section, 22.86 × 10.16 mm, fits at dx = 1.27 mm (18 × 8 cells) and is refused at 1 mm, where 10.16 mm would be solved as 10 mm.
  • An axis with absorbing faces is covered by whole cells and can be solved up to one cell longer than declared. sim.fidelity_report() lists it as domain-extent-quantized with the declared and solved lengths.
  • A periodic axis follows the rule in Periodic walls.
  • A graded axis is solved as the cell profile you give.

Metal and magnetic walls

A "pec" face is a perfect electric conductor: tangential E is zero on it. A "pmc" face is a perfect magnetic conductor: tangential H is zero on it. Either can stand for a symmetry plane of the structure and its excitation: a PEC wall where the tangential E is zero by symmetry, a PMC wall where the tangential H is zero. A closed cavity is PEC on every face; do not mix an absorber into it.

A far field cannot be taken through such a wall. The far-field transform (NTFF) rebuilds no mirror image, so run(), forward() and compute_rcs refuse a far-field box in a model with a PEC or PMC face, or an absorbing face with zero layers: a half model cut by a magnetic symmetry plane would give a pattern 6 dB wrong, not only a scale factor. For a far field, draw a finite ground plane as geometry and keep every face absorbing.

Periodic walls and a phase across the cell

A "periodic" axis joins its two faces: the field leaving one face enters the other. With no phase, this models an infinite array at normal incidence. An axis of length L has exactly L/dx cells, so the structure repeats every L; an explicit dx that does not divide L is refused with the nearest one that does. A periodic axis runs on a uniform or a graded mesh on one device; on a graded mesh the cells along that axis must all have one size. A phase across the cell (a Bloch condition, for oblique incidence or a scanned array) is not set on the boundary itself but by the source that needs it:

  • add_floquet_port(..., scan_theta=..., scan_phi=...) turns on periodic transverse axes for you. A port scanned off normal is refused on every solver path today; at normal incidence it runs on a uniform mesh on one device.
  • A plane wave (add_tfsf_source(..., angle_deg=..., method="bloch")) applies the phase across a periodic transverse axis.

Rules that ports and plane waves put on the boundary

  • Waveguide port. It needs at least one CPML face (boundary="cpml", or CPML on some faces of a BoundarySpec) and at least one layer. A full-aperture port (the guide fills the domain cross-section) needs PEC on the transverse faces; on a uniform mesh the default transverse absorbers are solved as PEC with a warning, and on a graded mesh you declare them explicitly.
  • Plane wave from a slab source. On each axis across the beam, the two faces must be periodic, or both the matching wall (PEC on the faces normal to E, PMC on the faces normal to H), or both absorbing. On the uniform mesh the faces the source wraps (y and z; z only for method="methodB") are solved as periodic: leave boundary out or pass boundary="cpml", and preflight warns (tfsf_transverse_periodic); along that axis you model an infinite array of your structure. CPML, PMC or PEC declared on such a face is refused there, naming the faces. The graded mesh solves the declared faces as declared. A structure that is not uniform along such an axis is refused; declare the axis "periodic" to solve an array on purpose, or use closed_box=True for a finite scatterer. For oblique incidence, the finite-scatterer declaration is add_tfsf_source(closed_box=True, theta_deg=…, phi_deg=…, polarization='s' or 'p') in 3-D with CPML on all six faces. A mixed pair is refused. This uniformity check applies at normal incidence and on the uniform oblique Bloch path, including the tilt axis. Open oblique method="methodB" keeps absorbing y faces and periodic z faces. The graded mesh refuses oblique incidence.
  • Plane wave in a closed box (closed_box=True, a total-field box with the scattered field around it) needs boundary="cpml", not a PEC cavity.

How rfx checks it

When the spec is built: the face words, a periodic axis on both faces, thickness only on absorbing faces, and no CPML–UPML mix. A thickness above cpml_layers is refused by preflight and when the grid is built. Before the run, preflight checks the absorber depth, the room around the structure and the mesh next to each absorbing face (warnings), and the solver path checks that it implements every face (refusals, below).

Inputs rfx refuses

InputSolver pathWhat happensInstead
an axis closed by walls on both faces (PEC, PMC or zero-depth faces), without a cell profile, whose length is more than 1 % off a whole number of cellsuniform and graded meshrefused under the default snap="strict"; the message names the nearest dx that fitsthat dx, or snap="declared" to run with a warning
"pmc" facesubgriddedrefuseda uniform or graded mesh, on one device or several
"pmc" face with a wire port or lumped-port S (on a graded mesh, with any port or frequency-domain record)several devices, either meshrefusedrun on one device
"periodic" axismulti-device, subgriddedrefusedrun on one device
on a periodic axis: a graded cell profile along it, a plane wave, interface_eps="dual_average" or Bloch phasesgraded meshrefusedkeep the cell size constant along the axis; run plane waves on a periodic cell on a uniform mesh
extract_s_matrix or extract_s_matrix_wire on a model with a periodic axisallrefused: they solved six PEC wallsrun(compute_s_params=True)
a far-field box (add_ntff_box) with a PEC, PMC or zero-depth absorbing faceallrefuseda finite ground plane drawn as geometry, every face absorbing
"upml"graded mesh, multi-device, subgriddedrefuseduse "cpml"
"upml" with a plane wave (add_tfsf_source)allrefuseduse "cpml"
UPML with cpml_kappa_max other than 1allrefused: UPML does not read ituse "cpml"
a waveguide port with no CPML faceallrefused when the port is addeduse CPML
a Floquet port scanned off normalallrefusednormal incidence only
a slab plane wave with a mixed pair of side faces, or (at normal incidence) a structure not uniform along a side axis that is not periodicallrefuseddeclare that axis "periodic", or use closed_box=True
an open plane wave with CPML, PMC or PEC declared on a side face it wraps (y and z; z only for method="methodB")uniform meshrefused, naming the facesdeclare those faces "periodic", leave boundary out, use closed_box=True, or a graded mesh
closed_box=True plane wave in a PEC domainallrefusedboundary="cpml"

Refused inputs explains how refusals read; the support page lists every refusal per solver path.

Accuracy

The CPML’s reflection is measured directly: a plane wave in vacuum on a 1 mm mesh hits one face, and the reflected wave is separated from the incident one. At 2, 10 and 30 GHz and on both the low and the high face, the reflection stays below these bounds (tests/unit/boundaries/test_cpml_reflection_coefficient.py):

Layerscpml_kappa_maxReflection below
41−13 dB
81−40 dB
16 (default)1−90 dB
83−25 dB

At 45° incidence with 8 layers, the reflection at 10 GHz is below −60 dB (same file). The bounds are test limits set above the measured values, not the measured values themselves.

See also

Back to top