pyoptics.fdtd.sources

Sources: time profiles, soft current sources and the total-field / scattered-field (TFSF) plane wave.

Point and line sources are soft current sources: an electric current density J (or magnetic M for Hz) is added to the update equation, so the source does not scatter the fields passing through it. A source’s amplitude is the dipole moment (point) or the current per unit length (line), so the radiated field does not depend on the cell size.

Classes

ContinuousWave

sin(omega t), switched on smoothly over a ramp time (raised cosine).

GaussianPulse

Sine carrier under a Gaussian envelope (no DC component).

LineSource

Current sheet across the domain at a position along an axis (2D), or a sheet in 1D.

PointSource

Point dipole (a line current along z in 2D, a sheet in 1D).

Source

Base class.

TFSF

Plane wave travelling towards +x, injected on the boundary of a box (total-field / scattered-field formulation, 2D, both modes).

class pyoptics.fdtd.sources.GaussianPulse(wavelength, bandwidth=0.2, delay=None, amplitude=1.0)[source]

Bases: object

Sine carrier under a Gaussian envelope (no DC component).

s(t) = amplitude*exp(-(t - delay)**2/(2 tau**2))*sin(omega_0 (t - delay))

Parameters:
wavelengthnumber

Vacuum wavelength of the carrier.

bandwidthnumber

Spectral standard deviation relative to the carrier frequency; tau = 1/(2 pi bandwidth f_0).

delaynumber, optional

Centre of the pulse, 5 tau by default (the pulse starts smoothly).

property end

Time after which the pulse is negligible (< 4e-6 of its peak).

class pyoptics.fdtd.sources.ContinuousWave(wavelength, ramp=None, amplitude=1.0)[source]

Bases: object

sin(omega t), switched on smoothly over a ramp time (raised cosine).

Parameters:
wavelengthnumber
rampnumber, optional

Rise time, 3 periods by default.

class pyoptics.fdtd.sources.Source[source]

Bases: object

Base class. Subclasses implement setup(sim), inject_h(sim, t) and inject_e(sim, t).

class pyoptics.fdtd.sources.PointSource(position, profile, component=None, amplitude=1.0)[source]

Bases: _CurrentSource

Point dipole (a line current along z in 2D, a sheet in 1D).

Parameters:
positionnumber or tuple
profilecallable

Time profile, e.g. GaussianPulse or ContinuousWave.

componentstr, optional

Field component the current drives: Ez (default in 1D and the Ez mode), Ex or Ey (electric), Hz (magnetic current, default in the Hz mode).

amplitudenumber
class pyoptics.fdtd.sources.LineSource(position, profile, axis=0, component=None, extent=None, transverse=None, amplitude=1.0)[source]

Bases: _CurrentSource

Current sheet across the domain at a position along an axis (2D), or a sheet in 1D. With periodic boundaries along the line it launches plane waves to both sides.

Parameters:
positionnumber

Coordinate of the line along axis.

profilecallable

Time profile.

axisint

Normal of the line (0: a line x = position, 1: y = position).

componentstr, optional

As for PointSource.

extent(lo, hi), optional

Part of the line that radiates (default: all of it).

transversecallable, optional

Amplitude across the line as a function of the coordinate along it, e.g. a Gaussian beam profile.

amplitudenumber
class pyoptics.fdtd.sources.TFSF(box, profile, n_background=1.0)[source]

Bases: Source

Plane wave travelling towards +x, injected on the boundary of a box (total-field / scattered-field formulation, 2D, both modes).

Inside the box the total field is computed, outside only the scattered field: without scatterers the field outside the box is zero up to round-off. The incident wave comes from an auxiliary 1D grid with the same cell size and time step, whose numerical dispersion along x is identical to that of the 2D grid.

Parameters:
box(xmin, xmax, ymin, ymax)

Total field region; it should lie in the background medium near its edges and stay clear of the PML.

profilecallable

Time profile of the incident field (its E at the source of the auxiliary grid; the wave reaches x = xmin a bit later).

n_backgroundnumber

Refractive index of the background medium.

incident(x, t=None)[source]

Incident Ez (Ez mode) or Ey (Hz mode) of the auxiliary grid at x, at the current time of the simulation (nearest node).