An emitter such as an LED active region radiates incoherent light. Reproducing that in FDTD means simulating its dipoles individually: dipoles placed in the same run would interfere with each other, so each position and each orientation needs its own simulation, with an incoherent sum of the resulting far fields. The cost therefore grows with the number of emitters sampled, which is what makes a well sampled active region expensive, as illustrated in the Blue micro-LEDs with inclined sidewalls example.
With DipoleEmissionStudy the cost is set by the observation angle grid instead: one simulation per angle handles an arbitrary number of dipole positions, chosen by the user, so sampling ten thousand emitters costs the same as sampling five.
This notebook covers two cases:
A small LED-like die, where the plugin is validated point by point against explicit dipole simulations (5 positions, \(\phi = 0\), \(\theta\) from \(0^\circ\) to \(110^\circ\)), including how to set the angles correctly beyond the reach of a single collection face.
A larger die, where 5 positions are visibly too few, while the plugin averages 10,000 positions at the same simulation cost.
Note: the total cost of running the entire notebook is about 28 FlexCredits.
import numpy as npimport matplotlib.pyplot as pltimport tidy3d as tdimport tidy3d.web as webfrom tidy3d.constants import C_0, MU_0, ETA_0from tidy3d.plugins.dipole_emission import DipoleEmissionStudy, EmissionAnalysisRegiontd.config.logging.warn_once =True# the probe simulations repeat the same setup warningslda0 =0.45# umfreq0 = C_0 / lda0n_GaN =2.45dl = lda0 / n_GaN /15source_time = td.GaussianPulse(freq0=freq0, fwidth=freq0 /10)
Small Die: Validation Against One Dipole at a Time
The die is a GaN mesa (\(n = 2.45\), \(1.2 \times 1.2 \times 0.3\ \mu\text{m}\)) on a sapphire substrate (\(n = 1.75\)), with 5 dipole positions in an X pattern on the mesa mid-plane. The substrate is kept inside the analysis region, so that both collection faces of the region still sit in the uniform air background, as the plugin requires.
The fixed-angle plane wave probes used by a study are limited to \(|\theta| \le \pi/2 - 0.1\) rad \(\approx 84.3^\circ\)from the collection normal, and each study collects one half-space. Covering up to \(110^\circ\) from vertical therefore takes two studies:
Top collection (normal_axis=2, direction="+") covers \(\theta = 0\) to \(84^\circ\) from vertical, with angle pairs \((\theta,\ \phi)\).
Lateral collection (normal_axis=0, direction="+") covers \(\theta = 84^\circ\) to \(110^\circ\), including directions below the horizon. Its angles are measured from the \(+x\) axis, and the pair that probes the direction \(\theta\) from vertical in the \(xz\) plane is
The sign of \(\phi\) matters. The direction field only selects which side of the collection axis the probe comes from, while the transverse tilt is set by \(\phi\) as given. With \(\phi = -90^\circ\) the observation direction tilts toward \(+z\), as intended. With \(\phi = +90^\circ\) it tilts toward \(-z\), so the study would sample the direction mirrored through the horizon (\(180^\circ - \theta\)) while labeling it \(\theta\). In general, for an observation direction \(\hat{n}\) collected through the \(+a\) face, with transverse axes \(t_1 < t_2\):
Two practical points. Skip \(\theta = 90^\circ\) exactly, where the probe reaches the collection face at normal incidence and the polarization label becomes degenerate, and bracket that direction with \(88^\circ\) and \(92^\circ\) instead. Measure a few angles with both faces (here \(72^\circ\), \(78^\circ\) and \(84^\circ\)) to check that the two studies agree where they overlap.
The Simulation of the Device
A study takes a source-freeSimulation of the passive device and generates its own probe simulations from it. Everything that describes the device goes here: structures, medium, grid, boundaries and run time.
analysis_region: an EmissionAnalysisRegion enclosing the emitters and the part of the device that shapes their radiation. Its normal_axis and direction select the collection half-space, while dl sets the resolution of the probe fields in the plane transverse to the collection direction.
positions: the dipole locations, as a PointDataArray. Any number of positions can be listed, and the cost does not depend on it.
source_time: the spectral envelope of the emission, a GaussianPulse here, which is divided out again by angular_radiation_transfer.
freqs: the frequencies at which the emission is evaluated.
angles: the observation directions, as (theta, phi) pairs measured from the collection normal.
polarizations: which far-field polarizations to evaluate, "p" (in the plane of the observation direction and the collection normal) and/or "s". Each angle and polarization pair is one simulation.
Two studies are built, one per collection face, sharing the same device, positions and source.
pts = [(0.0, 0.0, 0.0), (0.3, 0.3, 0.0), (-0.3, 0.3, 0.0), (-0.3, -0.3, 0.0), (0.3, -0.3, 0.0)]positions = td.PointDataArray(pts, coords=dict(index=np.arange(len(pts)), axis=np.arange(3)))theta_top = np.arange(0, 85, 6, dtype=float) # from vertical, top collectiontheta_lat = np.array([72.0, 78.0, 84.0, 88.0, 92.0, 96.0, 100.0, 105.0, 110.0]) # from vertical, lateral collectiondef make_study(normal_axis, angle_pairs): region = EmissionAnalysisRegion(center=(0, 0, -0.1), size=(1.8, 1.8, 1.0), normal_axis=normal_axis, direction="+", dl=dl) angles = td.SphericalAngleDataArray( [(np.deg2rad(t), p) for t, p in angle_pairs], coords=dict(index=np.arange(len(angle_pairs)), spherical_coordinate=["theta", "phi"]), )return DipoleEmissionStudy(base_sim=sim_small, analysis_region=region, positions=positions, source_time=source_time, freqs=[freq0], angles=angles, polarizations=("p",))study_top = make_study(2, [(t, 0.0) for t in theta_top]) # angles from +zstudy_lat = make_study(0, [(90- t, -np.pi /2) for t in theta_lat]) # angles from +x, phi = -90 degprint(f"{len(study_top.to_simulations())} probe simulations for the top collection, "f"{len(study_lat.to_simulations())} for the lateral one, {len(pts)} dipole positions in both")
17:01:55 UTC WARNING: Override structures take no effect along x-axis. If
intending to apply override structures to this axis, use 'AutoGrid'
or 'QuasiUniformGrid'.
WARNING: Override structures take no effect along y-axis. If
intending to apply override structures to this axis, use 'AutoGrid'
or 'QuasiUniformGrid'.
WARNING: TFSF source at index '0' uses 'FixedAngleSpec' with
angle_theta=0. At normal incidence the default 'FixedInPlaneKSpec'
(Bloch TFSF) is physically equivalent and runs faster. Consider
switching unless you specifically need the fixed-angle path.
WARNING: Override structures take no effect along z-axis. If
intending to apply override structures to this axis, use 'AutoGrid'
or 'QuasiUniformGrid'.
15 probe simulations for the top collection, 9 for the lateral one, 5 dipole positions in both
Reference: Explicit Dipole Simulations
Each position needs three orthogonal orientations, so the 5 positions cost 15 simulations, each with a single PointDipole. A closed FieldProjectionAngleMonitor box around the die gives the far field, and the incoherent average adds \(|E_\theta|^2\) over the runs. Dividing by the analytic bulk power \(\omega^2\mu_0 n/(12\pi c)\) of one dipole makes the result directly comparable with the transfer reported by the plugin.
theta_ref = np.deg2rad(np.arange(0, 111.5, 1.0))proj_small = td.FieldProjectionAngleMonitor(center=(0, 0, -0.1), size=(1.8, 1.8, 1.0), freqs=[freq0], theta=theta_ref, phi=[0.0], far_field_approx=True, name="ff")sims_expl_small = {f"p{i}_{pol}": sim_small.updated_copy( sources=[td.PointDipole(center=pt, polarization=pol, source_time=source_time)], monitors=[proj_small], )for i, pt inenumerate(pts)for pol in ("Ex", "Ey", "Ez")}print(f"{len(sims_expl_small)} simulations for the reference ({len(pts)} positions x 3 orientations)")
15 simulations for the reference (5 positions x 3 orientations)
The two collection faces agree with the reference and with each other, including at the three angles measured twice and in the range beyond the horizon, which only the lateral study can reach.
Larger Die: Five Positions Are Not Enough
A larger GaN die (\(4 \times 1.1 \times 1.5\ \mu\text{m}\)) on its sapphire substrate, both with a small loss \(k = 10^{-3}\) so that the runs decay quickly, with the emission evaluated at \(\theta = 0\) to \(50^\circ\) from vertical over 10 angles, using top collection only. The explicit reference keeps 5 positions and 15 simulations, while the study samples 10,000 positions over the active plane with 10 simulations, one per angle.
Five positions leave strong interference lobes from the sparse sample, while ten thousand positions, at the cost of one simulation per angle, give the smooth pattern expected of a genuinely incoherent source.
Convergence With the Number of Dipoles
store_position_indexes keeps the radiation intensity of each sampled position, so the average over any subset of the 10,000 positions is available in post-processing, from the same 10 simulations. Averaging over the first \(N\) positions and comparing with the full average shows how many positions the incoherent sum needs.
per_position = data_large.angular_radiation_transfer_at_positions(n_GaN).sel(f=freq0, polarization="p").sum("dipole_axis")subsets = [5, 20, 100, 500, 2000, 10000]curves = {n: per_position.isel(index=slice(0, n)).mean("index").values for n in subsets}reference = curves[max(subsets)]for n in subsets: deviation = np.max(np.abs(curves[n] - reference)) / reference.max()print(f"{n:>6} positions: max deviation from the {max(subsets)}-position average = {100* deviation:5.1f} %")fig, ax = plt.subplots(figsize=(8, 4.8))colors = plt.cm.viridis(np.linspace(0, 0.85, len(subsets)))for n, color inzip(subsets, colors): ax.plot(theta_large, curves[n], "o-", ms=4, color=color, label=f"{n} positions")ax.set_xlabel("theta from vertical (degree)")ax.set_ylabel("p-pol transfer at phi = 0 (1/sr)")ax.set_title("Incoherent average over the first N of the 10,000 sampled positions")ax.set_ylim(bottom=0)ax.grid(True, alpha=0.3)ax.legend(fontsize=8)plt.show()
5 positions: max deviation from the 10000-position average = 29.0 %
20 positions: max deviation from the 10000-position average = 17.7 %
100 positions: max deviation from the 10000-position average = 10.9 %
500 positions: max deviation from the 10000-position average = 5.7 %
2000 positions: max deviation from the 10000-position average = 2.6 %
10000 positions: max deviation from the 10000-position average = 0.0 %
A single subset is one particular draw of emitters, so the curves above still depend on which positions were picked. Repeating the draw many times at one angle, here \(\theta = 0\), separates the bias from the scatter: each point below is the mean over 20 random subsets of a given size, and the error bar is their standard deviation, which is the uncertainty a study of that size carries.
spread_at_0 = per_position.isel(angle=0).valuessizes = [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000]rng_subsets = np.random.default_rng(1)draws = {n: [spread_at_0[rng_subsets.choice(len(spread_at_0), size=n, replace=False)].mean() for _ inrange(20)]for n in sizes}mean_n = np.array([np.mean(draws[n]) for n in sizes])std_n = np.array([np.std(draws[n]) for n in sizes])for n, m, s inzip(sizes, mean_n, std_n):print(f"{n:>5} positions: {m:.4f} +/- {s:.4f} 1/sr ({100* s / m:4.1f} %)")fig, ax = plt.subplots(figsize=(8, 4.8))ax.errorbar(sizes, mean_n, yerr=std_n, fmt="o-", ms=5, capsize=3, color="tab:blue", label="random subsets (mean +/- standard deviation over 20 draws)")ax.axhline(spread_at_0.mean(), color="k", ls=":", lw=1.2, label="all 10,000 positions")ax.set_xscale("log")ax.set_xlabel("number of dipole positions in the incoherent sum")ax.set_ylabel("p-pol transfer at theta = 0 (1/sr)")ax.set_title("Spread of the incoherent average at theta = 0")ax.grid(alpha=0.3)ax.legend(fontsize=9)plt.show()
We use necessary cookies to run this website. With your permission, we
also use analytics cookies to understand site usage and marketing
cookies for advertising, retargeting, and HubSpot tracking.
Learn more about our cookie policy.
Privacy choices
Choose which optional cookies Flexcompute may use. Necessary cookies
are always on because they support core website behavior, security, and
saving your consent record.
Your browser is sending a Global Privacy Control signal, so marketing
cookies are disabled.
Subscribe
Publish Your Notebook
Thank you for publishingA confirmation email has been sent to your inbox. Your notebook will be available within the next 48 hours.
Community Library
TERMS & CONDITIONS
EFFECTIVE DATE: January 1, 2025
Terms and Conditions for User-Submitted Content
By submitting content to Flexcompute, you agree to the following terms:
1. Ownership and Copyright
All content, including but not limited to text, data, images, and other materials submitted by users,
remains the sole property of the original creator. Flexcompute does not claim ownership of the submitted
content or any intellectual property rights associated with it.
Users affirm that they own the copyright or have obtained all necessary permissions for the submitted
content and are fully responsible for ensuring that their submissions do not infringe on any third-party
rights.
2. Responsibility for Content
Users are solely responsible for the content they submit. Flexcompute does not endorse, guarantee,
or verify the accuracy, legality, or appropriateness of any submitted content. Users are responsible
for ensuring that their content complies with all applicable laws and regulations.
Users declare that they have obtained authorization from all co-authors and collaborators associated
with the submitted content, granting them the right to submit and sign on behalf of all contributors.
Users agree not to submit content that is illegal, defamatory, obscene, or violates the rights
of others, including privacy and intellectual property rights.
3. Modification and Presentation
Flexcompute reserves the right to review, edit, or modify submitted content to improve clarity,
formatting, and presentation while maintaining the original intent and message.
These modifications are made to enhance the overall quality and readability of the published material.
Users acknowledge that Flexcompute may format or present the content in a way
that aligns with our editorial and visual standards.
4. Liability Disclaimer
Flexcompute shall not be held liable for any disputes arising from user-submitted content, including
but not limited to copyright claims, inaccuracies, or damages resulting from the publication of user content.
Users agree to indemnify Flexcompute against any claims or legal actions resulting from their submitted content.
5. Content Use Rights
By submitting content, users grant Flexcompute a non-exclusive, royalty-free, worldwide license to publish, distribute,
and promote the content for the purposes of showcasing user contributions and marketing our services.
This license does not transfer ownership of the content or any copyright to Flexcompute.
Users retain the right to withdraw their submissions at any time.
Upon request, Flexcompute will remove the content from its platform.
6. Privacy and Confidentiality
Users acknowledge that submitted content may be publicly accessible and therefore waive any
rights to confidentiality or privacy regarding the published material.
Flexcompute will not share personal information of users without
their consent, in accordance with our privacy policy.
Community Library
How the process works:
You submit your notebook.
You will get a permanent URL to promote your work.
Cite the URL as a reference for others in your upcoming papers to enhance the impact.
When someone clicks your URL, your notebook will be displayed.
Enter your email address below to receive the presentation slides. In the future, we’ll share you very few emails when we have new tutorial release, development updates, valuable toolkits and technical guidance . You can unsubscribe at any time by clicking the link at the bottom of every email. We’ll never share your information.