Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, /acts/docs/old/SolenoidField.ipynb is written in an unsupported language. File is not indexed.

0001 {
0002     "cells": [
0003         {
0004             "cell_type": "markdown",
0005             "metadata": {},
0006             "source": [
0007                 "# ACTS documentation for Solenoid Field implementation\n",
0008                 "\n",
0009                 "Simple coil magnetic field\n",
0010                 "\n",
0011                 "$E_1(k^2) =$ complete elliptic integral of the 1st kind\n",
0012                 "$E_2(k^2) =$ complete elliptic integral of the 2nd kind\n",
0013                 "\n",
0014                 "$E_1(k^2)$ and $E_2(k^2)$ are usually indicated as $K(k^2)$ and $E(k^2)$ in literature, respectively\n",
0015                 "\n",
0016                 "$$\n",
0017                 "E_1(k^2) = \\int_0^{\\pi/2} \\left( 1 - k^2 \\sin^2{\\theta} \\right)^{-1/2} \\mathop{}\\!\\mathrm{d}\\theta\n",
0018                 "$$\n",
0019                 "\n",
0020                 "$$\n",
0021                 "E_2(k^2) = \\int_0^{\\pi/2}\\sqrt{1 - k^2 \\sin^2{\\theta}} \\mathop{}\\!\\mathrm{d}\\theta\n",
0022                 "$$\n",
0023                 "\n",
0024                 "$k^2 = $ is a function of the point $(r, z)$ and of the radius of the coil $R$\n",
0025                 "\n",
0026                 "$$\n",
0027                 "k^2 = \\frac{4Rr}{(R+r)^2 + z^2}\n",
0028                 "$$\n",
0029                 "\n",
0030                 "Using these, you can evaluate the two components $B_r$ and $B_z$ of the magnetic field:\n",
0031                 "\n",
0032                 "$$\n",
0033                 "B_r(r, z) = \\frac{\\mu_0 I}{4\\pi} \\frac{kz}{\\sqrt{Rr^3}} \\left[ \\left(\\frac{2-k^2}{2-2k^2}\\right)E_2(k^2) - E_1(k^2) \\right]\n",
0034                 "$$\n",
0035                 "\n",
0036                 "$$\n",
0037                 "B_z(r,z) = \\frac{\\mu_0 I}{4\\pi} \\frac{k}{\\sqrt{Rr}} \\left[ \\left( \\frac{(R+r)k^2-2r}{2r(1-k^2)} \\right) E_2(k^2) + E_1(k^2) \\right]\n",
0038                 "$$\n",
0039                 "\n",
0040                 "In the implementation proposed the factor of $(\\mu_0\\cdot I)$ is defined to be a scaling factor. It is evaluated and defined the magnetic field in the center of the coil"
0041             ]
0042         },
0043         {
0044             "cell_type": "code",
0045             "execution_count": null,
0046             "metadata": {},
0047             "outputs": [],
0048             "source": [
0049                 "from subprocess import check_output\n",
0050                 "\n",
0051                 "\n",
0052                 "def asciitex(eq, lc=\"/// \"):\n",
0053                 "    out = check_output([\"asciitex\", eq]).decode(\"utf-8\").rstrip()\n",
0054                 "    out = \"\\n\".join([lc + l for l in out.split(\"\\n\")])\n",
0055                 "    print(out, \"\\n\")"
0056             ]
0057         },
0058         {
0059             "cell_type": "code",
0060             "execution_count": null,
0061             "metadata": {},
0062             "outputs": [],
0063             "source": [
0064                 "asciitex(\n",
0065                 "    r\"E_1(k^2) = \\int_0^{\\pi/2} \\left( 1 - k^2 \\sin^2{\\theta} \\right)^{-1/2} d\\theta\"\n",
0066                 ")\n",
0067                 "asciitex(r\"E_2(k^2) = \\int_0^{\\pi/2}\\sqrt{1 - k^2 \\sin^2{\\theta}} d\\theta\")\n",
0068                 "\n",
0069                 "asciitex(r\"k^2 = \\frac{4Rr}{(R+r)^2 + z^2}\")\n",
0070                 "\n",
0071                 "asciitex(\n",
0072                 "    r\"B_r(r, z) = \\frac{\\mu_0 I}{4\\pi} \\frac{kz}{\\sqrt{Rr^3}} \"\n",
0073                 "    r\"\\left[ \\left(\\frac{2-k^2}{2-2k^2}\\right)E_2(k^2) - E_1(k^2) \\right]\"\n",
0074                 ")\n",
0075                 "\n",
0076                 "asciitex(\n",
0077                 "    r\"B_z(r,z) = \\frac{\\mu_0 I}{4\\pi} \\frac{k}{\\sqrt{Rr}} \"\n",
0078                 "    r\"\\left[ \\left( \\frac{(R+r)k^2-2r}{2r(1-k^2)} \\right) E_2(k^2) + E_1(k^2) \\right]\"\n",
0079                 ")"
0080             ]
0081         }
0082     ],
0083     "metadata": {
0084         "kernelspec": {
0085             "display_name": "Python 3",
0086             "language": "python",
0087             "name": "python3"
0088         },
0089         "language_info": {
0090             "codemirror_mode": {
0091                 "name": "ipython",
0092                 "version": 3
0093             },
0094             "file_extension": ".py",
0095             "mimetype": "text/x-python",
0096             "name": "python",
0097             "nbconvert_exporter": "python",
0098             "pygments_lexer": "ipython3",
0099             "version": "3.7.0"
0100         }
0101     },
0102     "nbformat": 4,
0103     "nbformat_minor": 2
0104 }