Phil Lucht Math & Physics Archive
Home / Math and Physics Files / Physics / Transmission Lines / Notes By Chapter and Appendix / Appendix O plotting field lines

Appendix O INSTALLED

DOCX · 351.2 KB
Open DOCX file

Appendix from Phil's transmission line notes, dated 3.26.05 and marked installed. It compares three ways to plot field lines: brute-force stepping along H, solving coupled ODEs numerically with Maple dsolve, and an analytic solution. The worked example is a two-cylinder line with uniform current density, where the analytic field lines are Apollonian circles. Reader exercises are included.

AI-written summary; may contain errors.

Extracted text (machine-read; may contain errors)
This is the Title PhL 3.26.05 This is installed. Appendix O : How to plot 2D magnetic field lines. 1 (a) Statement of the Problem 1 (b) The Brute Force Method 1 (c) The ODE Method 2 Example: Magnetic field lines for a two-cylinder transmission line 3 (d) The Analytic Method 7 Appendix O : How to plot 2D magnetic field lines Maple 18 and earlier versions can plot field lines (flow lines) given a function and a starting point using a certain vector calculus library package. Here we review the theory of such plots and show how the plots can be made directly. The methods given here can be generalized to make 3D plots. (a) Statement of the Problem One is given two functions Hx(x,y) and Hy(x,y) which describe a 2D vector field H(x,y). This field can be directly plotted in Maple in terms of little arrows as shown for example in Fig C.2 (code shown there) using the Maple fieldplot command (this is for a rectangular conductor with a uniform current density), Fig O.1 But we want field lines, not field arrows. One can vaguely deduce the field lines from the above picture, but we want a precise plot. (b) The Brute Force Method To track a field line, one can write a small spatial displacement dr in the direction of H, dr = ds H(r) . (O.1) The field line plotting code is then (pseudo Maple syntax) ds = .01 // some small number relative to the problem at hand r[1] = r1 // pick some starting point of interest for a field line for n from 1 to 100 do dr = ds * H(r[n]) // compute a small displacement in the direction of H r[n+1] = r[n] + dr // update position for use in next iteration od plot the list of points r[n] // this is then a field line (listplot, pointplot, etc) (O.2) One might gussy up the code to prevent wasted computation in locations where H is very small, perhaps computing = H / |H| in each iteration then doing dr = ds * . A different kind of improvement would be to use some kind of quadratic Simpson's Rule affair. The code above works fine, but error can build up for any finite ds. When a field line is a closed curve, the error can become visible where the line returns to its starting point, as in the drawing below which shows some brute-force-method H fields lines corresponding to Fig O.1 above, Fig O.2 The field lines may seem a little surprising given the look of Fig O.1, but here is a superposition with the rectangles lined up, Fig O.3 (c) The ODE Method We outline now an alternate (and doubtless well-known) method of plotting field lines. We imagine that the description of our field H can be described by a pair of parametric equations (not yet known), x = X(s) y = Y(s) (O.3) where s is a real parameter. It follows that dx = (dX/ds)ds dr = (dX/ds)ds + (dY/ds)ds dy = (dY/ds)ds . (O.4) We alter (O.1) by adding a "speed function" α(s) just because this might simplify calculations later. This function α is an arbitrary positive-definite function of parameter s. So, dr = α(s) ds H . (O.5) Then (O.4) and (O.5) give α(s) ds H = (dX/ds)ds + (dY/ds)ds α(s) ds [Hx(x,y) + Hy(x,y) ] = (dX/ds)ds + (dY/ds)ds α(s) Hx(x,y) = (dX/ds) α(s) Hy(x,y) = (dY/ds) // component equations (dX/ds) = α(s) Hx(X(s),Y(s)) (dY/ds) = α(s) Hy(X(s),Y(s)) . // using (O.3) (O.6) This is a pair of coupled, non-linear, first order differential equations. Conveniently, Maple knows how to numerically (and quickly) solve such a set of equations using its dsolve command (NDSolve in Mathematica). Given the solutions X(s) and Y(s), it is then a simple matter to plot the field lines. This is done in the following example. Example: Magnetic field lines for a two-cylinder transmission line In this example we assume that the current density in each conductor is uniform over the conductor cross section. This assumption is incorrect for a properly terminated transmission line as shown in Section 6.5, but is valid at DC and low ω for a finite-length pair of parallel wires perhaps shorted at one end to form a closed circuit. Nevertheless, we make the uniform current density approximation for a transmission line just to have a simple plotting example. Our first task is to derive expressions for the magnetic field components Hx and Hy. Consider this drawing of the transmission line cross section (radii are a1 and a2, center separation b) : Fig O.4 Current I flows into the plane of paper for the left conductor, and out of the plane for the right. We must do a vector addition of the two magnetic fields, H = H1(r1) 1 + H2(r2) 2 (O.7) where 1 = -sinθ1 + cosθ1 2 = -sinθ2 + cosθ2 . (O.8) From Ampere's Law for each conductor, as shown in (B.4.1) and (B.4.2), the field magnitudes are H1(r1) = (I/2π)[ θ(r1>a1) (1/r1) + θ(a1>r1) (r1/a12)] H2(r2) = -(I/2π)[ θ(r2>a2) (1/r2) + θ(a2>r2) (r2/a22)] (O.9) where θ(x>y) = H(x-y), the Heaviside step function. We then have from (O.7), H = H1(r1) [-sinθ1 + cosθ1] + H2(r2)[ -sinθ2 + cosθ2] = [ - sinθ1H1(r1) - sinθ2 H2(r2)] + [cosθ1 H1(r1) + cosθ2 H2(r2)] . But cosθ1 = (x/r1) sinθ1 = (y/r1) cosθ2 = ((x-b)/r2) sinθ2 = (y/r2) (O.10) so H = [ - (y/r1)H1(r1) - (y/r2) H2(r2)] + [(x/r1) H1(r1) + ((x-b)/r2) H2(r2)] and the magnetic component fields are then Hx = - (y/r1) H1(r1) - (y/r2) H2(r2) r12 = x2 + y2 Hy = (x/r1) H1(r1) + ((x-b)/r2) H2(r2) r22 = (x-b)2 + y2 . (O.11) We now enter the expressions (O.11) and (O.9) for the field components into Maple, setting the current arbitrarily to I = 2π units. Both conductor radii are set to 0.5 unit with center separation 1.25 units : The conventional Maple "field plot" can then be done this way : where the two red circles show the conductor surfaces, Fig O.5 Again, we get a vague feel for what the field lines might look like. We now compute these field lines using the ODE method. So after the first block of code shown above we add instead the following: The two unapply commands formally make Hx_ and Hy_ functions of variables x and y. The two equation lines define ODE's eq1 and eq2 which are none other than (O.6) with α(s) = 1. We decide to plot Ncurves = 16 field lines indexed by J. The Maple dsolve command numerically solves the ODE's with x0 = J*b/(Ncurves+1) and y0 = 0 as the starting point for the curve J. Maple returns its solution as two numerically interpolated functions X(s) and Y(s) which are just those functions we assumed we had in (O.3). Special code finds an appropriate range for parameter s so curves just close on themselves, or get truncated if they go beyond a set range. Finally, the odeplot command plots the parametric functions X(s) and Y(s) to create the field lines in certain display data structures called p[J] for J = 1 to 16. The PLOT command makes the rectangle in p2 and finally the display command shows the results. Even on an ancient PC, this code runs in about 15 seconds. Here is the resulting plot where we have made the conductor perimeters black and the field lines red: Fig O.6 Outside both conductors, the magnetic field is the same as it would be for conductors of a tiny radius, as the reader can verify by staring at (O.9). Here is the same plot with a1 = a2 = .01 : Fig O.6 Reader Exercise: Use H(x,y) as stated in (C.4.7), with F in (C.4.6), to plot field lines using the ODE method. Compare with the brute force method results shown in Fig O.2. (d) The Analytic Method The reader may notice a striking similarity between the last plot above and Fig 6.2 which displays some Circles of Apollonius. The magnetic field lines of two parallel thin wires are indeed such circles, and this can be shown using the following third method of plotting field lines. From (O.5) that dr = α(s) ds H we may write dy = α(s) ds Hy dx = α(s) ds Hx (O.12) so = Hy/Hx // right side is ratio "rat" in the code below (O.13) or Hx(x,y) = Hy(x,y) . (O.14) This is a first-order non-linear ODE which Maple (or the reader) may be able to solve analytically for the solution y(x) which is then an analytic expression for the field line. For two thin wires, here is Maple's analytic solution using the dsolve command in its default analytic mode, Renaming the constant _C1 to be "c", and squaring the solutions shown above, one finds that (x-xc)2 + y2 = r2 xc = b/4+c r2 = c2 - bc/2 - 3(b/4)2 (O.15) where recall that b is the separation of the two thin wires. Thus, the field lines are in fact circles with centers on the x axis. Reader Exercise : 1. Using the data presented in Bipolar Coordinates and the Two-Cylinder Capacitor , show that the set of circles found above are Apollonian circles with these Apollonian parameters, a = b/2 ξ = ch-1[(b/4+c)/( c2 - bc/2 - 3(b/4)2)] (O.16) 2. Why might one expect Apollonian Circles for the B field lines in this magnetostatics problem, knowing that such circles also describe the potential contours of the electrostatics problem of two cylinders? [ Hint: See (5.3.10) and (5.3.11) with β2 = k2 and (3.7.19) concerning the relation between Az and the B field lines.]