Commit 48aefbc9 authored by Mathieu RASSON's avatar Mathieu RASSON

Energy conservation checked

parent 88728969
......@@ -393,9 +393,9 @@
"source": [
"# Energy evolution\n",
"\n",
"ener = np.array([crank.delta_r*np.sum(np.abs(E[i,:])**2) for i in range(crank.n_z)])\n",
"ener = np.array([crank.delta_r*np.sum(crank.r_pts * np.abs(E[i,:])**2) for i in range(crank.n_z)])\n",
"\n",
"z0 = k * w0 ** 2 / 2\n",
"#z0 = k * w0 ** 2 / 2\n",
"\n",
"\n",
"def beam_width(z):\n",
......@@ -406,11 +406,12 @@
" 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",
"#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.plot(crank.z_pts, ener)\n",
"#plt.plot(theoretic_energ/np.pi/2)\n",
"plt.ylim(0,0.2)\n",
"plt.show()"
]
},
......
......@@ -476,20 +476,21 @@
"source": [
"# Energy evolution\n",
"\n",
"ener = np.array([crank.delta_r*crank.delta_t*np.sum(np.abs(E[i,:,:])**2) for i in range(crank.n_z)])\n",
"ener = np.zeros(crank.n_z)\n",
"for i in range(crank.n_z):\n",
" # Filled at each z\n",
" for j in range(crank.n_r):\n",
" # Term integrated along t at r added against r value\n",
" ener[i] += crank.delta_t * np.sum(np.abs(E[i,j,:])**2) * np.real(crank.r_pts[j])\n",
"# r integration step\n",
"ener *= crank.delta_r\n",
"\n",
"plt.figure()\n",
"plt.plot(ener)\n",
"plt.plot(np.real(crank.z_pts), ener)\n",
"plt.ylim(0,2e-14)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -717,9 +718,9 @@
"diff_coeff = 1j*1/(2 * k)\n",
"#diff_coeff = 0\n",
"#diff_coeff = 1e-4\n",
"#disp_coeff = -1j*k_2/2\n",
"disp_coeff = -1j*k_2/2\n",
"#disp_coeff = 1j * 1e-25\n",
"disp_coeff = 0\n",
"#disp_coeff = 0\n",
"\n",
"print('diff :', diff_coeff)\n",
"print('disp :', disp_coeff)\n",
......@@ -846,6 +847,29 @@
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Energy evolution\n",
"\n",
"ener = np.zeros(crank.n_z)\n",
"for i in range(crank.n_z):\n",
" # Filled at each z\n",
" for j in range(crank.n_r):\n",
" # Term integrated along t at r added against r value\n",
" ener[i] += crank.delta_t * np.sum(np.abs(E[i,j,:])**2) * np.real(crank.r_pts[j])\n",
"# r integration step\n",
"ener *= crank.delta_r\n",
"\n",
"plt.figure()\n",
"plt.plot(np.real(crank.z_pts), ener)\n",
"plt.ylim(0,2e-14)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -998,10 +1022,18 @@
"source": [
"# Energy evolution\n",
"\n",
"ener = np.array([crank.delta_r*crank.delta_t*np.sum(np.abs(E[i,:,:])**2) for i in range(crank.n_z)])\n",
"ener = np.zeros(crank.n_z)\n",
"for i in range(crank.n_z):\n",
" # Filled at each z\n",
" for j in range(crank.n_r):\n",
" # Term integrated along t at r added against r value\n",
" ener[i] += crank.delta_t * np.sum(np.abs(E[i,j,:])**2) * np.real(crank.r_pts[j])\n",
"# r integration step\n",
"ener *= crank.delta_r\n",
"\n",
"plt.figure()\n",
"plt.plot(ener)\n",
"plt.plot(np.real(crank.z_pts), ener)\n",
"plt.ylim(0,2e-5)\n",
"plt.show()"
]
},
......
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