8

I want to draw the electrical and magnetic field lines of a coplanar waveguide. Similar to figure (b) in this image. I want to draw this using TikZ. It would be no problem for me to somehow hack some ugly code that more or less looks like it. However, I want to create a flawless image.

Let me explain the biggest problem for me: The waveguide consists of the inner conductor and the two other conductors. The electrical field lines go in elliptical curves from the inner to the outer conductor. The magnetic filed lines form ellipses around the inner conductor. The main aspect, which is often displayed wrong in many images, is that the electical and magnetic filed lines always intersect perpendicular to each other. As you can see in the image above, it looks pretty good but the lines are not perpendicular.

I could somehow draw some bend curves and play with the parameters until it looks fine. But I want a clean solution that draws these lines in a way that they really are perpendicular. I tried figuring out some angle-preserving transformation (Möbius transformation mabye?) that maps a grid onto elliptical/hyperbolic curves. But my math skills in this field are long gone.

I hope someone can help me.

EDIT: The electrical filed lines should also be perpendicular to the surface of the conductor.

  • If these are Apollonian circles you may want to append that information to your question such that you get an answer more quickly. – user121799 Aug 22 '18 at 13:40
  • 1
    The problem is. These lines are not really anything. The magnetic field lines form ellipes around the inner conductor, but to the outer conductors they're hyperbolas. I don't really know if there actually is a mathematically way to describe this. However, I want to achieve a quite accurate image. – GNA Aug 22 '18 at 13:47
  • IMHO the main problem is not TeX related, but that there is no explicit analytical solution of this problem. Some approximation can be done if you accept to neglect t with respect to w and wg, and set h going to infinity. Once you have a formula for the (electrostatic) potential, field lines (for E) and equipotential (B fields lines) can be easily obtained with gnuplot, as described in section 'contours plots' (4.6.8) of the manual – Jhor Aug 29 '18 at 10:12
7

As said in the comment, the problem of these lines of field can be recast in equipotential lines of static electrostatic and magnetic 2D fields. Below is a code that plot the fields lines, using the package pgfplots (based on PFG/TikZ), and its functionality to plot "contour lines", by an external call to gnuplot.

As the fields are obtained by using complex numbers that gnuplot can handle but not pgfplots, I had to resort to the option raw gnuplot, as described in the pgfplots documentation and in this question.

A document explaining the derivation of these fields is available here

\begin{tikzpicture}
% geometrical parameters
\def\ai{1}
\def\bi{1.5}
\def\bii{6.}
% raw gnuplot setup
\def\gnuplotcommon{
    set contour base;
    set cntrparam cubicspline;
    unset surface;
    set key off;
    set view map;
    set isosamples 50;
    ii={0,1};
    FF(x,y)=((x)+ii*y)*(log((x)+ii*y)-1);
    FFF(x,y)=(FF(x-\ai,y)-FF(x+\ai,y))-(\ai/(\bii-\bi))*
    ((FF(x-\bii,y)-FF(x-\bi,y))+(FF(x+\bi,y)-FF(x+\bii,y)));
}

\begin{axis}[
    no markers, axis on top, tick label style={font=\small},
    minor y tick num=1, minor x tick num=1,
    y label style={at={(axis description cs:-0.05,.5)},rotate=-90,anchor=south},
    xlabel={$x$}, ylabel={$y$},
    xmin=-10, xmax=10, ymin=-10, ymax=10,
    width=10cm, height=10cm,
    point meta=10,empty line = jump
]%

% magnetic field
\addplot[contour prepared,raw gnuplot, thick, contour/draw color=red,contour/labels=false]
gnuplot {%
    \gnuplotcommon
    set cntrparam levels discrete 3.8,3.4,3,2.6,2.2,1.9,1.7,1.4,1.2,1,
    0.8,0.6,0.4,0.5,0.2,0,-0.2,-0.4,-0.6,-0.8;
    splot[-10:10][-10:10] real(FFF(x,y));
};

% electric field 1/2 top
\addplot[contour prepared,raw gnuplot, thick, contour/draw color=blue,contour/labels=false]
gnuplot {%
    \gnuplotcommon
    set cntrparam levels discrete -2.5,-2.25,-2,-1.75,-1.5,-1.25,-1,-0.75,-0.5,-0.25,-0.1,0,
    0,0.1,0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5;
    splot[-10:10][0.01:10] imag(FFF(x,y));
};
% electric field 1/2 bottom
\addplot[contour prepared,raw gnuplot, thick, contour/draw color=blue,contour/labels=false]
gnuplot {%
    \gnuplotcommon
    set cntrparam levels discrete -2.5,-2.25,-2,-1.75,-1.5,-1.25,-1,-0.75,-0.5,-0.25,-0.1,0,0,
    0.1,0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5;
    splot[-10:10][-10:-0.01] imag(FFF(x,y));
};
% conductors
\addplot[mark=none, black, ultra thick] coordinates {(-\ai,0) (\ai,0)};
\addplot[mark=none, black, ultra thick] coordinates {(-\bii,0) (-\bi,0)};
\addplot[mark=none, black, ultra thick] coordinates {(\bi,0) (\bii,0)};
\end{axis}
\end{tikzpicture}

With the result:

enter image description here

Notice:

  • a correct rendering on a large region requires a very high sampling (set isosamples 50;) producing a rather large amount amount of data that pdflatex can not handle out of the box (though one of the three \addplot alone can be compiled without trouble). Hence this file must be compiled using lualatex with the -enable-write18 option, or using pdflatex once it has been extended as explained on this page.
  • The cut of the electric field map in two parts avoids the creation of very high density contours lines in the vicinity of the conductors.
  • The geometrical parameters just below \begin{tikzpicture} can be modified to tune de width of the strips.
  • EDIT 2: At some points the orthogonality of the (blue) electric field lines with respect to the conductors is not respected. This results from the adopted modelization where the thickness t has been neglected, making the resulting formula invalid at short distance (thanks to the rather simple form of the result, this could be fixed in a rather simple way). In physical terms, setting t=0 makes the curvature of the lines going to infinity inside the conductors.

EDIT 1: it was a small inconsistency in both the calculation of the field and the TikZ code. These are now corrected in the supporting document, the gnuplot code, and the picture. The older picture seemed odd_looking, as the fields must look like quadrupolar at large distance.

At the same time, the equipotential levels have been specified in order to obtain more interesting patterns. These levels slightly depend on the chosen geometrical parameters and would have to be modified for a different geometry, or the set cntrparam levels discrete ....; lines could be replaced by set cntrparam levels auto 20;

  • I just edited my answer with new code and picture, as a small calculation mistake was present in the first version (of sept 27th) – Jhor Sep 30 '18 at 17:03
  • The orthogonality of the electric field lines with the surface of the electrodes already discussed in the answer, is in fact not necessary, even in a full calculation avoiding the limit where $t$ goes to 0. Indeed this statement (known as Poisson law) holds only for a conductor at equilibrium, in the which both E an \rho vanish. In the present problem, the "effective" charge density is uniformly spread in the volume of the electrodes, that hence can not be equipotential surfaces – Jhor Oct 1 '18 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.