Divergence of vector fields

Also see the curl examples, or other figures under the “vectors” tag: the vector sum rule, scalar product, right-hand rule.

divergence-001.pngdivergence-002.pngdivergence-003.pngdivergence-004.png

Edit and compile if you like:

% Author: Izaak Neutelings (Februari, 2020)
\documentclass[border=3pt,tikz]{standalone}
\usepackage{physics}
\usepackage{tikz}
\tikzset{>=latex} % for LaTeX arrow head
\usepackage{xcolor}
\colorlet{veccol}{orange!90!black}
\colorlet{myblue}{blue!60!black}
\tikzstyle{vector}=[->,thick,veccol]
\def\R{1.4}
\def\r{0.03}
\def\N{9}
\def\null{\color{myblue}{0}}

\begin{document}


% RADIAL OUTWARD
\begin{tikzpicture}
  \fill[myblue] (0,0) circle (\r);
  \foreach \i [evaluate={\ang=\i*360/\N;}] in {0,...,\N}{
    \draw[vector] (\ang:0.1*\R) --++ (\ang:\R);
  }
  \node at (0,-1.35*\R) {$\div{{\color{veccol}\vb{v}}} > 0$};
\end{tikzpicture}


% RADIAL INWARD
\begin{tikzpicture}
  \fill[myblue] (0,0) circle (\r);
  \foreach \i [evaluate={\ang=\i*360/\N;}] in {0,...,\N}{
    \draw[vector] (\ang:1.1*\R) -- (\ang:0.1*\R);
  }
  \node at (0,-1.35*\R) {$\div{{\color{veccol}\vb{v}}} < 0$};
\end{tikzpicture}


% ZERO
\begin{tikzpicture}
  \def\ang{60}
  \fill[myblue] (0,0) circle (\r);
  \foreach \x/\y in {-1/0,-1/1,0/1,1/1,1/0,-1/-1,0/-1,1/-1}{
    \draw[vector] (\x*0.5*\R,\y*0.5*\R) ++ (\ang-180:\R/2) --++ (\ang:\R);
  }
  \node at (0,-1.35*\R) {$\div{{\color{veccol}\vb{v}}} = \null$};
\end{tikzpicture}


% ZERO - solenoid
\begin{tikzpicture}
  \def\ang{60}
  \def\N{6}
  \fill[myblue] (0,0) circle (\r);
  %\foreach \x/\y in {-1/0,-1/1,0/1,1/1,1/0,-1/-1,0/-1,1/-1}{
  %  \draw[vector] (\x*0.5*\R,\y*0.5*\R) --++ (-\y*0.2*\R,\x*0.2*\R);
  %}
  \foreach \R in {0.44,0.88}{
    \foreach \i [evaluate={\ang=\i*360/\N;}] in {1,...,\N}{
      \draw[vector] (\ang:\R) --++ (\ang+90:\R);
    }
  }
  %\foreach \i [evaluate={\ang=\i*360/\N;}] in {1,...,\N}{
  %  \draw[vector] (\x*0.5*\R,\y*0.5*\R) ++ (\ang-180:\R/2) --++ (\ang:\R);
  %}
  \node at (0,-1.3*\R) {$\div{{\color{veccol}\vb{v}}} = \null$};
\end{tikzpicture}


\end{document}

Click to download: divergence.texdivergence.pdf
Open in Overleaf: divergence.tex

Leave a Reply

Your email address will not be published.