Commit 614e82a1 authored by Antoine RAVETTA's avatar Antoine RAVETTA

figures HSCN (r,t)

parent 12a1b9a9
......@@ -81,7 +81,7 @@
" ax.set_title('Time=%d' % i)\n",
"\n",
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[2], interval=100, repeat=True)"
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[2], interval=100, repeat=False)"
]
},
{
......@@ -148,15 +148,6 @@
"## Evolution of the wavepacket along t at r=0 against z"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(E_matrix[0,0,200])"
]
},
{
"cell_type": "code",
"execution_count": null,
......@@ -167,7 +158,7 @@
"ax.plot(t_pts, E_matrix[0,0,:])\n",
"ax.set_title(\"Beam temporal extension at z=0\")\n",
"ax.set_xlabel('t (s)')\n",
"ax.set_ylabel('E (unit ??)')\n",
"ax.set_ylabel('E (V/m)')\n",
"\n",
"popt, pcov = curve_fit(gaussian_temp, t_pts, E_matrix[0,0,:], p0=[1e-3, 17e-16, 1])\n",
"ax.plot(t_pts, [gaussian_temp(t, *popt) for t in t_pts], '--')\n",
......@@ -180,7 +171,7 @@
" ax.plot(t_pts, E_matrix[i,0,:])\n",
" ax.set_title(\"Beam temporal extension at z=%d\" %i)\n",
" ax.set_xlabel('t (s)')\n",
" ax.set_ylabel('E (unit ??)')\n",
" ax.set_ylabel('E (V/m)')\n",
" popt, pcov = curve_fit(gaussian_temp, t_pts, E_matrix[i,0,:], p0=[1e-3, 17e-16, 1])\n",
" ax.plot(t_pts, [gaussian_temp(t, *popt) for t in t_pts], '--')\n",
" temp_sigmas.append(popt[1])\n",
......@@ -205,19 +196,24 @@
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots()\n",
"fig, ax = plt.subplots(figsize=(9,7))\n",
"\n",
"ax.plot(z_pts, temp_sigmas[1:])\n",
"ax.plot(z_pts, temp_sigmas[1:], label=\"fitted waists\")\n",
"\n",
"def func(x, a, c):\n",
" return c * np.sqrt(1 + a * x ** 2)\n",
"\n",
"popt, pcov = curve_fit(func, z_pts, temp_sigmas[1:])\n",
"\n",
"ax.plot(z_pts, [func(z, *popt) for z in z_pts], '--')\n",
"ax.plot(z_pts, [func(z, *popt) for z in z_pts], '--', label=\"tp * (1 + (z/zT)^2)^(1/2) \\n tp = {:e} m \\n zT = {:f} m\".format(popt[1], 1/np.sqrt(popt[0])))\n",
"\n",
"ax.set_title(\"Beam temporal width evolution along z and its fit\")\n",
"ax.set_ylabel(\"tp(z) (m)\")\n",
"ax.set_xlabel(\"z (m)\")\n",
"\n",
"ax.legend()\n",
"\n",
"print(popt)\n",
"print(1/np.sqrt(popt[0]))"
"fig.savefig(\"temp_characteristic_length.png\", dpi=300)"
]
},
{
......@@ -230,7 +226,7 @@
"ax.plot(full_r_pts, np.concatenate((np.flip(E_matrix[0,:,E_matrix.shape[2]//2], axis=0), E_matrix[0,:,E_matrix.shape[2]//2])))\n",
"ax.set_title(\"Beam spatial extension at z=0\")\n",
"ax.set_xlabel('r (m)')\n",
"ax.set_ylabel('E (unit ??)')\n",
"ax.set_ylabel('E (V/m)')\n",
"\n",
"popt, pcov = curve_fit(gaussian_space, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,E_matrix.shape[2]//2], axis=0), E_matrix[0,:,E_matrix.shape[2]//2])), p0=[1e-3, 1])\n",
"ax.plot(full_r_pts, [gaussian_space(r, *popt) for r in full_r_pts], '--')\n",
......@@ -242,7 +238,7 @@
" ax.plot(full_r_pts, np.concatenate((np.flip(E_matrix[i,:,E_matrix.shape[2]//2], axis=0), E_matrix[i,:,E_matrix.shape[2]//2])))\n",
" ax.set_title(\"Beam spatial extension at z=%d\" %i)\n",
" ax.set_xlabel('r (r)')\n",
" ax.set_ylabel('E (unit ??)')\n",
" ax.set_ylabel('E (V/m)')\n",
" popt, pcov = curve_fit(gaussian_space, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,E_matrix.shape[2]//2], axis=0), E_matrix[i,:,E_matrix.shape[2]//2])), p0=[1e-3, 1])\n",
" ax.plot(full_r_pts, [gaussian_space(r, *popt) for r in full_r_pts], '--')\n",
" space_sigmas.append(popt[0])\n",
......@@ -257,19 +253,24 @@
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots()\n",
"fig, ax = plt.subplots(figsize=(9,7))\n",
"\n",
"ax.plot(z_pts, space_sigmas[1:])\n",
"ax.plot(z_pts, space_sigmas[1:], label=\"fitted waists\")\n",
"\n",
"def func(x, a, c):\n",
" return c * np.sqrt(1 + a * x ** 2)\n",
"\n",
"popt, pcov = curve_fit(func, z_pts, space_sigmas[1:])\n",
"\n",
"ax.plot(z_pts, [func(z, *popt) for z in z_pts], '--')\n",
"ax.plot(z_pts, [func(z, *popt) for z in z_pts], '--', label=\"w0 * (1 + (z/zR)^2)^(1/2) \\n w0 = {:f} m \\n zR = {:f} m\".format(popt[1], 1/np.sqrt(popt[0])))\n",
"\n",
"ax.set_title(\"Beam spatial width evolution along z and its fit\")\n",
"ax.set_ylabel(\"w(z) (m)\")\n",
"ax.set_xlabel(\"z (m)\")\n",
"\n",
"ax.legend()\n",
"\n",
"print(popt)\n",
"print(1/np.sqrt(popt[0]))"
"fig.savefig(\"space_characteristic_length.png\", dpi=300)"
]
},
{
......@@ -278,14 +279,15 @@
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(10,8))\n",
"fig, ax = plt.subplots(figsize=(9,7))\n",
"cm = ax.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])))\n",
"ax.set_title(\"Beam spatio-temporal extension at z=0\")\n",
"ax.set_xlabel('t (s)')\n",
"ax.set_ylabel('r (m)')\n",
"fig.colorbar(cm)\n",
"cb = fig.colorbar(cm)\n",
"cb.set_label('E (V/m)')\n",
"\n",
"plt.savefig('diffraction_init.png')"
"plt.savefig('diffraction_init.png', dpi=300)"
]
},
{
......@@ -294,14 +296,15 @@
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots(figsize=(10,8))\n",
"fig, ax = plt.subplots(figsize=(9,7))\n",
"cm = ax.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[-1,:,:], axis=0), E_matrix[-1,:,:])))\n",
"ax.set_title(\"Beam spatio-temporal extension at z=10m\")\n",
"ax.set_xlabel('t (s)')\n",
"ax.set_ylabel('r (m)')\n",
"fig.colorbar(cm)\n",
"cb = fig.colorbar(cm)\n",
"cb.set_label('E (V/m)')\n",
"\n",
"plt.savefig('diffraction_end.png')"
"plt.savefig('diffraction_end.png', dpi=300)"
]
},
{
......
......@@ -273,7 +273,7 @@ The following figure shows what we obtained :
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{../figures/CCCN/CCCN.png}
\caption{Visualisation of the intensity ($\frac{|E|^2}{c \mu_0}$) of a diffracting gaussian beam propogating along $z$. The figure was obtained with $\lambda = 700$nm, $w_0 = 1$mm, $P_{in} = 1$W, $D_{diff} = \frac{i}{2k}$, the Crank-Nicolson grid had 100 points between 0 and 1 cm along r and 200 points between 0 and 10m along z. The potential was $V(r) = \frac{D_{diff}}{r}$}
\caption{Visualisation of the intensity ($\frac{|E|^2}{c \mu_0}$) of a diffracting gaussian beam propogating along $z$. The figure was obtained with $\lambda = 700$nm, $w_0 = 1$mm, $P_{in} = 1$W, the Crank-Nicolson grid had 100 points between 0 and 1 cm along r and 200 points between 0 and 10m along z.$}
\end{figure}
We then have to check if our result matches the theoretical calculations. We thus have calculated the theoretical evolution of the beam width and amplitude according to Wikipedia. We then fitted for each z the beam profile along r to a gaussian and plotted these results against the theoretical ones :
......@@ -292,10 +292,8 @@ We then have to check if our result matches the theoretical calculations. We thu
\subsection{Diffraction and Dispersion}
\paragraph{}
We then added the time dependency to the equation, thus going from a 2D problem to a 3D one. To visualize both the space diffraction
and the time dispersion, we coded some animations which can be found in the "analyse" folder, the file is called "data\_plot\_3D.ipynb".
\paragraph{}
If we just look at the value of $|E|$ in the $(r,t)$ plane for each position $z$, we clearly see that the time dispersion and the space diffraction occur on different and uncorrelated scales.
% Animation ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment