Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, /acts/docs/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     "def asciitex(eq, lc=\"/// \"):\n",
0051     "    out = check_output([\"asciitex\", eq]).decode(\"utf-8\").rstrip()\n",
0052     "    out = \"\\n\".join([lc + l for l in out.split(\"\\n\")])\n",
0053     "    print(out,\"\\n\")"
0054    ]
0055   },
0056   {
0057    "cell_type": "code",
0058    "execution_count": null,
0059    "metadata": {},
0060    "outputs": [],
0061    "source": [
0062     "asciitex(r\"E_1(k^2) = \\int_0^{\\pi/2} \\left( 1 - k^2 \\sin^2{\\theta} \\right)^{-1/2} d\\theta\")\n",
0063     "asciitex(r\"E_2(k^2) = \\int_0^{\\pi/2}\\sqrt{1 - k^2 \\sin^2{\\theta}} d\\theta\")\n",
0064     "\n",
0065     "asciitex(r\"k^2 = \\frac{4Rr}{(R+r)^2 + z^2}\")\n",
0066     "\n",
0067     "asciitex(r\"B_r(r, z) = \\frac{\\mu_0 I}{4\\pi} \\frac{kz}{\\sqrt{Rr^3}} \"\n",
0068     "         r\"\\left[ \\left(\\frac{2-k^2}{2-2k^2}\\right)E_2(k^2) - E_1(k^2) \\right]\")\n",
0069     "\n",
0070     "asciitex(r\"B_z(r,z) = \\frac{\\mu_0 I}{4\\pi} \\frac{k}{\\sqrt{Rr}} \"\n",
0071     "         r\"\\left[ \\left( \\frac{(R+r)k^2-2r}{2r(1-k^2)} \\right) E_2(k^2) + E_1(k^2) \\right]\")"
0072    ]
0073   },
0074   {
0075    "cell_type": "code",
0076    "execution_count": null,
0077    "metadata": {},
0078    "outputs": [],
0079    "source": []
0080   },
0081   {
0082    "cell_type": "code",
0083    "execution_count": null,
0084    "metadata": {},
0085    "outputs": [],
0086    "source": []
0087   }
0088  ],
0089  "metadata": {
0090   "kernelspec": {
0091    "display_name": "Python 3",
0092    "language": "python",
0093    "name": "python3"
0094   },
0095   "language_info": {
0096    "codemirror_mode": {
0097     "name": "ipython",
0098     "version": 3
0099    },
0100    "file_extension": ".py",
0101    "mimetype": "text/x-python",
0102    "name": "python",
0103    "nbconvert_exporter": "python",
0104    "pygments_lexer": "ipython3",
0105    "version": "3.7.0"
0106   }
0107  },
0108  "nbformat": 4,
0109  "nbformat_minor": 2
0110 }