{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Laser Pulse in Space Only\n", "\n", "In this example we look at the special case where one is only interested in defining and manipulating the spatial profile of the laser pulse. In this case, having a full 3D or quasi-3D profile is an inefficient use of resources. For this purpose, we have defined the longitudinal laser profile `ContinuousWaveProfile` which allows one to treat the longitudinal profile as a 1 pixel continuous wave laser in time." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Generate a Gaussian Profile in Space with a Continuous Wave Longitudinal Profile\n", "\n", "One key difference you might notice to the traditional definition of the laser pulse is that we do not use the laser energy to scale the amplitude of the electric field, but in this case we use the peak intensity of the laser pulse" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from scipy.constants import c, epsilon_0\n", "\n", "from lasy.laser import Laser\n", "from lasy.profiles import CombinedLongitudinalTransverseProfile\n", "from lasy.profiles.longitudinal import ContinuousWaveProfile\n", "from lasy.profiles.transverse import GaussianTransverseProfile\n", "from lasy.utils.laser_utils import compute_laser_energy, get_w0\n", "\n", "# Physical Parameters\n", "peak_fluence = 1.0e4 # J/m^2\n", "spot_size = 10e-3\n", "wavelength = 800e-9\n", "pol = (1, 0)\n", "\n", "long_prof = ContinuousWaveProfile(wavelength)\n", "tran_prof = GaussianTransverseProfile(spot_size)\n", "profile = CombinedLongitudinalTransverseProfile(\n", " wavelength, pol, long_prof, tran_prof, peak_fluence=peak_fluence\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the Computational Grid\n", "\n", "Here we should note the the `lo` and `hi` variables have been passed as `None` for the longitudinal axis as it is a continuous wave laser. Additionally, the number of points along the longitudinal dimension is 1." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Computational Grid\n", "dim = \"xyt\"\n", "lo = (-5 * spot_size, -5 * spot_size, None)\n", "hi = (5 * spot_size, 5 * spot_size, None)\n", "npoints = (1000, 1000, 1)\n", "\n", "laser = Laser(dim, lo, hi, npoints, profile)\n", "\n", "laser.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Visualizing and Analyzing the Pulse\n", "\n", "We see that the standard `laser.show()` command works here and we indeed get a laser which is invariant in time.\n", "\n", "One can also extract the laser intensity and use this to visualize the pule." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intensity = epsilon_0 * c / 2 * np.abs(laser.grid.get_temporal_field()) ** 2\n", "fluence = np.sum(intensity, axis=-1) * laser.grid.dx[-1]\n", "extent = (\n", " laser.grid.axes[0].min() * 1e3,\n", " laser.grid.axes[0].max() * 1e3,\n", " laser.grid.axes[1].min() * 1e3,\n", " laser.grid.axes[1].max() * 1e3,\n", ")\n", "plt.figure()\n", "plt.imshow(fluence, extent=extent)\n", "plt.xlabel(\"x (mm)\")\n", "plt.ylabel(\"y (mm)\")\n", "plt.colorbar(label=r\"Fluence (J/m$^2$)\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Adding Optics\n", "\n", "Optics can be added in the usual way to manipulate the laser pulse.\n", "Additionally, standard `laser_utils` functions work out of the box.\n", "\n", "Also for this kind of beam, the propagators may be used.\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w0_meas = get_w0(laser.grid, laser.dim)\n", "energy0_meas = compute_laser_energy(laser.dim, laser.grid)\n", "\n", "from lasy.optical_elements import ParabolicMirror\n", "\n", "focal_length = 100\n", "oap = ParabolicMirror(focal_length)\n", "\n", "laser.apply_optics(oap)\n", "laser.propagate(focal_length)\n", "\n", "w1_meas = get_w0(laser.grid, laser.dim)\n", "w1_expt = 2 * np.sqrt(2) / np.pi * wavelength * focal_length / (2 * spot_size)\n", "energy1_meas = compute_laser_energy(laser.dim, laser.grid)\n", "\n", "\n", "print(\"Initial Spot Size = %.2f mm\" % (w0_meas * 1e3))\n", "print(\"Final Spot Size = %.2f mm\" % (w1_meas * 1e3))\n", "print(\"Expected Final Spot Size = %.2f mm\" % (w1_meas * 1e3))\n", "print(\"Initial Pulse Energy = %.2f J\" % (energy0_meas))\n", "print(\"Final Pulse Energy = %.2f J\" % (energy1_meas))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "intensity = epsilon_0 * c / 2 * np.abs(laser.grid.get_temporal_field()) ** 2\n", "fluence = np.sum(intensity, axis=-1) * laser.grid.dx[-1]\n", "extent = (\n", " laser.grid.axes[0].min() * 1e3,\n", " laser.grid.axes[0].max() * 1e3,\n", " laser.grid.axes[1].min() * 1e3,\n", " laser.grid.axes[1].max() * 1e3,\n", ")\n", "plt.figure()\n", "plt.imshow(fluence, extent=extent)\n", "plt.xlabel(\"x (mm)\")\n", "plt.ylabel(\"y (mm)\")\n", "plt.colorbar(label=r\"Fluence (J/m$^2$)\")" ] } ], "metadata": { "kernelspec": { "display_name": "splice2025", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 2 }