differt.em.Dipole#

class Dipole(frequency, num_wavelengths=0.5, *, length=None, moment=Array([0., 0., 1.], dtype=float32), current=1.0, charge=None, center=Array([0., 0., 0.], dtype=float32), look_at=None)[source]#

Bases: Antenna

A simple electrical (or Hertzian) dipole.

Equations were obtained from [17, 18, 19, 20], and assume a constant current across the dipole length.

Parameters:
  • frequency (Float[ArrayLike, '']) – The frequency at which the antenna is operating.

  • num_wavelengths (Float[ArrayLike, '']) – The length of the dipole, relative to the wavelength.

  • length (Float[ArrayLike, ''] | None) – The absolute length of the dipole, supersedes num_wavelengths.

  • moment (Float[ArrayLike, '3'] | None) –

    The dipole moment.

    By default, the dipole is aligned with the z-axis.

  • current (Float[ArrayLike, ''] | None) –

    The current (in A) flowing in the dipole.

    If this is provided, which is the default, only the direction of the moment vector is used, and its intensity is set to match the dipole moment with specified current.

  • charge (Float[ArrayLike, ''] | None) –

    The dipole charge (in Coulomb), assuming opposite charges on either ends of the dipole.

    If this is provided, this takes precedence over current.

  • center (Float[ArrayLike, '3']) – The center position of the antenna, from which the fields are radiated.

  • look_at (Float[ArrayLike, '3'] | None) –

    When provided, re-orient the antenna to look at the given point.

    This overrides the direction of the dipole moment.

Examples

The following example shows how to plot the radiation pattern (antenna power) at 1 meter.

>>> from differt.em import Dipole
>>>
>>> ant = Dipole(frequency=1e9)
>>> fig = ant.plot_radiation_pattern(backend="plotly")
>>> fig

The second example shows how to plot the radiation pattern (antenna power) at 1 meter, but only in the x-z plane, for multiple dipole lengths.

>>> from differt.em import Dipole
>>>
>>> theta = jnp.linspace(0, 2 * jnp.pi, 200)
>>> r = jnp.stack(
...     (jnp.cos(theta), jnp.zeros_like(theta), jnp.sin(theta)), axis=-1
... )
>>> fig = plt.figure()
>>> ax = fig.add_subplot(
...     projection="polar", facecolor="lightgoldenrodyellow"
... )
>>> for ratio in [0.5, 1.0, 1.25, 1.5, 2.0]:
...     ant = Dipole(1e9, ratio)
...     power = jnp.linalg.norm(ant.poynting_vector(r), axis=-1)
...     _ = ax.plot(theta, power, label=rf"$\ell/\lambda = {ratio:1.2f}$")
>>>
>>> ax.tick_params(grid_color="palegoldenrod")
>>> ax.set_rscale("log")
>>> angle = jnp.deg2rad(-10)
>>> ax.legend(
...     loc="upper left",
...     bbox_to_anchor=(0.5 + jnp.cos(angle) / 2, 0.5 + jnp.sin(angle) / 2),
... )
>>> plt.show()
../../_images/differt-em-Dipole-2.png

The third example shows how to orient the antenna to look at a given point.

>>> from differt.em import Dipole
>>>
>>> ant = Dipole(frequency=1e9, look_at=jnp.array([0.0, -1.0, -1.0]))
>>> fig = ant.plot_radiation_pattern(backend="plotly")
>>> fig

Attributes

angular_frequency

The angular frequency \(\omega = 2 \pi f\).

aperture

The aperture \(A\) of an isotropic antenna.

period

The period \(T = 1/f\).

reference_power

The reference power (W) radiated by this antenna.

wavelength

The wavelength \(\lambda = c / f\).

wavenumber

The wavenumber \(k = \omega / c\).

length

Dipole length (in meter).

moment

Dipole moment (in Coulomb-meter).

frequency

The frequency \(f\) at which the antenna is operating.

center

The center position of the antenna, from which the fields are radiated.

Methods

directive_gain([num_points])

Compute an estimate of the antenna directive gain.

directivity([num_points])

Compute an estimate of the antenna directivity for azimuthal and elevation angles.

fields(r[, t])

Compute electric and magnetic fields in vacuum at given position and (optional) time.

plot_radiation_pattern([num_points, ...])

Plot the radiation pattern (normalized power) of this antenna.

poynting_vector(r[, t])

Compute the Poynting vector in vacuum at given position and (optional) time.

Detailed documentation

property angular_frequency: Float[Array, ''][source]#

The angular frequency \(\omega = 2 \pi f\).

property aperture: Float[Array, ''][source]#

The aperture \(A\) of an isotropic antenna.

center: Float[Array, '3']#

The center position of the antenna, from which the fields are radiated.

Default value is the origin.

directive_gain(num_points=int(1e2))[source]#

Compute an estimate of the antenna directive gain.

Note

Subclasses may provide a more accurate or exact implementation.

Parameters:

num_points (int) – The number of points used for the estimate.

Return type:

Float[Array, '']

Returns:

The antenna directive gain.

See also

directivity

directivity(num_points=int(1e2))[source]#

Compute an estimate of the antenna directivity for azimuthal and elevation angles.

Note

Subclasses may provide a more accurate or exact implementation.

Parameters:

num_points (int) –

The number of points to sample along the elevation axis.

Twice this number of points are sampled on the azimuthal axis.

Return type:

tuple[Float[Array, '2*{num_points}'], Float[Array, '{num_points}'], Float[Array, '2*{num_points} {num_points}']]

Returns:

Azimuthal and elevation angles, as well as corresponding directivity values.

See also

directive_gain

fields(r, t=None)[source]#

Compute electric and magnetic fields in vacuum at given position and (optional) time.

Parameters:
Return type:

tuple[Inexact[Array, '*batch 3'], Inexact[Array, '*batch 3']]

Returns:

The electric \(\vec{E}\) and magnetic \(\vec{B}\) fields.

Fields can be either real or complex-valued.

frequency: Float[Array, '']#

The frequency \(f\) at which the antenna is operating.

length: Float[Array, '']#

Dipole length (in meter).

moment: Float[Array, '3']#

Dipole moment (in Coulomb-meter).

property period: Float[Array, ''][source]#

The period \(T = 1/f\).

plot_radiation_pattern(num_points=int(1e2), distance=1.0, num_wavelengths=None, **kwargs)[source]#

Plot the radiation pattern (normalized power) of this antenna.

The power is computed on points on a sphere around the antenna.

Parameters:
  • num_points (int) –

    The number of points to sample along the elevation axis.

    Twice this number of points are sampled on the azimuthal axis.

  • distance (Float[ArrayLike, '']) – The distance from the antenna at which power samples are evaluated.

  • num_wavelengths (Float[ArrayLike, ''] | None) – If provided, supersedes distance by setting the distance relatively to the wavelength.

  • kwargs (Any) – Keyword arguments passed to draw_surface.

Return type:

Any

Returns:

The resulting plot output.

poynting_vector(r, t=None)[source]#

Compute the Poynting vector in vacuum at given position and (optional) time.

Parameters:
Return type:

Inexact[Array, '*batch 3']

Returns:

The Poynting vector \(\vec{S}\).

It can be either real or complex-valued.

property reference_power: Float[Array, ''][source]#

The reference power (W) radiated by this antenna.

This is the maximal value of the Poynting vector at a distance of one meter from this antenna, multiplied by the area of the sphere (\(4\phi\)), to obtain a power.

property wavelength: Float[Array, ''][source]#

The wavelength \(\lambda = c / f\).

property wavenumber: Float[Array, ''][source]#

The wavenumber \(k = \omega / c\).