Skip to content

Commit

Permalink
checked tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-tomin committed Aug 1, 2019
1 parent 8128903 commit d4efa77
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 77 deletions.
164 changes: 109 additions & 55 deletions demos/ipython_tutorials/13_synchrotron_radiation_visualization.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions demos/ipython_tutorials/2_tracking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
"output_type": "stream",
"text": [
"z = 93.40410100084 / 93.40410100084006 : applied: d: \n",
" time exec: 7.94364595413208 sec\n"
" time exec: 8.964184761047363 sec\n"
]
}
],
Expand Down Expand Up @@ -313,7 +313,7 @@
"output_type": "stream",
"text": [
"z = 93.40410100084 / 93.40410100084006 : applied: d: mTransform\n",
" time exec: 8.000734090805054 sec\n"
" time exec: 8.656868696212769 sec\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion demos/ipython_tutorials/3_space_charge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"z = 12.697400000000002 / 12.697400000000007 : applied: SpaceChargeetime exec: 65.20020890235901 sec\n"
"z = 12.697400000000002 / 12.697400000000007 : applied: SpaceChargeetime exec: 73.08316922187805 sec\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion demos/ipython_tutorials/4_wake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
"text": [
"tracking with Wakes .... \n",
"z = 15.0 / 15.0 : applied: .0 : applied: Wake\n",
" time exec: 2.079639196395874 sec\n"
" time exec: 2.3191680908203125 sec\n"
]
}
],
Expand Down
10 changes: 5 additions & 5 deletions demos/ipython_tutorials/5_CSR.ipynb

Large diffs are not rendered by default.

33 changes: 20 additions & 13 deletions demos/ipython_tutorials/8_laser_heater.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"\\begin{equation}\n",
"\\ddot{x} = \\frac{e}{\\gamma m_e} B_y \\dot{z}, \\qquad \\ddot{z} = -\\frac{e}{\\gamma m_e} B_y \\dot{x}\n",
"\\end{equation}\n",
"\n",
"$$\\qquad$$\n",
"In the first order approximation $v_z = \\dot{z} \\approx v = \\beta c = const$, $v_x << v_z$ and $\\ddot{z} \\approx 0$ and taking into account the undulator magnetic field $B_y = -B_0\\sin(k_y z)$ we get:\n",
"\n",
"\\begin{equation}\n",
Expand All @@ -76,9 +76,7 @@
"x(z) = \\frac {K} {\\beta \\gamma k_u}\\sin(k_u z),\n",
"\\end{equation}\n",
"\n",
"where $K = \\frac{eB_0}{m_e c k_u}$\n",
"\n",
"and transverse velocity is \n",
"where $K = \\frac{eB_0}{m_e c k_u}$ and transverse velocity is \n",
"\n",
"\\begin{equation}\n",
"v_x(t) = \\frac {K c}{\\gamma} \\cos(k_u \\beta c t) \\qquad or \\qquad v_x(z) = \\frac {K c}{\\gamma} \\cos(k_u z)\n",
Expand All @@ -97,7 +95,7 @@
"\\begin{equation}\n",
"v_z = \\sqrt{v^2 - v_x^2} = \\sqrt{c^2(1 - 1/\\gamma^2) - v_x^2} \\approx c\\left(1 - \\frac{1}{2\\gamma^2} (1 + \\gamma^2 v_x^2 / c^2) \\right)\n",
"\\end{equation}\n",
"\n",
"$$\\quad$$\n",
"Inserting for $v_x = \\dot{x}(t)$ and using the trigonometric identity $\\cos^2 \\alpha = (1 + \\cos 2 \\alpha)/2$\n",
"\n",
"\\begin{equation}\n",
Expand Down Expand Up @@ -136,7 +134,7 @@
"E(x, y, z) = E_0 \\frac{ e^{-\\frac{1}{2} \\frac{x^2}{\\sigma_x^2 - j z/k} } } {\\sqrt{1-j z/(k \\sigma_x^2)}}\n",
"\\frac{ e^{-\\frac{1}{2} \\frac{y^2}{\\sigma_y^2 - j z/k} } } {\\sqrt{1-j z/(k \\sigma_y^2)}}\n",
"\\end{equation}\n",
"\n",
"$$\\quad$$\n",
"Introducing [Rayleigh length](https://en.wikipedia.org/wiki/Rayleigh_length) for $x$ and $y$ plane:\n",
"\n",
"\\begin{equation}\n",
Expand Down Expand Up @@ -337,6 +335,7 @@
"\\end{equation}\n",
"\n",
"<p>If we ensure fulfillment of the resonance condition only for the first harmonic as we did in the \"Option 1\" (in that case $n=0$) the only one term of the sum will survive the only one term of the sum will survive. Indeed, for the $n=0$ argument of the exponential will be constant but for other harmonic numbers it will oscillate and give in average 0. So our final expression:</p>\n",
"\n",
"\\begin{equation}\n",
"\\boxed{\\Big \\langle e^{j((k + k_u)\\overline v_z - \\omega) t} \\frac{e^{-j\\theta} + 1}{2} e^{-j Y \\sin\\theta}\\Big\\rangle = \\frac{J_{0}(Y) - J_1(Y)}{2}}\n",
"\\end{equation}\n",
Expand All @@ -352,7 +351,7 @@
"\\begin{equation}\n",
"\\langle E v\\rangle = \\frac {K c}{\\gamma} Re \\left\\{ E(x,y,z)\\right\\}\\frac{J_{0}(Y) - J_{1}(Y)}{2}\n",
"\\end{equation}\n",
"\n",
"$$\\quad$$\n",
"Finally, remembering derivation of the electric field amplitude $E_0 = \\sqrt{\\frac{4 Z_0 \\overline P(0) }{\\pi w^2}}$, we can write expression for amplitude of energy modulation on axis ($x=y=0$)\n",
"\n",
"\\begin{equation}\n",
Expand Down Expand Up @@ -618,9 +617,17 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"initializing ocelot...\n"
]
}
],
"source": [
"# the output of plotting commands is displayed inline within frontends, \n",
"# directly below the code cell that produced it\n",
Expand Down Expand Up @@ -678,7 +685,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -722,7 +729,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -744,7 +751,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -772,7 +779,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down

0 comments on commit d4efa77

Please sign in to comment.