Magnet force simulation working again

This commit is contained in:
Chris Greening 2022-11-22 13:19:04 +00:00
parent c02f00e3cd
commit 370fba91fc

View file

@ -150,13 +150,13 @@
" bx = 0\n", " bx = 0\n",
" by = 0\n", " by = 0\n",
" bz = 0\n", " bz = 0\n",
" for degrees in range(0, 360, 30):\n", " for degrees in range(0, 360, 10):\n",
" angle = np.deg2rad(degrees)\n", " angle = np.deg2rad(degrees)\n",
" x_, y_, z_ = dipole(\n", " x_, y_, z_ = dipole(\n",
" x + d / 2 * np.cos(angle),\n", " x + d / 2 * np.cos(angle),\n",
" y + d / 2 * np.sin(angle),\n", " y + d / 2 * np.sin(angle),\n",
" z - l / 2,\n", " z - l / 2,\n",
" m / (360 / 30),\n", " m / (360 / 10),\n",
" )\n", " )\n",
" bx += x_\n", " bx += x_\n",
" by += y_\n", " by += y_\n",
@ -165,7 +165,7 @@
" x + d / 2 * np.cos(angle),\n", " x + d / 2 * np.cos(angle),\n",
" y + d / 2 * np.sin(angle),\n", " y + d / 2 * np.sin(angle),\n",
" z + l / 2,\n", " z + l / 2,\n",
" m / (360 / 30),\n", " m / (360 / 10),\n",
" )\n", " )\n",
" bx += x_\n", " bx += x_\n",
" by += y_\n", " by += y_\n",
@ -294,7 +294,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.002\n", " Z = -0.01\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",