tidy3d.FluxMonitor#
- class FluxMonitor[source]#
Bases:
AbstractFluxMonitor,FreqMonitorMonitorthat records power flux in the frequency domain.- Parameters:
center (tuple[Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box], Union[float, autograd.tracer.Box]] = (0.0, 0.0, 0.0)) – [units = um]. Center of object in x, y, and z.
size (tuple[Union[NonNegativeFloat, autograd.tracer.Box], Union[NonNegativeFloat, autograd.tracer.Box], Union[NonNegativeFloat, autograd.tracer.Box]]) – [units = um]. Size in x, y, and z directions.
name (str) – Unique name for monitor.
interval_space (tuple[Literal[1], Literal[1], Literal[1]] = (1, 1, 1)) – Number of grid step intervals between monitor recordings. If equal to 1, there will be no downsampling. If greater than 1, the step will be applied, but the first and last point of the monitor grid are always included. Not all monitors support values different from 1.
colocate (bool = True) – Governed by
use_colocated_integrationand not set independently for surface-integration monitors: it mirrors that value, so the solver records colocated fields exactly when the integration is colocated.use_colocated_integration (bool = True) – Selects the surface-integration scheme. If
True(default), the integral is computed from fields colocated to the grid cell boundaries (primal nodes). IfFalse, it is computed directly on the native Yee-staggered grid: the tangential field components stay at their tangential positions.freqs (ArrayLike[dtype=float, ndim=1]) – [units = Hz]. Array or list of frequencies stored by the field monitor.
apodization (
ApodizationSpec= ApodizationSpec()) – Sets parameters of (optional) apodization. Apodization applies a windowing function to the Fourier transform of the time-domain fields into frequency-domain ones, and can be used to truncate the beginning and/or end of the time signal, for example to eliminate the source pulse when studying the eigenmodes of a system. Note: apodization affects the normalization of the frequency-domain fields.normal_dir (Optional[Literal['+', '-']] = None) – Direction of the surface monitor’s normal vector w.r.t. the positive x, y or z unit vectors. Must be one of
'+'or'-'. Applies to surface monitors only, and defaults to'+'if not provided.exclude_surfaces (Optional[tuple[Literal['x-', 'x+', 'y-', 'y+', 'z-', 'z+'], ...]] = None) – Surfaces to exclude in the integration, if a volume monitor.
enable_adjoint (bool = False) – Enable adjoint differentiation for this flux monitor. When
True, autograd forward runs store hidden tangential field data on this monitor’s integration surface(s) for all requested frequencies. This can increase task storage, memory use, and local download size. Defaults toFalseto avoid this cost for observational flux monitors.
Notes
If the monitor geometry is a 2D box, the total flux through this plane is returned, with a positive sign corresponding to power flow in the positive direction along the axis normal to the plane. If the geometry is a 3D box, the total power coming out of the box is returned by integrating the flux over all box surfaces (except the ones defined in
exclude_surfaces).Practical Advice
If measured transmission exceeds 1.0 or is negative, verify that the monitor normal axis aligns with the expected power flow direction. A common mistake is placing a flux monitor with its normal pointing opposite to the propagation direction.
Extracting transmission:
sim_data = web.run(sim, task_name="my_sim") flux = sim_data["flux_monitor"].flux # xarray DataArray indexed by frequency # If source injects 1W (ModeSource at center frequency), flux IS the transmission T = flux.values # For normalization against a reference simulation: # T = flux_device / flux_reference
Example
>>> monitor = FluxMonitor( ... center=(1,2,3), ... size=(2,2,0), ... freqs=[200e12, 210e12], ... name='flux_monitor')
Attributes
use_colocated_integrationcolocatenormal_direxclude_surfacesfreqsapodizationinterval_spacenamesizecenterMethods
storage_size(num_cells, tmesh)Size of monitor storage given the number of points after discretization.
- enable_adjoint#