sources module

The sources.py script containts different classes defining a time-dependent sources to be installed in the electromagnetic simulation.

All sources need an update function that will be called every simulation timestep, e.g.:

def update(self, t, *args, **kwargs)`

class wakis.sources.Beam(xsource=0.0, ysource=0.0, beta=1.0, q=1e-9, sigmaz=None, ti=None)[source]

Bases: object

plot(t)[source]

Plot the time evolution of the beam current profile.

Parameters

t (array_like) – Array of time values [s].

update(solver, t)[source]

Update the current density J in the solver to represent the beam at time t.

Parameters
  • solver (object) – Solver object with attributes x, y, z, dx, dy, dz, and J.

  • t (float) – Current simulation time [s].

class wakis.sources.Dipole(field='E', component='z', xs=None, ys=None, zs=None, nodes=10, f=None, amplitude=1.0, phase=0)[source]

Bases: object

update(solver, t)[source]

Update the specified field/component in the solver to represent the dipole at time t.

Parameters
  • solver (object) – Solver object with E, H, and J field arrays.

  • t (float) – Current simulation time [s].

class wakis.sources.PlaneWave(xs=None, ys=None, zs=0, nodes=None, f=None, amplitude=1.0, beta=1.0, phase=0)[source]

Bases: object

plot(t)[source]

Plot the time evolution of the plane wave source fields.

Parameters

t (array_like) – Array of time values [s].

update(solver, t)[source]

Update the E and H fields in the solver to represent the plane wave at time t.

Parameters
  • solver (object) – Solver object with E and H field arrays.

  • t (float) – Current simulation time [s].

class wakis.sources.Pulse(field='E', component='z', xs=None, ys=None, zs=None, shape='Harris', L=None, amplitude=1.0, delay=0.0)[source]

Bases: object

gaussian_pulse(t)[source]

Gaussian pulse time profile.

Parameters

t (float or array_like) – Time value(s) [s].

Returns

Gaussian pulse value(s).

Return type

float or ndarray

harris_pulse(t)[source]

Harris pulse time profile.

Parameters

t (float or array_like) – Time value(s) [s].

Returns

Harris pulse value(s).

Return type

float or ndarray

rectangular_pulse(t)[source]

Rectangular pulse time profile.

Parameters

t (float or array_like) – Time value(s) [s].

Returns

Rectangular pulse value(s).

Return type

float or ndarray

update(solver, t)[source]

Update the specified field/component in the solver to represent the pulse at time t.

Parameters
  • solver (object) – Solver object with E, H, and J field arrays.

  • t (float) – Current simulation time [s].

class wakis.sources.WavePacket(xs=None, ys=None, zs=0, sigmaz=None, sigmaxy=None, tinj=None, wavelength=None, f=None, amplitude=1.0, beta=1.0, phase=0)[source]

Bases: object

plot(t, zmin=0)[source]

Plot the time evolution of the wave packet source fields.

Parameters
  • t (array_like) – Array of time values [s].

  • zmin (float, optional) – Minimum z position for the reference shift. Default is 0.

update(solver, t)[source]

Update the E and H fields in the solver to represent the wave packet at time t.

Parameters
  • solver (object) – Solver object with E and H field arrays.

  • t (float) – Current simulation time [s].