Source Base Classes

fdtdx.objects.sources.source.Source

Bases: SimulationObject, ABC

update_E abstractmethod

update_E(
    E: Array,
    inv_permittivities: Array,
    inv_permeabilities: Array | float,
    time_step: Array,
    inverse: bool,
) -> jax.Array

Update the electric field component.

Parameters:
  • E (Array) –

    Current electric field array.

  • inv_permittivities (Array) –

    Inverse permittivity values.

  • inv_permeabilities (Array | float) –

    Inverse permeability values.

  • time_step (Array) –

    Current simulation time step.

  • inverse (bool) –

    Whether to perform inverse update for backpropagation.

Returns:
  • Array

    jax.Array: Updated electric field array.

Source code in src/fdtdx/objects/sources/source.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@abstractmethod
def update_E(
    self,
    E: jax.Array,
    inv_permittivities: jax.Array,
    inv_permeabilities: jax.Array | float,
    time_step: jax.Array,
    inverse: bool,
) -> jax.Array:
    """Update the electric field component.

    Args:
        E (jax.Array): Current electric field array.
        inv_permittivities (jax.Array): Inverse permittivity values.
        inv_permeabilities (jax.Array | float): Inverse permeability values.
        time_step (jax.Array): Current simulation time step.
        inverse (bool): Whether to perform inverse update for backpropagation.

    Returns:
        jax.Array: Updated electric field array.
    """
    raise NotImplementedError()

update_H abstractmethod

update_H(
    H: Array,
    inv_permittivities: Array,
    inv_permeabilities: Array | float,
    time_step: Array,
    inverse: bool,
) -> jax.Array

Update the magnetic field component.

Parameters:
  • H (Array) –

    Current magnetic field array.

  • inv_permittivities (Array) –

    Inverse permittivity values.

  • inv_permeabilities (Array | float) –

    Inverse permeability values.

  • time_step (Array) –

    Current simulation time step.

  • inverse (bool) –

    Whether to perform inverse update for backpropagation.

Returns:
  • Array

    jax.Array: Updated magnetic field array.

Source code in src/fdtdx/objects/sources/source.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
@abstractmethod
def update_H(
    self,
    H: jax.Array,
    inv_permittivities: jax.Array,
    inv_permeabilities: jax.Array | float,
    time_step: jax.Array,
    inverse: bool,
) -> jax.Array:
    """Update the magnetic field component.

    Args:
        H (jax.Array): Current magnetic field array.
        inv_permittivities (jax.Array): Inverse permittivity values.
        inv_permeabilities (jax.Array | float): Inverse permeability values.
        time_step (jax.Array): Current simulation time step.
        inverse (bool): Whether to perform inverse update for backpropagation.

    Returns:
        jax.Array: Updated magnetic field array.
    """
    raise NotImplementedError()

fdtdx.objects.sources.source.DirectionalPlaneSourceBase

Bases: Source, ABC

Base class for directional plane wave sources.

Implements common functionality for plane wave sources that propagate in a specific direction. Provides methods for calculating wave vectors and orthogonal field components.

Attributes:
  • direction (Literal['+', '-']) –

    Direction of propagation ('+' or '-' along propagation axis).

fdtdx.objects.sources.tfsf.TFSFPlaneSource

Bases: DirectionalPlaneSourceBase, ABC

Total-Field/Scattered-Field (TFSF) implementation of a source. The boundary between the scattered field and total field is at a positive offset of 0.25 in the yee grid in the axis of propagation.

azimuth_radians property

azimuth_radians: float

Convert azimuth angle from degrees to radians.

Returns:
  • float( float ) –

    Azimuth angle in radians.

elevation_radians property

elevation_radians: float

Convert elevation angle from degrees to radians.

Returns:
  • float( float ) –

    Elevation angle in radians.

max_angle_random_offset_radians property

max_angle_random_offset_radians: float

Convert maximum random angle offset from degrees to radians.

Returns:
  • float( float ) –

    Maximum random angle offset in radians.

max_horizontal_offset_grid property

max_horizontal_offset_grid: float

Convert maximum horizontal offset from physical units to grid points.

Returns:
  • float( float ) –

    Maximum horizontal offset in grid points.

max_vertical_offset_grid property

max_vertical_offset_grid: float

Convert maximum vertical offset from physical units to grid points.

Returns:
  • float( float ) –

    Maximum vertical offset in grid points.

fdtdx.objects.sources.linear_polarization.LinearlyPolarizedPlaneSource

Bases: TFSFPlaneSource, ABC

fdtdx.objects.sources.profile.TemporalProfile

Bases: TreeClass, ABC

Base class for temporal profiles of sources.

This class defines how the source amplitude varies in time.

get_amplitude abstractmethod

get_amplitude(
    time: Array, period: float, phase_shift: float = 0.0
) -> jax.Array

Calculate the temporal amplitude at given time points.

Parameters:
  • time (Array) –

    Time points to evaluate amplitude at

  • period (float) –

    Period of the carrier wave (1/frequency)

  • phase_shift (float, default: 0.0 ) –

    Phase shift of the carrier wave

Returns:
  • Array

    jax.Array: Amplitude values at the given time points

Source code in src/fdtdx/objects/sources/profile.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@abstractmethod
def get_amplitude(
    self,
    time: jax.Array,
    period: float,
    phase_shift: float = 0.0,
) -> jax.Array:
    """Calculate the temporal amplitude at given time points.

    Args:
        time (jax.Array): Time points to evaluate amplitude at
        period (float): Period of the carrier wave (1/frequency)
        phase_shift (float): Phase shift of the carrier wave

    Returns:
        jax.Array: Amplitude values at the given time points
    """
    raise NotImplementedError()