...
 
Commits (2)
......@@ -11,7 +11,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"data_path = '../data/CN_cylindric_complex_'\n",
"data_path = '../production/CN_cylindric_complex_'\n",
"\n",
"\n",
"def import_data(path):\n",
......@@ -42,6 +42,22 @@
"source": [
"plt.plot(r_pts, data_ary[-1, :])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(np.linalg.norm(data_ary, axis=1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......
......@@ -14,9 +14,6 @@
"\n",
"\n",
"data_path = '../data/CN_cylindric_complex_'\n",
"sigma = 1e-3\n",
"lambd = 700 * 10 ** -9\n",
"k = 2 * np.pi / lambd\n",
"\n",
"\n",
"def import_data(path):\n",
......
......@@ -176,7 +176,7 @@
"import scipy.linalg as la\n",
"\n",
"class CrankNicolson:\n",
" \"\"\"A class that solves dE/dz = D*d2E/dr2 + V(r)*dE/dr + f(E)\"\"\"\n",
" \"\"\"A class that solves dE/dz = D*d2E/dr2 + V(r)*dE/dr\"\"\"\n",
" \n",
" # Cylindrical grid\n",
" def set_grid(self, r_max, n_r, z_min, z_max, n_z):\n",
......@@ -278,7 +278,6 @@
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"lambd = 0.7e-6\n",
"\n",
"k = 2 * np.pi / lambd\n",
......@@ -323,7 +322,7 @@
"source": [
"crank = CrankNicolson()\n",
"\n",
"crank.set_grid(r_max=1e-2, n_r=100, z_min=0, z_max=10, n_z=100)\n",
"crank.set_grid(r_max=1e-2, n_r=100, z_min=0, z_max=10, n_z=200)\n",
"crank.set_parameters(D=diff_coeff, V=potential)\n",
"\n",
"crank.solve(initial_enveloppe(crank.r_pts, w0, Pin))"
......@@ -342,9 +341,9 @@
"metadata": {},
"outputs": [],
"source": [
"np.savetxt(\"../../data/CN_cylindric_complex_E.dat\", np.abs(crank.E_matrix))\n",
"np.savetxt(\"../../data/CN_cylindric_complex_r_pts.dat\", crank.r_pts)\n",
"np.savetxt(\"../../data/CN_cylindric_complex_z_pts.dat\", crank.z_pts)"
"np.savetxt(\"CN_cylindric_complex_E.dat\", np.abs(crank.E_matrix))\n",
"np.savetxt(\"CN_cylindric_complex_r_pts.dat\", crank.r_pts)\n",
"np.savetxt(\"CN_cylindric_complex_z_pts.dat\", crank.z_pts)"
]
},
{
......@@ -369,7 +368,8 @@
"metadata": {},
"outputs": [],
"source": [
"E = crank.get_E()"
"E = crank.get_E()\n",
"print(np.sum(np.abs(E[1,:])**2)*crank.delta_r)"
]
},
{
......@@ -395,8 +395,22 @@
"\n",
"ener = np.array([crank.delta_r*np.sum(np.abs(E[i,:])**2) for i in range(crank.n_z)])\n",
"\n",
"z0 = k * w0 ** 2 / 2\n",
"\n",
"\n",
"def beam_width(z):\n",
" return w0 * np.sqrt(1 + (z / z0) ** 2)\n",
"\n",
"\n",
"def slice_intensity(z, w0, I0, z0):\n",
" return np.sqrt(2 * np.pi) * Pin / beam_width(z)\n",
"\n",
"\n",
"theoretic_energ = np.array([slice_intensity(z, w0, I0, z0) for z in crank.z_pts])\n",
"\n",
"plt.figure()\n",
"plt.plot(ener)\n",
"plt.plot(theoretic_energ/np.pi/2)\n",
"plt.show()"
]
},
......
......@@ -315,7 +315,6 @@
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"lambd = 0.7e-6\n",
"\n",
"k = 2 * np.pi / lambd\n",
......@@ -705,7 +704,6 @@
"metadata": {},
"outputs": [],
"source": [
"c = 299792458\n",
"lambd = 0.7e-6\n",
"\n",
"k = 2 * np.pi / lambd\n",
......
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}