API Reference¶
The following section outlines the API of fdtd.py.
Materials¶
-
class
fdtd.Material(name, eps_r=1, mu_r=1, sigma_e=0, sigma_m=0, color='#000000')[source]¶ Implement a material.
- Parameters
name (str) – The name of the material.
eps_r (float) – Relative permissivity.
mu_r (float) – Relative permeability.
sigma_e (float) – Electric condutivity.
sigma_m (float) – Magnetic condutivity.
color (str) – RGB color.
Lumped Elements¶
Resistor¶
-
class
fdtd.Resistor(x_min, y_min, z_min, x_max, y_max, z_max, resistance=50)[source]¶ Model of a resistor element.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the resistor.
y_min (float) – Minimum y coordinate of the bounding box containing the resistor.
z_min (float) – Minimum z coordinate of the bounding box containing the resistor.
x_max (float) – Maximum x coordinate of the bounding box containing the resistor.
y_max (float) – Maximum y coordinate of the bounding box containing the resistor.
z_max (float) – Maximum z coordinate of the bounding box containing the resistor.
resistance (float) – Internal resistance of the resistor.
Capacitor¶
-
class
fdtd.Capacitor(x_min, y_min, z_min, x_max, y_max, z_max, capacitance=1e-09)[source]¶ Model of a capacitor element.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the capacitor.
y_min (float) – Minimum y coordinate of the bounding box containing the capacitor.
z_min (float) – Minimum z coordinate of the bounding box containing the capacitor.
x_max (float) – Maximum x coordinate of the bounding box containing the capacitor.
y_max (float) – Maximum y coordinate of the bounding box containing the capacitor.
z_max (float) – Maximum z coordinate of the bounding box containing the capacitor.
capacitance (float) – Internal capacitance of the capacitor.
Inductor¶
-
class
fdtd.Inductor(x_min, y_min, z_min, x_max, y_max, z_max, resistance=50, inductance=1e-06)[source]¶ Model of a inductor element.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the inductor.
y_min (float) – Minimum y coordinate of the bounding box containing the inductor.
z_min (float) – Minimum z coordinate of the bounding box containing the inductor.
x_max (float) – Maximum x coordinate of the bounding box containing the inductor.
y_max (float) – Maximum y coordinate of the bounding box containing the inductor.
z_max (float) – Maximum z coordinate of the bounding box containing the inductor.
resistance (float) – Internal resistance of the inductor.
capacitance (float) – Internal inductance of the inductor.
Sources¶
Voltage Source¶
-
class
fdtd.VoltageSource(x_min, y_min, z_min, x_max, y_max, z_max, waveform, resistance=50, name=None, direction=<Direction.Z: 2>)[source]¶ Model of a voltage source.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the source.
y_min (float) – Minimum y coordinate of the bounding box containing the source.
z_min (float) – Minimum z coordinate of the bounding box containing the source.
x_max (float) – Maximum x coordinate of the bounding box containing the source.
y_max (float) – Maximum y coordinate of the bounding box containing the source.
z_max (float) – Maximum z coordinate of the bounding box containing the source.
waveform (Union[Waveform, Callable]) – Waveform type.
resistance (float) – Internal resistance of the source.
name (Optional[str]) – Name of the source.
direction (Direction) – Direction of the source.
Electric Field Source¶
-
class
fdtd.EFieldSource(x_min, y_min, z_min, x_max, y_max, z_max, waveform, resistance=50, name=None, direction=<Direction.Z: 2>)[source]¶ Model of an electric field source.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the source.
y_min (float) – Minimum y coordinate of the bounding box containing the source.
z_min (float) – Minimum z coordinate of the bounding box containing the source.
x_max (float) – Maximum x coordinate of the bounding box containing the source.
y_max (float) – Maximum y coordinate of the bounding box containing the source.
z_max (float) – Maximum z coordinate of the bounding box containing the source.
waveform (Union[Waveform, Callable]) – Waveform type.
resistance (float) – Internal resistance of the source.
name (Optional[str]) – Name of the source.
direction (Direction) – Direction of the source.
Impressed Electric Current Source¶
-
class
fdtd.ImpressedElectricCurrentSource(x_min, y_min, z_min, x_max, y_max, z_max, waveform, resistance=50, name=None, direction=<Direction.Z: 2>)[source]¶ Model of an impressed electric current source.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the source.
y_min (float) – Minimum y coordinate of the bounding box containing the source.
z_min (float) – Minimum z coordinate of the bounding box containing the source.
x_max (float) – Maximum x coordinate of the bounding box containing the source.
y_max (float) – Maximum y coordinate of the bounding box containing the source.
z_max (float) – Maximum z coordinate of the bounding box containing the source.
waveform (Union[Waveform, Callable]) – Waveform type.
resistance (float) – Internal resistance of the source.
name (Optional[str]) – Name of the source.
direction (Direction) – Direction of the source.
Impressed Magnetic Current Source¶
-
class
fdtd.ImpressedMagneticCurrentSource(x_min, y_min, z_min, x_max, y_max, z_max, waveform, resistance=50, name=None, direction=<Direction.Z: 2>)[source]¶ Model of an impressed magnetic current source.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the source.
y_min (float) – Minimum y coordinate of the bounding box containing the source.
z_min (float) – Minimum z coordinate of the bounding box containing the source.
x_max (float) – Maximum x coordinate of the bounding box containing the source.
y_max (float) – Maximum y coordinate of the bounding box containing the source.
z_max (float) – Maximum z coordinate of the bounding box containing the source.
waveform (Union[Waveform, Callable]) – Waveform type.
resistance (float) – Internal resistance of the source.
name (Optional[str]) – Name of the source.
direction (Direction) – Direction of the source.
Waveforms¶
Sine Waveform¶
Step Waveform¶
Gaussian Waveform¶
Custom Waveform¶
Waveforms can also be custom callable functions:
def waveform(time: float | numpy.ndarray):
"""Square wavefunction."""
return time**2
Detectors¶
Voltage Detector¶
-
class
fdtd.VoltageDetector(x_min, y_min, z_min, x_max, y_max, z_max, name=None, direction=<Direction.Z: 2>, plot=False)[source]¶ Model of a voltage detector.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the detector.
y_min (float) – Minimum y coordinate of the bounding box containing the detector.
z_min (float) – Minimum z coordinate of the bounding box containing the detector.
x_max (float) – Maximum x coordinate of the bounding box containing the detector.
y_max (float) – Maximum y coordinate of the bounding box containing the detector.
z_max (float) – Maximum z coordinate of the bounding box containing the detector.
name (Optional[str]) – Name of the source.
plot (bool) – Flag to enable plotting.
Magnetic Field Detector¶
-
class
fdtd.HFieldDetector(x_min, y_min, z_min, x_max, y_max, z_max, name=None, direction=<Direction.Z: 2>, plot=False)[source]¶ Model of a magnetic field detector.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the detector.
y_min (float) – Minimum y coordinate of the bounding box containing the detector.
z_min (float) – Minimum z coordinate of the bounding box containing the detector.
x_max (float) – Maximum x coordinate of the bounding box containing the detector.
y_max (float) – Maximum y coordinate of the bounding box containing the detector.
z_max (float) – Maximum z coordinate of the bounding box containing the detector.
name (Optional[str]) – Name of the source.
plot (bool) – Flag to enable plotting.
Electric Field Detector¶
-
class
fdtd.EFieldDetector(x_min, y_min, z_min, x_max, y_max, z_max, name=None, direction=<Direction.Z: 2>, plot=False)[source]¶ Model of an electric field detector.
- Parameters
x_min (float) – Minimum x coordinate of the bounding box containing the detector.
y_min (float) – Minimum y coordinate of the bounding box containing the detector.
z_min (float) – Minimum z coordinate of the bounding box containing the detector.
x_max (float) – Maximum x coordinate of the bounding box containing the detector.
y_max (float) – Maximum y coordinate of the bounding box containing the detector.
z_max (float) – Maximum z coordinate of the bounding box containing the detector.
name (Optional[str]) – Name of the source.
plot (bool) – Flag to enable plotting.
Boundaries¶
Periodic Boundary¶
-
class
fdtd.PeriodicBoundary(x_direction=False, y_direction=False, z_direction=False)[source]¶ Model of a periodic boundary condition.
- Parameters
x_direction (bool) – Flag to enable the boundary condition along the x axis.
y_direction (bool) – Flag to enable the boundary condition along the y axis.
z_direction (bool) – Flag to enable the boundary condition along the z axis.
Periodic Bloch Boundary¶
-
class
fdtd.PeriodicBlochBoundary(b_vec=(0, 0, 0), x_direction=False, y_direction=False, z_direction=False)[source]¶ Model of a periodic Bloch boundary condition.
- Parameters
b_vec (Tuple[float,..]) –
wave vector. (Bloch) –
x_direction (bool) – Flag to enable the boundary condition along the x axis.
y_direction (bool) – Flag to enable the boundary condition along the y axis.
z_direction (bool) – Flag to enable the boundary condition along the z axis.