.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/structured_media/antenna_rods.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_structured_media_antenna_rods.py: Finite dielectric rods for antenna-like scatterers ================================================== Use ``CylinderMedium`` to voxelize a finite dielectric rod. This is useful for antenna-like geometry studies when a dielectric refractive-index model is appropriate. Conducting currents, complex permittivity, and metal boundary conditions require a different electromagnetic solver. .. GENERATED FROM PYTHON SOURCE LINES 10-40 .. code-block:: Python import sys import matplotlib.pyplot as plt import numpy as np from bornsim import CylinderMedium, Grid, Rotation, Solver, Source from bornsim.units import ureg grid = Grid( shape=(16, 16, 24), spacing=25 * ureg.nanometer, ) tilt = Rotation( axis=(0, 1, 0), angle=18 * ureg.degree, ) rod = CylinderMedium( background_refractive_index=1.33, particle_refractive_index=1.50, radius=55 * ureg.nanometer, height=450 * ureg.nanometer, centre=np.zeros(3) * ureg.nanometer, axis=2, rotation=tilt, ) volume = rod.to_volume(grid=grid) .. GENERATED FROM PYTHON SOURCE LINES 42-46 Inspect the finite rod ---------------------- The cylinder has a circular cross-section and a finite end face. Rotation changes the geometry coordinates before voxel-centre sampling. .. GENERATED FROM PYTHON SOURCE LINES 46-57 .. code-block:: Python figure = volume.plot_3d( backend="plotly", mode="volume", field="refractive_index", ) figure.update_layout(title="Tilted finite dielectric rod") if "--no-browser" not in sys.argv: figure.show(renderer="browser") .. raw:: html .. GENERATED FROM PYTHON SOURCE LINES 58-63 %% Directional scattering ---------------------- This finite rod is solved with the first Born order. The result describes dielectric scattering from the voxelized rod, not a conducting antenna. .. GENERATED FROM PYTHON SOURCE LINES 63-90 .. code-block:: Python source = Source(wavelength=633 * ureg.nanometer) solver = Solver( source=source, order=1, ) angles = np.linspace(0, 180, 121) * ureg.degree result = solver.solve_cut( target=volume, angles=angles, ) cross_section = result.differential_cross_section.to("nanometer**2 / steradian") scattering_figure, scattering_axis = plt.subplots(figsize=(7, 4), layout="constrained") scattering_axis.plot(angles.to("degree").magnitude, cross_section.magnitude[-1]) scattering_axis.set( xlabel="Scattering angle (degrees)", ylabel="dσ/dΩ (nm² sr⁻¹)", title="Finite dielectric rod · first Born order", ) plt.show() .. image-sg:: /auto_examples/structured_media/images/sphx_glr_antenna_rods_001.png :alt: Finite dielectric rod · first Born order :srcset: /auto_examples/structured_media/images/sphx_glr_antenna_rods_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.296 seconds) .. _sphx_glr_download_auto_examples_structured_media_antenna_rods.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: antenna_rods.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: antenna_rods.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: antenna_rods.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_