tidy3d.Simulation

class tidy3d.Simulation(size=(0.0, 0.0, 0.0), center=(0.0, 0.0, 0.0), resolution=None, mesh_step=None, coords=None, structures=None, sources=None, monitors=None, symmetries=(0, 0, 0), pml_layers=(0, 0, 0), run_time=0.0, courant=0.9, shutoff=1e-05, subpixel=True)

Main class for building a simulation model.

__init__(size=(0.0, 0.0, 0.0), center=(0.0, 0.0, 0.0), resolution=None, mesh_step=None, coords=None, structures=None, sources=None, monitors=None, symmetries=(0, 0, 0), pml_layers=(0, 0, 0), run_time=0.0, courant=0.9, shutoff=1e-05, subpixel=True)

Construct.

Parameters
  • center (array_like, optional) – (micron) 3D vector defining the center of the simulation domain.

  • size (array_like, optional) – (micron) 3D vector defining the size of the simulation domain.

  • resolution (float or array_like, optional) – (1/micron) Number of grid points per micron, or a 3D vector defining the number of grid points per mircon in x, y, and z.

  • mesh_step (float or array_like, optional) – (micron) Step size in all directions, or a 3D vector defining the step size in x, y, and z seprately. If provided, mesh_step overrides the resolution parameter, otherwise mesh_step = 1/resolution.

  • coords (List[array_like], optional) – (micron) If provided, overrides center, size, and mesh_step/resolution. A list of three arrays defining the beginning and end points of the discretization grid to be used in the three dimensions. For a given dimension, if Nd is the size of coords[d], this then defines Nd - 1 Yee grid cells, and the simulation span in that dimension is from coords[d][0] to coords[d][-1].

  • structures (Structure or List[Structure], optional) – Empty list (default) means vacuum.

  • sources (Source or List[Source], optional) – Source(s) to be added to the simulation.

  • monitors (Monitor or List[Monitor], optional) – Monitor(s) to be added to the simulation.

  • symmetries (array_like, optional) – Array of three integers defining reflection symmetry across a plane bisecting the simulation domain normal to the x-, y-, and z-axis, respectively. Each element can be 0 (no symmetry), 1 (even, i.e. ‘PMC’ symmetry) or -1 (odd, i.e. ‘PEC’ symmetry). Note that the vectorial nature of the fields must be taken into account to correctly determine the symmetry value.

  • pml_layers (array_like, optional) – Array of three elements defining the PML boundaries on both sides of the simulation domain along x, y, and z, respectively. Default is 0 on all sides, in which case periodic boundary conditions are applied. If element is an integer, defines the number of PML layers using the 'standard' profile. If element is a string, it defines the profile, one of 'standard', 'stable' or 'absorber', which come with a default number of layers. 'absorber' is a simple adiabatically tapered absorbing material. Finally, each element can also be a dictionary of the form {'profile': 'standard', 'Nlayers': 20}, defining a custom combination of profile and number of layers.

  • run_time (float, optional) – (second) Total electromagnetic evolution time.

  • shutoff (float, optional) – The simulation will automatically shut down if the ratio of the integrated E-field intensity at the current time step over the maximum integrated intensity at a previous time step becomes lower than the shutoff factor. Set to 0 to disable this feature.

  • courant (float, optional) – Courant stability factor, must be smaller than 1, or more generally smaller than the smallest refractive index in the simulation.

  • subpixel (boolean, optional) – Whether to enable subpixel permittivity averaging.

Methods

__init__([size, center, resolution, …])

Construct.

compute_modes(mode_object, Nmodes[, …])

Compute the eigenmodes of the 2D cross-section of a ModeSource or ModeMonitor object, assuming translational invariance in the third dimension.

data(monitor)

Return a dictionary with all the stored data in a Monitor.

decompose(mode_monitor)

Compute the decomposition of the fields recorded in a ModeMonitor into the eigenmodes in the monitor plane.

epsilon([monitor, center, size, pec_val, …])

Compute the complex relative permittivity inside a volume.

export()

Return a dictionary with all simulation parameters and objects.

export_json(fjson)

Export the simulation specification to a JSON file.

flux(monitor[, normal])

Compute the area-integrated Poynting flux in a given direction.

import_json(fjson)

Import a simulation specification from a JSON file.

load_results(dfile[, ind_src_norm])

Load all monitor data recorded from a Tidy3D run.

poynting(monitor)

Compute the Poynting vector at every point recorded by a Monitor.

set_mode(source, mode_ind[, Nmodes, …])

Set the index of the mode to be used by the mode source.

set_monitor_modes(monitor[, Nmodes, …])

Set the parameters for the modes to be used in the modal decomposition in the monitor.

set_time([run_time, courant])

Change the value of the run time of the simulation and the time step determined by the courant stability factor.

spectrum(source, freqs)

Returns the spectrum of a Source.

viz_eps_2D([normal, position, ax, cbar, …])

Plot the real part of the relative permittivity distribution of a 2D cross-section of the simulation.

viz_field_2D(monitor[, sample_ind, normal, …])

Plot a 2D cross-section of a field stored in a Monitor.

viz_mat_2D([normal, position, ax, …])

Visualize the structures in a 2D cross-section of the simulation using a fake-color coding based on material index in the list of materials.

viz_modes(mode_obj[, freq_ind, mode_inds, …])

Plot the field distribution of the 2D eigenmodes of a ModeSource or a ModeMonitor object.

viz_source(source[, axs])

Plot both the time and frequency dependence of a source.

viz_source_spectrum(source[, ax, Nfreqs, flims])

Plot the frequency dependence of a source.

viz_source_time(source[, ax])

Plot the time dependence of a source.

Attributes

mat_inds

List containing the material index in materials of every structure in structures.

materials

List containing all materials included in the simulation.

monitors

List containing all Monitor objects.

sources

List containing all Source objects.

structures

List containing all Structure objects.