Commit 949a1c9f by Antoine RAVETTA

### try marburger for zc(t)

parent 0b711594
This diff is collapsed.
 ... ... @@ -9,13 +9,13 @@ "import numpy as np\n", "from KCN import CrankNicolsonFocus\n", "\n", "lambd = 0.7e-6\n", "lambd = 0.8e-6 / 1.328\n", "\n", "k = 2 * np.pi / lambd\n", "k_2 = 2e-28\n", "k_2 = 2.41e-26\n", "\n", "w0 = 1e-3\n", "tp = 85e-15\n", "w0 = 1e-4\n", "tp = 50e-15\n", "#tp = 1\n", "\n", "diff_coeff = 1j*1/(2 * k)\n", ... ... @@ -60,7 +60,7 @@ "source": [ "#----- Non linearities --------------\n", "\n", "n2 = 5.57e-23\n", "n2 = 1.6e-16\n", "\n", "def kerr(E):\n", " return 1j * k * n2 * np.abs(E)**2 * E" ... ... @@ -109,13 +109,13 @@ "metadata": {}, "outputs": [], "source": [ "Pin_list = [i*1e9 for i in range(31,41)]\n", "E_list = []\n", "zc_list = []\n", "index_list = []\n", "Pin = 30e9\n", "\n", "def marburger_law(p, b=0.367, a=0.852, delta=0):\n", " return delta + b * zR / np.sqrt((np.sqrt(p) - a) ** 2 - (1 - a) ** 2)" "def marburger_law(t, delta=0, r=1):\n", " a = 0.7823\n", " b = 0.405\n", " P = Pin * np.exp(-2*t**2/(r**2*tp**2))\n", " return delta + b * zR / np.sqrt((np.sqrt(P/Pc) - a) ** 2 - (1 - a) ** 2)" ] }, { ... ... @@ -124,14 +124,36 @@ "metadata": {}, "outputs": [], "source": [ "for Pin in Pin_list:\n", " crank = CrankNicolsonFocus()\n", "print(marburger_law(0))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "crank = CrankNicolsonFocus()\n", "\n", "crank.set_grid(r_max=2.8e-3, n_r=100, z_min=0, z_max=1e-4, n_z=600, t_min=-4e-13, t_max=4e-13, n_t=256)\n", "crank.set_parameters(Dr=diff_coeff, Dt=disp_coeff, V=potential, f=kerr)\n", "\n", " crank.set_grid(r_max=2.8e-3, n_r=100, z_min=0, z_max=6, n_z=300, t_min=-5e-13, t_max=5e-13, n_t=100)\n", " crank.set_parameters(Dr=diff_coeff, Dt=0, V=potential, f=kerr)\n", "crank.solve(initial_enveloppe(crank.r_pts, crank.t_pts, w0, tp, Pin))\n", "\n", " crank.solve(initial_enveloppe(crank.r_pts, crank.t_pts, w0, tp, Pin))\n", " E_list.append(crank.get_E())" "E = crank.E_matrix\n", "t_pts = np.real(crank.t_pts)\n", "z_pts = np.real(crank.z_pts)\n", "r_pts = np.real(crank.r_pts)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "E = np.abs(E)\n", "E = np.nan_to_num(E)" ] }, { ... ... @@ -140,14 +162,7 @@ "metadata": {}, "outputs": [], "source": [ "for E in E_list:\n", " E = E[:,:,crank.n_t//2] \n", " I = np.abs(E) ** 2\n", " I = np.nan_to_num(I)\n", " max_ind = np.unravel_index(np.argmax(I, axis=None), I.shape)\n", " index_list.append(max_ind)\n", " zc = (max_ind[0]) * crank.delta_z\n", " zc_list.append(zc)" "print(E)" ] }, { ... ... @@ -156,10 +171,24 @@ "metadata": {}, "outputs": [], "source": [ "intermediate_powers = np.array(Pin_list) / Pc\n", "intermediate_zc = np.array(zc_list)\n", "fig, ax = plt.subplots(figsize=(10,8))\n", "\n", "print(len(zc_list))" "ax.pcolormesh(r_pts, z_pts, np.abs(E[:,:,crank.n_t//2]))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "E = E[:,0,:] \n", "I = np.abs(E) ** 2\n", "I = np.nan_to_num(I)\n", "\n", "max_indexes = np.argmax(I, axis=0)\n", "\n", "zc_list = max_indexes * crank.delta_z" ] }, { ... ... @@ -172,10 +201,26 @@ "\n", "%matplotlib inline\n", "\n", "t_min = 0\n", "t_max = 256\n", "\n", "delta_t = 10\n", "\n", "t_down = t_min + delta_t\n", "t_up = t_max - delta_t\n", "\n", "t_pts_short = t_pts[t_down:t_up]\n", "zc_list_short = zc_list[t_down:t_up]\n", "\n", "#popt, pcov = curve_fit(marburger_law, t_pts_short, zc_list_short)\n", "\n", "fig, ax = plt.subplots(figsize=(15, 10))\n", "ax.plot(intermediate_powers, intermediate_zc, label=\"calculated\")\n", "ax.plot(intermediate_powers, marburger_law(intermediate_powers), label=\"theoretical\")\n", "ax.legend()" "ax.plot(t_pts_short, zc_list_short, label=\"calculated\")\n", "#ax.plot(t_pts_short, marburger_law(t_pts_short, *popt), label=\"theoretical\")\n", "#ax.plot(t_pts_short, marburger_law(t_pts_short, delta=3, r=4), label=\"theoretical\")\n", "ax.legend()\n", "\n", "#print(popt)" ] }, { ... ... @@ -198,6 +243,24 @@ "zc_total =np.concatenate((zc_total, intermediate_zc))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from scipy.optimize import curve_fit\n", "\n", "popt, pcov = curve_fit(marburger_law, powers, zc_total)\n", "\n", "fig, ax = plt.subplots(figsize=(10,9))\n", "\n", "ax.plot(powers, zc_total, label=\"calculated\")\n", "ax.plot(powers, marburger_law(powers, *popt), label=\"fitted\")\n", "\n", "print(popt)" ] }, { "cell_type": "code", "execution_count": null, ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!