magnelio.sources#

Source components — volumetric excitations beyond the port sources.

class magnelio.sources.PlaneWaveSource(direction=(0.0, 0.0, 1.0), polarization=(1.0, 0.0, 0.0), corners=None, amplitude=1.0, waveform='gaussian', f_center=None, f_max=None)#

Plane-wave excitation via TF/SF formulation.

Parameters:
  • direction (tuple of float) – Propagation direction unit vector (kx, ky, kz).

  • polarization (tuple of float) – E-field polarization unit vector (⊥ direction).

  • corners (tuple of tuple, optional) – Two opposite corners ((x0, y0, z0), (x1, y1, z1)) of the total-field region [m] — the same form as from_corners(). Corner order does not matter, and a component may be None (or ±math.inf) to fall back to the default extent on that side (two bulk cells inside the domain boundary — the scattered-field shell the TF/SF split needs). Snapped to the nearest grid nodes. None (default) uses the default extent on all six sides.

  • amplitude (float) – Peak E-field amplitude [V/m].

  • waveform ({"gaussian", "sine"}) – Excitation waveform.

  • f_center (float, optional) – Center frequency for the sine waveform [Hz].

  • f_max (float, optional) – Bandwidth parameter for the Gaussian waveform [Hz].

classmethod from_ranges(*, x1=None, x2=None, dx=None, y1=None, y2=None, dy=None, z1=None, z2=None, dz=None, **kwargs)#

Build the same source from one coordinate range per axis.

The range spelling of corners=, as in from_ranges(): each axis takes up to two of its three keywords — the two bounds (x1, x2) or a bound and an extent (x1, dx / x2, dx). Here an axis may also be open: give nothing for the whole domain extent, or a single bound to reach the domain boundary on the other side. All remaining keyword arguments are forwarded to the constructor.

Examples

>>> src = PlaneWaveSource.from_ranges(x1=1e-3, x2=9e-3, y1=1e-3, y2=9e-3, z1=1e-3, z2=19e-3)
attach(solver)#

Cache solver coefficients and snap TF/SF box to grid nodes.

Called once from FITTimeDomainSolver.setup().

Return type:

None

excitation(t)#

Waveform value at time t [s].

Accepts a scalar or an array of times and follows the input: the TF/SF injection evaluates a whole box face in one call.

incident_E(r, t)#

Incident E-field vector [V/m] at position r and time t.

E_inc(r, t) = E0 · ê · f(t − k̂·r / c₀)

Parameters:
Return type:

ndarray

incident_H(r, t)#

Incident H-field vector [A/m] at position r and time t.

H_inc = (1/η₀) · (k̂ × ê) · f(t − k̂·r / c₀) = (E0/η₀) · ĥ · f(…)

Parameters:
Return type:

ndarray

inject_E(fields, t_E)#

Apply TF/SF E-field corrections after the E update.

Uses H_inc at t = t_E - dt/2 (half a step behind E).

Parameters:

t_E (float)

Return type:

None

inject_H(fields, t_H)#

Apply TF/SF H-field corrections after the H update.

Uses E_inc at t = t_H - dt/2 (the E time level just computed).

Parameters:

t_H (float)

Return type:

None