...
 
Commits (4)
......@@ -15,9 +15,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"diff : 5.570423008216336e-08j\n"
]
}
],
"source": [
"import numpy as np\n",
"from CCCN import CrankNicolson\n",
......@@ -60,9 +68,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/antoine/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:20: RuntimeWarning: divide by zero encountered in true_divide\n",
"/home/antoine/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:20: RuntimeWarning: invalid value encountered in true_divide\n",
"/home/antoine/Desktop/PHY571/codes/CN_classes/CCCN.py:42: RuntimeWarning: invalid value encountered in multiply\n",
" nu = lambda x: - self.delta_z / 4. / self.delta_r * self.V(x) # minus sign for V convention\n"
]
}
],
"source": [
"crank = CrankNicolson()\n",
"\n",
......@@ -81,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
......
......@@ -17,7 +17,7 @@
"k_2 = 2e-28\n",
"\n",
"w0 = 1e-3\n",
"tp = 85e-15\n",
"tp = 17e-15\n",
"#tp = 1\n",
"Pin = 1\n",
"\n",
......@@ -25,7 +25,7 @@
"#diff_coeff = 0\n",
"#diff_coeff = 1e-4\n",
"disp_coeff = -1j*k_2/2\n",
"disp_coeff = 1j * 1e-27\n",
"#disp_coeff = 1j * 1e-27\n",
"#disp_coeff = 0\n",
"\n",
"print('diff :', diff_coeff)\n",
......@@ -85,14 +85,7 @@
"collapsed": true
},
"outputs": [],
"source": [
"fig, ax = plt.subplots()\n",
"mesh = ax.pcolormesh(z_pts, r_pts, E_matrix.T)\n",
"ax.set_xlabel('z')\n",
"ax.set_ylabel('r')\n",
"plt.colorbar(mesh, ax=ax)\n",
"fig.show()"
]
"source": []
}
],
"metadata": {
......
......@@ -22,16 +22,35 @@
"\n",
"\n",
"def plot_data(r_pts, z_pts, E_matrix):\n",
" fig, ax = plt.subplots()\n",
" mesh = ax.pcolormesh(z_pts, r_pts, E_matrix.T)\n",
" ax.set_xlabel('z')\n",
" ax.set_ylabel('r')\n",
" fig, ax = plt.subplots(figsize=(15,7))\n",
" mesh = ax.pcolormesh(z_pts, r_pts, E_matrix)\n",
" ax.set_title(\"Diffraction of a gaussian beam propagating along z and starting from (r,z) = (0,0)\", size=20)\n",
" ax.set_xlabel('z', size=20)\n",
" ax.set_ylabel('r', size=20)\n",
" ax.set_ylim([-0.005, 0.005])\n",
" plt.colorbar(mesh, ax=ax)\n",
" fig.show()\n",
" fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data_ary, r_pts, z_pts = import_data(data_path)\n",
"\n",
"c = 299792458\n",
"mu = np.pi * 4e-7\n",
"\n",
"data_ary, r_pts, z_pts = import_data(data_path)\n",
"plot_data(r_pts, z_pts, data_ary)"
"data_ary = data_ary ** 2 / (c * mu)\n",
"\n",
"full_r_pts = np.concatenate((np.flip(-r_pts), r_pts))\n",
"full_data_ary = np.concatenate((np.flip(data_ary.T, axis=0), data_ary.T))\n",
"\n",
"plot_data(full_r_pts, z_pts, full_data_ary)\n",
"\n",
"plt.savefig('CCCN', dpi=300)"
]
},
{
......
......@@ -21,7 +21,8 @@
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.animation as animation"
"import matplotlib.animation as animation\n",
"from mpl_toolkits.axes_grid1 import make_axes_locatable"
]
},
{
......@@ -44,6 +45,34 @@
"E_matrix, r_pts, z_pts, t_pts = import_data(data_path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots()\n",
"\n",
"def update(i):\n",
" ax.cla()\n",
" ax.plot(z_pts, E_matrix[:,0,i])\n",
" ax.set_title('Time=%d' % i)\n",
"\n",
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[2], interval=100, repeat=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fig, ax = plt.subplots()\n",
"\n",
"ax.plot(t_pts, [max(E_matrix[:,0,i]) for i in range(len(t_pts))])"
]
},
{
"cell_type": "code",
"execution_count": null,
......@@ -59,49 +88,95 @@
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"t_pts *= c\n",
"fig, ax = plt.subplots()\n",
"ax.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])), cmap=plt.cm.RdBu)\n",
"ax.set_title('Position=%d' % 0)\n",
"\n",
"fig = plt.figure()\n",
"plt.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])), cmap=plt.cm.RdBu)\n",
"plt.title('Position=%d' % 0)\n",
"div = make_axes_locatable(ax)\n",
"cax = div.append_axes('right', '5%', '5%')\n",
"\n",
"\n",
"def update(i):\n",
" plt.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,:], axis=0), E_matrix[i,:,:])), cmap=plt.cm.RdBu)\n",
" plt.title('Position=%d' % i)\n",
" cm = ax.pcolormesh(t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,:], axis=0), E_matrix[i,:,:])), cmap=plt.cm.RdBu)\n",
" ax.set_title('Position=%d' % i)\n",
" cax.cla()\n",
" fig.colorbar(cm, cax=cax)\n",
"\n",
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[0], interval=100, repeat=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Extraire pour chaque t, chaque z, r=0 et les plotter pour comparer le max d'intensité"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"fig, ax = plt.subplots()\n",
"ax.pcolormesh(z_pts, full_r_pts, np.concatenate((np.flip(E_matrix[:,:,0].T, axis=0), E_matrix[:,:,0].T)))\n",
"ax.set_title('Time=%d' % 0)\n",
"\n",
"div = make_axes_locatable(ax)\n",
"cax = div.append_axes('right', '5%', '5%')\n",
"\n",
"z_from_t_pts = t_pts * c + z_pts\n",
"\n",
"def update(i):\n",
" cm = ax.pcolormesh(z_pts, full_r_pts, np.concatenate((np.flip(E_matrix[:,:,i].T, axis=0), E_matrix[:,:,i].T)))\n",
" ax.set_title('Time=%d' % i)\n",
" cax.cla()\n",
" fig.colorbar(cm, cax=cax)\n",
"\n",
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[2], interval=100, repeat=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Attempt to see the moving impulsion along z with a diffraction and dispersion\n",
"\n",
"## Useless since a femtosecond impulsion is only a few microns long, so we cannot see it move on a 10 meters length"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"E_matrix = np.concatenate((E_matrix, np.zeros((E_matrix.shape[0], E_matrix.shape[1], E_matrix.shape[0]))), axis=2)\n",
"for i in range(E_matrix.shape[])\n",
"\n",
"fig = plt.figure()\n",
"plt.pcolormesh(z_from_t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])), cmap=plt.cm.RdBu)\n",
"plt.pcolormesh(z_pts, full_r_pts, np.concatenate((np.flip(E_matrix[0,:,:], axis=0), E_matrix[0,:,:])), cmap=plt.cm.RdBu)\n",
"plt.title('Image = %d' % 0)\n",
"\n",
"np.roll(E_matrix[i,:,:], -1, axis=1)\n",
"\n",
"\n",
"def update(i):\n",
" plt.pcolormesh(z_from_t_pts, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,:], axis=0), E_matrix[i,:,:])), cmap=plt.cm.RdBu)\n",
" plt.pcolormesh(z_pts, full_r_pts, np.concatenate((np.flip(E_matrix[i,:,:], axis=0), E_matrix[i,:,:])), cmap=plt.cm.RdBu)\n",
" plt.title('Image = %d' % i)\n",
"\n",
" \n",
"ani = animation.FuncAnimation(fig, update, frames=E_matrix.shape[0], interval=100, repeat=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
The figures of this folder were made using data coming from the CCCN class which was instantiated the following way :
lambda = 700nm
w0 = 1e-3
Pin = 1
D_diff = i/(2k)
the grid for the Crank-Nicolson scheme was the following :
along r : 100 steps between 0 and 1e-2
along z : 200 steps between 0 and 10
the potential was D_diff / r
\ No newline at end of file
......@@ -265,9 +265,30 @@ Thus, all effects leading to the \textbf{saturation} of the intensity autofocuse
\subsection{Cylindrical diffraction}
% 2D plot
% Comparison with theoretical diffraction w(z)
\paragraph{}
We already had coded a Crank-Nicolson scheme during the course and the first step of our project was to adapt it to the simplest
case of our problem. We thus had to go from cartesian to cylindric coordinates and to work with complex values to observe the diffraction of a gaussian beam.
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}$}
\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 :
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{../figures/CCCN/check_theory_sigma.png}
\caption{TO FILL}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{../figures/CCCN/check_theory_power.png}
\caption{TO FILL}
\end{figure}
\subsection{Diffraction and Dispersion}
......
......@@ -45,4 +45,10 @@ journal={Optics Letters},
volume={20},
number={1},
year={1995}
}
@misc
{wikiCCCN,
title={Gaussian Beam}
note={https://en.wikipedia.org/wiki/Gaussian_beam}
}
\ No newline at end of file
......@@ -14,6 +14,8 @@
headheight=15pt,footskip=1cm]{geometry}
% Personnalisation
\usepackage{fancyhdr,sectsty}
% Insertion d'images
\usepackage{graphicx}
% Infos du document
......