summaryrefslogtreecommitdiff
path: root/Elements_of_Electromagnetics/chapter_7.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Elements_of_Electromagnetics/chapter_7.ipynb')
-rw-r--r--Elements_of_Electromagnetics/chapter_7.ipynb224
1 files changed, 224 insertions, 0 deletions
diff --git a/Elements_of_Electromagnetics/chapter_7.ipynb b/Elements_of_Electromagnetics/chapter_7.ipynb
new file mode 100644
index 00000000..0c96dd8d
--- /dev/null
+++ b/Elements_of_Electromagnetics/chapter_7.ipynb
@@ -0,0 +1,224 @@
+{
+ "metadata": {
+ "name": "chapter_7.ipynb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 7: Magnetostatic Fields<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.1, Page number: 266<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "The conducting triangular loop in Figure 7.6(a) carries a current of lOA.\n",
+ "Find H at (0, 0, 5) due to side 1 of the loop. '''\n",
+ "\n",
+ "import scipy\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "p=5 #Distance from side 1 of loop to (0,0,5) in m\n",
+ "l=2 #Length of the side in m\n",
+ "I=10 #Current through loop in A\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "a1=scipy.arccos(l/(scipy.sqrt(l**2+p**2))) #Angle in radians\n",
+ "a2=scipy.pi/2 #Angle in radians\n",
+ "H=I*(scipy.cos(a1)-scipy.cos(a2))/(4*scipy.pi*p) #Field Intensity in A/m\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'H=',round(H*1000,1),'mA/m in the negative y direction'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H= 59.1 mA/m in the negative y direction\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.2, Page number: 268<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ " Find H at (-3, 4, 0) due to the current filament shown in Figure 7.7 (a). '''\n",
+ "\n",
+ "import scipy\n",
+ "from numpy import *\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "ax=array([1,0,0]) #Unit vector along x direction\n",
+ "ay=array([0,1,0]) #Unit vector along y direction\n",
+ "az=array([0,0,1]) #Unit vector along z direction\n",
+ "a1=scipy.arccos(0)\n",
+ "a2=scipy.arccos(1)\n",
+ "b1=scipy.arccos(0.6)\n",
+ "b2=scipy.arccos(1)\n",
+ "p1=5\n",
+ "p2=4\n",
+ "I1=3 #current in A\n",
+ "I2=3 #current in A\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "Hz=I1/(4*scipy.pi*p1)*(cos(a2)-cos(a1))*array([0.8,0.6,0])\n",
+ "Hx=I2/(4*scipy.pi*p2)*(cos(b2)-cos(b1))*array([0,0,1])\n",
+ "Hzcyl=-I1/(4*scipy.pi*p1)*array([0,1,0])\n",
+ "Hzx=round(dot(Hz,ax),4)\n",
+ "Hzy=round(dot(Hz,ay),5)\n",
+ "Hxz=round(dot(Hx,az),5)\n",
+ "Hxr=array([0,0,Hxz])\n",
+ "Hzr=array([Hzx,Hzy,0])\n",
+ "Hzcyly=round(dot(Hzcyl,ay),5)\n",
+ "Hzcylr=array([0,Hzcyly,0])\n",
+ "Hcart=(Hxr+Hzr)*10**3 #H in cartesian coordinates in mA \n",
+ "Hcyl=(Hxr+Hzcylr)*10**3 #H in cylindrical coordinates in mA\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'H at (-3, 4, 0) in cartesian coordnates =',Hcart,'mA/m'\n",
+ "print 'H at (-3, 4, 0) in cylindrical coordnates =',Hcyl,'mA/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H at (-3, 4, 0) in cartesian coordnates = [ 38.2 28.65 23.87] mA/m\n",
+ "H at (-3, 4, 0) in cylindrical coordnates = [ 0. -47.75 23.87] mA/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.5, Page number: 279<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "Planes z=0 and z=4 carry current K=-10a_x A/m and K=10a_x A/m, respectively. \n",
+ "Determine H at \n",
+ "(a) (1,1,1) \n",
+ "(b) (0,-3,10) '''\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "i0=-10 #current through plane z=0 in A/m\n",
+ "i4=10 #current through plane z=4 in A/m\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "H0a=0.5*i0*-1 #H in positive Y direction in A/m\n",
+ "H4a=0.5*i4*-1*-1 #H in positive Y direction in A/m\n",
+ "Ha=H0a+H4a #H at (1,1,1) in A/m \n",
+ "H0b=0.5*i0*-1 #H in positive Y direction in A/m\n",
+ "H4b=0.5*i4*-1 #H in negative Y direction in A/m\n",
+ "Hb=H0b+H4b #H at (0,-3,10) in A/m\n",
+ "\n",
+ "#Results\n",
+ "\n",
+ "print 'H at (1,1,1) =',Ha,'A/m'\n",
+ "print 'H at (0,-3,10) =',Hb,'A/m'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "H at (1,1,1) = 10.0 A/m\n",
+ "H at (0,-3,10) = 0.0 A/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 7.7, Page number: 287<h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "'''\n",
+ "Given the magnetic vector potential A=-p^2/4 a_z Wb/m, calculate \n",
+ "the total magnetic flux crossing the surface phi=pi/2, 1 <= p <= 2 m,\n",
+ "0 <= Z <= 5 m. '''\n",
+ "\n",
+ "import scipy.integrate\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "def B(z,p): \n",
+ " return 0.5*p\n",
+ "psy, err = scipy.integrate.dblquad(lambda p , z: B(z,p), \n",
+ " 0, 5, lambda p: 1, lambda p: 2)\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print 'Total magnetic flux crossing the surface phi=pi/2 is',psy,'Wb'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total magnetic flux crossing the surface phi=pi/2 is 3.75 Wb\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file