Make the hole larger on the 12 coil board

This commit is contained in:
Chris Greening 2023-02-03 13:39:50 +00:00
parent aabab5fc67
commit 7bde6ea9f3
3 changed files with 22 additions and 15 deletions

View file

@ -675,7 +675,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3.10.7 ('venv': venv)", "display_name": "venv",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@ -689,11 +689,11 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.7" "version": "3.10.7 (main, Sep 27 2022, 14:37:32) [Clang 14.0.0 (clang-1400.0.29.102)]"
}, },
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "fc384f9db26c31784edfba3761ba3d2c7b2f9b8a63e03a9eb0778fc35334efe1" "hash": "1ce20143987840b9786ebb5907032c9c3a8efacbb887dbb0ebc4934f2ad26cb3"
} }
} }
}, },

View file

@ -566,7 +566,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.7" "version": "3.10.7 (main, Sep 27 2022, 14:37:32) [Clang 14.0.0 (clang-1400.0.29.102)]"
}, },
"vscode": { "vscode": {
"interpreter": { "interpreter": {

View file

@ -45,10 +45,10 @@
"# magnetic field at a point x,y,z of a dipole magnet with moment m in the z direction\n", "# magnetic field at a point x,y,z of a dipole magnet with moment m in the z direction\n",
"def dipole(x, y, z, m=0.185):\n", "def dipole(x, y, z, m=0.185):\n",
" mu0 = 1e-7 / 4 * np.pi\n", " mu0 = 1e-7 / 4 * np.pi\n",
" r = np.sqrt(x ** 2 + y ** 2 + z ** 2)\n", " r = np.sqrt(x**2 + y**2 + z**2)\n",
" return (\n", " return (\n",
" np.array(\n", " np.array(\n",
" [3 * x * z / r ** 5, 3 * y * z / r ** 5, (3 * z ** 2 / r ** 5 - 1 / r ** 3)]\n", " [3 * x * z / r**5, 3 * y * z / r**5, (3 * z**2 / r**5 - 1 / r**3)]\n",
" )\n", " )\n",
" * m\n", " * m\n",
" * mu0\n", " * mu0\n",
@ -108,7 +108,7 @@
" Z,\n", " Z,\n",
" Bx,\n", " Bx,\n",
" Bz,\n", " Bz,\n",
" np.log(np.sqrt(Bx ** 2 + By ** 2 + Bz ** 2)),\n", " np.log(np.sqrt(Bx**2 + By**2 + Bz**2)),\n",
" \"dipole_field_side.png\",\n", " \"dipole_field_side.png\",\n",
" False,\n", " False,\n",
")\n", ")\n",
@ -124,7 +124,7 @@
" Y,\n", " Y,\n",
" Bx,\n", " Bx,\n",
" By,\n", " By,\n",
" np.log(np.sqrt(Bx ** 2 + By ** 2 + Bz ** 2)),\n", " np.log(np.sqrt(Bx**2 + By**2 + Bz**2)),\n",
" \"dipole_field_bottom.png\",\n", " \"dipole_field_bottom.png\",\n",
" False,\n", " False,\n",
")" ")"
@ -143,7 +143,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def B(x, y, z, m=0.185, l=0.003, d=0.01):\n", "def B(x, y, z, m=0.185, l=0.003, d=0.006):\n",
" d = d * 0.75\n", " d = d * 0.75\n",
" l = l * 0.75\n", " l = l * 0.75\n",
" # simulate multiple points in the cylinder and add them together to create a disk of field\n", " # simulate multiple points in the cylinder and add them together to create a disk of field\n",
@ -186,7 +186,7 @@
" Z,\n", " Z,\n",
" Bx,\n", " Bx,\n",
" Bz,\n", " Bz,\n",
" np.log(np.sqrt(Bx ** 2 + By ** 2 + Bz ** 2)),\n", " np.log(np.sqrt(Bx**2 + By**2 + Bz**2)),\n",
" \"magnetic_field_side.png\",\n", " \"magnetic_field_side.png\",\n",
")\n", ")\n",
"\n", "\n",
@ -201,7 +201,7 @@
" Y,\n", " Y,\n",
" Bx,\n", " Bx,\n",
" By,\n", " By,\n",
" np.log(np.sqrt(Bx ** 2 + By ** 2 + Bz ** 2)),\n", " np.log(np.sqrt(Bx**2 + By**2 + Bz**2)),\n",
" \"magnetic_field_bottom.png\",\n", " \"magnetic_field_bottom.png\",\n",
")\n", ")\n",
"\n", "\n",
@ -268,7 +268,7 @@
" dz = points[i][2] - points[(i + 1)][2]\n", " dz = points[i][2] - points[(i + 1)][2]\n",
" d = np.array([dx, dy, dz])\n", " d = np.array([dx, dy, dz])\n",
" # get the length of d\n", " # get the length of d\n",
" l = np.sqrt(dx ** 2 + dy ** 2 + dz ** 2)\n", " l = np.sqrt(dx**2 + dy**2 + dz**2)\n",
" if l > 0:\n", " if l > 0:\n",
" # normalise d\n", " # normalise d\n",
" d = d / l\n", " d = d / l\n",
@ -308,7 +308,7 @@
"def sweep_coil_circle(coil, coil_center_radius, theta):\n", "def sweep_coil_circle(coil, coil_center_radius, theta):\n",
" X = coil_center_radius * np.cos(np.deg2rad(theta))\n", " X = coil_center_radius * np.cos(np.deg2rad(theta))\n",
" Y = coil_center_radius * np.sin(np.deg2rad(theta)) - coil_center_radius\n", " Y = coil_center_radius * np.sin(np.deg2rad(theta)) - coil_center_radius\n",
" Z = -0.01\n", " Z = -0.0025\n",
"\n", "\n",
" # loop through the locations and calculate the forces, sum up the force in the X direction for each location\n", " # loop through the locations and calculate the forces, sum up the force in the X direction for each location\n",
" Fx = []\n", " Fx = []\n",
@ -357,6 +357,13 @@
" label=\"coil1\",\n", " label=\"coil1\",\n",
" color=\"red\",\n", " color=\"red\",\n",
")\n", ")\n",
"# plot the 6 mm diagmeter magnet as a circle\n",
"plt.plot(\n",
" 0.006 * np.cos(np.linspace(0, 2 * np.pi, 100)),\n",
" 0.006 * np.sin(np.linspace(0, 2 * np.pi, 100)),\n",
" color=\"black\",\n",
")\n",
"\n",
"# make the aspect ratio equal\n", "# make the aspect ratio equal\n",
"plt.gca().set_aspect(\"equal\")\n", "plt.gca().set_aspect(\"equal\")\n",
"\n", "\n",
@ -397,11 +404,11 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.7" "version": "3.10.7 (main, Sep 27 2022, 14:37:32) [Clang 14.0.0 (clang-1400.0.29.102)]"
}, },
"vscode": { "vscode": {
"interpreter": { "interpreter": {
"hash": "fc384f9db26c31784edfba3761ba3d2c7b2f9b8a63e03a9eb0778fc35334efe1" "hash": "1ce20143987840b9786ebb5907032c9c3a8efacbb887dbb0ebc4934f2ad26cb3"
} }
} }
}, },