pynoza

Pynoza is a Python implementation of the time-domain multipole expansion of electromagnetic fields in Cartesian coordinates.

Currently, only the electric field computation is supported, and the current density must be time-separable, i.e., the current density must be the product of two time- and space-dependent functions.

The source is code is available on GitHub.

class pynoza.solution.Solution

Bases: object

A class to compute solutions of Maxwell’s equations, based on time-domain multipole moments.

__init__()

Initialize the solution class.

Parameters:
  • max_order – The maximum order to which multipole moments will be computed (default 0)

  • wave_speed – The Wave speed c used to compute the retarded time t-r/c, in natural units (default 1)

compute_e_field(x1: ndarray, x2: ndarray, x3: ndarray, t: ndarray, h_sym, t_sym, verbose, delayed, compute_grid, compute_txt)

Compute the electric field from the moments. The method recurse() and set_moments(…) must be run beforehand.

Parameters:
  • x1 – array of the spatial coordinates to evaluate the e_field-field at (aka x)

  • x2 – array of the spatial coordinates to evaluate the e_field-field at (aka y)

  • x3 – array of the spatial coordinates to evaluate the e_field-field at (aka z)

  • t – array of the time coordinates to evaluate the e_field-field at

  • h_sym – time-dependent excitation

  • t_sym – symbolic variable representing time, used in h_sym

  • verbose – whether to display the progress (default False)

  • delayed – whether to evaluate the field at the retarded time t-r/c (default True)

  • compute_grid – whether to compute all combinations of coordinates

  • compute_txt – whether to compute a text representation of the solution or not

Raises:
  • RuntimeError – when any of recurse or set_moments have not been run.

  • ValueError – when h_sym does not look like what is described below

Return type:

a np.ndarray with the electric field, whose shape is (3, x1.size, t.size)

The time-dependent excitation h_sym can either be a symbolic time-dependent (t_sym) function describing the shape of the current or a dictionary of numpy arrays of the same shape as t, each array containing the values of the nth order derivative of the time-dependent function. The keys of the dictionary must be the integers in the range -1..max_order+2.

get_e_field_text() unicode

Get a text description of the electric field. Returns an empty string if the method :compute_e_field: has not yet been called.

Returns:

a human-readable description of the electric field

recurse(verbose: bool) None

Compute the auxiliary function up to the max order.

Parameters:

verbose – whether to print the computed multi-index (default False)

set_moments(current_moment, charge_moment) None

Set the current and charge moment functions.

Parameters:
  • current_moment – a callable returning the current moment for a given multi-index a1, a2, a3

  • charge_moment – a callable returning the charge moment for a given multi-index a1, a2, a3

pynoza.helpers.get_charge_moment(current_moment: ndarray) ndarray

Compute a charge moment that is compatible with the conservation of charge

Parameters:

current_moment – an array with the current moments

Returns:

the corresponding charge moment

Return type:

ndarray

The moment at index (i, a1, a2, a3) is the moment of the i-th coordinate corresponding to the multi-index (a1, a2, a3)