10.5. Check power in Rayleigh-Sommerfeld propagation

In this example, we verify that the energy of the beam (here we use a Gauss beam) is constant for propagation. We use the XYZ module and Rayleigh-Sommerfeld algorithm.

[1]:
from diffractio import degrees, eps, mm, no_date, np, um, plt
from diffractio.scalar_fields_XYZ import Scalar_field_XYZ
from diffractio.scalar_masks_XY import Scalar_mask_XY
from diffractio.scalar_masks_XYZ import Scalar_mask_XYZ
from diffractio.scalar_sources_XY import Scalar_source_XY

[2]:
x0 = np.linspace(-100*um, 100*um, 256)
y0 = np.linspace(-100*um, 100*um, 256)
z0 = np.linspace(500*um, 10*mm, 32)
wavelength = .6328*um

[3]:
t1 = Scalar_source_XY(x=x0, y=y0, wavelength=wavelength)
t1.gauss_beam(r0=(0*um, 0*um), w0=40*um, z0=0.0, A=1, theta=0.0, phi=0.0)

uxyz = Scalar_mask_XYZ(x=x0, y=y0, z=z0, wavelength=wavelength)

uxyz.incident_field(u0=t1)

uxyz.RS(verbose=True, num_processors=1)

time in RS= 7.766473054885864. num proc= 4
[4]:
uxyz.draw_XZ(y0=0)

<Figure size 432x288 with 0 Axes>
../../_images/source_functioning_power_z_propagation_5_1.png
[5]:
intensity = np.abs(uxyz.u)**2

[6]:
total_energy = intensity.mean(axis=0).mean(axis=0)

[7]:
plt.plot(z0 / mm, total_energy, 'k')
plt.ylim(ymin=0, ymax=1.05 * total_energy.max())

../../_images/source_functioning_power_z_propagation_8_0.png
[8]:
plt.plot(z0 / mm, total_energy, 'k')

../../_images/source_functioning_power_z_propagation_9_0.png
[ ]: