2

I am drawing a tikz diagram of a circle with equally spaced field flow lines flowing around it, starting from below, up, around, then up. I was not able to find a post that was helpful for this one. I've tried using \draw..controls which allows curved paths using control points, for Bezier curves. My difficulty is that it only allows two control points, so flowing around something like a cirlce seems impossible. Too much distance between points and it goes thru it. Too little, then it can't go all the way around. I'd love to figure out a way to do this. Any ideas to draw equally spaced flow lines around a circle? Thanks. An minimum working example code is below, although I'm not sure where this should go. Thx again.

\begin{tikzpicture}
\filldraw [black,fill=gray] (3,0) circle (1);
\draw[->] (2.5, -2.0) .. controls (2.5,-1.2) and (2.25,-1.0) .. (0.8,0);
\draw[->] (2.3, -2.0) .. controls (2.3,-1.2) and (2.05,-1.0) .. (0.6,0);
\end{tikzpicture}  

Per the suggestion, I've added an image...a pretty bad one, but hopefully it still helps to show what I would like to do. Thx again! Flow lines around a circle

  • 6
    Welcome to TeX.SE! Could you please append a sketch of what you want? Just saying "flow lines" does not uniquely fix the contours. Notice that, if you have a parametrization of the flow lines, you may just plot these. – user121799 Oct 19 '18 at 0:59
  • There is a difference between an MWE and a code snippet. Yours is a code snippet ;) – thymaro Oct 19 '18 at 10:19
  • Welcome to TeX.SE! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. The easier it is to copy and test your code, the more likely your question will be answered and can help others in a similar situation. – thymaro Oct 19 '18 at 10:19
3

Here is a proposal that looks somewhat similar to what you draw by hand.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{intersections}
\begin{document}

\begin{tikzpicture}
\filldraw [black,fill=gray] (0,0) circle (1);
\path (0,-3) coordinate (low) (0,3) coordinate (high);
\begin{scope}[overlay]
\foreach \X in {250,290}
{\path[name path global=\X-ray] (0,0) -- (\X:3);}
\end{scope}
\foreach \Z [count=\Y]in {0.3,0.6,0.9}
{\path[name path=circle-\Y] (0,0) circle(1+\Z);
\foreach \X in {250,290}
{\path[name intersections={of=\X-ray and circle-\Y,by=P-\Y-\X}];}
\draw[-latex] ([xshift=2mm]P-\Y-250 |-low) -- 
([xshift=2mm,yshift=-2mm]P-\Y-250) to[out=90,in=-20] (P-\Y-250)
arc(-110:-250:1+\Z) to[out=20,in=-90] ++(0.2,0.2) -- ([xshift=2mm]P-\Y-250 |-high);
\draw[-latex] ([xshift=-2mm]P-\Y-290 |-low) -- 
([xshift=-2mm,yshift=-2mm]P-\Y-290) to[out=90,in=-160] (P-\Y-290)
arc(-70:70:1+\Z) to[out=160,in=-90] ++(-0.2,0.2) -- ([xshift=-2mm]P-\Y-290 |-high);
}
\end{tikzpicture}  

\end{document}

enter image description here

  • Hi everyone. Thanks for the fast solution, marmot. It certainly gets me closer to what I want! I'll also want get the lines to be more uniformly distributed, so hopefully I can make changes that achieve this. I'll update once I do that. Thanks again. This is so helpful!! – Makai_man Oct 19 '18 at 20:38
7

It is a very late answer, but it is worth to show the "physical" solution, as the nice picture provided by @marmot is poorly related to the real problem.

In the same spirit as my answer to this question: field-lines-of-a-coplanar-waveguide, but with much less mathematics: Assuming an Eulerian fluid (incompressible and no viscosity) the lines of flow are the gradient lines of a "velocity potential" V(x,y) which is an harmonic function (Laplacian=0) outside the disk. Using the boundary conditions at both infinity and disk peripheral, one easily get:

$V(r,\theta) = r \sin(\theta) + \frac{\sin(\theta)$

where r and \theta are the polar coordinates, assuming $R=1$ for simplicity. This function is the imaginary part of the holomorphic function $z\mapsto z-1/z$.

It is then simple to get the flow lines by calling gnuplot to draw the contour lines of the real part of this function.

By this way we get the following MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}

\def\gnuplotscript{
   ii={0,1};
   ZZ(x,y)=(x+ii*y)-1/(x+ii*y);
   set sample 100;
   unset surface;
   unset key;
   set contour;
   set view map;
   set cntrparam cubicspline;
   set size square;
   set cntrparam levels 12;
   set isosample 20;
}

\begin{tikzpicture}
\begin{axis}[no markers, axis on top, 
    tick label style={font=\small},
    xlabel={$x$}, ylabel={$y$},
    xmin=-2.5, xmax=2.5, ymin=-2.5, ymax=2.5,
    width=12cm, height=12cm
]    
\addplot[contour prepared,raw gnuplot, thick, 
    contour/draw color=red,contour/labels=false] 
    gnuplot {%
    \gnuplotscript
    splot[-2.5:2.5][-2.5:2.5] (x**2+y**2)<1?0:abs(real(ZZ(x,y)));                  
    };
\draw[color=red,thick] (axis cs: 0,2.5) -- (axis cs: 0,1) (axis cs: 0,-2.5) -- (axis cs: 0,-1);
\draw [ultra thick, draw=black]  (axis cs: 0,0) circle(1);
\end{axis}
\end{tikzpicture}

\end{document}

and the result: enter image description here

1

Run with xelatex (needs some time)

\documentclass[pstricks]{standalone}
\usepackage{pst-func}

\begin{document}
\begin{pspicture*}(-5,-2.2)(5.5,3.5)
 \pscircle(0,0){1}%
 \psaxes{->}(0,0)(-5,-2)(5.2,3)%
 \multido{\rA=0.01+0.2}{5}{%
    \psplotImp[linewidth=1pt,linecolor=blue,polarplot,
    stepFactor=0.2](-6,-6)(5,2.4){%
        r dup mul 1.0 r div sub phi sin dup mul mul \rA\space sub }}%
 \uput*[45](0,2){$f(r,\phi)=\left(r^2-\frac{1}{r}\right)\cdot\sin^2\phi=0$}
\end{pspicture*}
\end{document}

enter image description here

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.