4

How to draw dipole field lines around sphere, like here:

enter image description here

\begin{tikzpicture}[>=latex']
\tikzstyle{every node}=[font=\footnotesize]
\draw [thick, red] (-2,0) -- node [below] {+} (2,0) node (v3) {};
\draw [thick, red] (-2,2.5) --node [above] {$-$}  (2,2.5) ;
\draw  [blue] (0,0)  -- (0,0.5);
\draw  [blue] (0,1) ellipse (0.5 and 0.5);
\node [below] (v2) at (0,1.5) {\tiny +};
\node [above] (v1) at (0,0.5) {\tiny  --};
\draw  [->, blue] (0,0.75) -- (0,1.2) node [right] {$\vec p_{e}$};
\end{tikzpicture}
  • 1
    What is the mathematical description of these field lines? Have you tried to paths with various in and out angles? Or plain ellipses? What is the problem you have? What is the connection between your image and your code? – Qrrbrbirlbel Jun 6 '15 at 20:37
  • I need to draw field lines around sphere in my MWE. I think it can be done with simple ellipses for illustration. – sergiokapone Jun 6 '15 at 20:45
  • I suggest \draw circle[radius=1]; \clip (-5,-3) rectangle (5,3) (0,0) circle[radius=1]; and then draw away. For example: \foreach \val in {2,3,5,8,12,20,50,140} \draw[delta angle=360] (0,0) arc[start angle=0, y radius=\val, x radius=2*\val] -- cycle (0,0) arc[start angle=180, y radius=\val, x radius=2*\val] -- cycle; – Qrrbrbirlbel Jun 6 '15 at 20:53
  • This might be interesting to look at: texample.net/tikz/examples/dipolar-magnetic-field – Melian Jun 6 '15 at 23:25
  • I did see that, but using that code it will look slightly different from your example. Would that be ok? – Alenanno Jun 7 '15 at 0:48
9

Here's a solution drawing a polar plot. It's slightly different than your image but to be honest I'm not really an expert with functions, graphs and so on.

I slightly changed the coordinates of the lines and stuff (the circle is at 0,0 now, not 0,1 and it's a node, which is easier to use as reference), and everything in your code.

Output

figure 1

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz} 

\usetikzlibrary{arrows.meta,positioning,decorations.markings,backgrounds}

\tikzset{
    every node/.style={font=\footnotesize},
}

\begin{document}
\begin{tikzpicture}[-]
\def\my{.5mm}

\draw [thick, red] (-2,-1) -- node [below] {+} (2,-1) node (v3) {};
\draw [thick, red] (-2,1) -- node [above] {$-$}  (2,1) ;

\node[draw=blue, fill=white, circle, ,minimum size=1cm, inner sep=0, outer sep=0] (circ) at (0,0) {};
\draw [-{Latex},blue] (0,-1) -- (circ.south);
\node [below] (v2) at (0,.5) {\tiny +};
\node [above] (v1) at (0,-.5) {\tiny  --};
\draw [-{Latex}, blue] (0,-.2) -- (0,.2) node [right] {$\vec p_{e}$};

%\path[clip] (-2,0) -- (2,0) -- (2,2) -- (-2,2) -- cycle;
\begin{scope}[scale=.3,on background layer]
\clip[scale=3.3] (-2,-1) rectangle (2,1);
\foreach \a [count=\b] in {1,2,3,4,5,6,7,8,9,10}{
    \draw[domain=0:6.3,samples=500, line width=.1pt, decoration={markings,%
        mark=at position 0.1 with {\arrow{Stealth[width=\my,length=\my]}},
        mark=at position 0.4 with {\arrowreversed{Stealth[width=\my,length=\my]}},
        mark=at position 0.5 with {\arrowreversed{Stealth[width=\my,length=\my]}},
        mark=at position 0.6 with {\arrowreversed{Stealth[width=\my,length=\my]}},
        mark=at position 0.9 with {\arrow{Stealth[width=\my,length=\my]}},
        mark=at position 1 with {\arrow{Stealth[width=\my,length=\my]}},}, postaction=decorate] plot (xy polar cs:angle=\x r,radius={\a+\b*cos(2*\x r)});
}
\end{scope}
\end{tikzpicture}
\end{document}
  • 1
    +1 for the nice drawing, but the physics of those field lines is completely wrong. Field lines are always aligned perpendicular at a charged surface! (OP's picture doesn't perform well either concerning that issue.) – Henri Menke Jun 7 '15 at 13:22
  • @HenriMenke Thanks and that's because it's just a plot of an infinity sign. :D I didn't know that though, but they're not perpendicular in the reference pictures I saw. Even the picture the OP posted has them not being all perpendicular (with the exception of the poles)? Or maybe you meant the poles? If I knew more about polar plotting, it would be less hard to fix. – Alenanno Jun 7 '15 at 13:28
  • I'm not referring to the sphere but to the plates of the capacitor in your picture. (I just noticed that there is no capacitor present in OP's picture, so his picture actually performs well regarding physics) – Henri Menke Jun 7 '15 at 13:55
  • @HenriMenke That picture is actually taken from Wikipedia. But can you link some picture that shows what you're saying, because I'm not sure I understand. Here's another one, and still not perpendicular. So maybe I'm missing something. – Alenanno Jun 7 '15 at 14:05
  • This is the closest picture I could find. It shows a single charge (monopole) in front of a metallic surface. The charge on the other side of the wall is the image charge, which is an imaginary charge of opposite sign introduced for mathematical reasons. The red charge induces an opposite charge on the wall, i.e. the wall gets charged by the sheer presence of the red charge. The field lines are perpendicular on the wall. – Henri Menke Jun 7 '15 at 14:20

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.