Skip to content

Instantly share code, notes, and snippets.

@aitatanit
Created January 22, 2017 06:37
Show Gist options
  • Save aitatanit/4b4c7f5532a82e62d4d7d6fc7e0a0300 to your computer and use it in GitHub Desktop.
Save aitatanit/4b4c7f5532a82e62d4d7d6fc7e0a0300 to your computer and use it in GitHub Desktop.
Finite Difference Method - Crank-Nicolson Stencil in TikZ
% Author: JE Touma ([email protected])
% Finite difference method - crank-nicolson stencil
\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}
\usetikzlibrary{calc,decorations.pathmorphing,patterns}
\begin{document}
\begin{tikzpicture}[decorate]
%\filldraw[fill=red!80!white, draw=black,very thick] (5,5) circle (0.2cm);
%\draw[line width=0.4mm] (5,4.8) -- (5,2.2);
%\node at (5, 5.5) {$j, n+1$};
\filldraw[fill=red!80!white, draw=black,very thick] (5,2) circle (0.2cm);
\node at (5, 2.5) {$j, n+1$};
\draw[line width=0.6mm] (4.8,2) -- (2.2,2);
\filldraw[fill=red!80!white, draw=black,very thick] (2,2) circle (0.2cm);
\node at (2, 2.5) {$j-1, n+1$};
\draw[line width=0.6mm] (5.2,2) -- (7.8,2);
\filldraw[fill=red!80!white, draw=black,very thick] (8,2) circle (0.2cm);
\node at (8, 2.5) {$j+1, n+1$};
\draw[line width=0.6mm] (5,1.8) -- (5,-0.8);
\filldraw[fill=red!80!white, draw=black,very thick] (5,-1) circle (0.2cm);
\node at (5, -1.5) {$j, n$};
\draw[line width=0.6mm] (4.8,-1) -- (2.2,-1);
\filldraw[fill=red!80!white, draw=black,very thick] (2,-1) circle (0.2cm);
\node at (2, -1.5) {$j-1, n$};
\draw[line width=0.6mm] (5.2,-1) -- (7.8,-1);
\filldraw[fill=red!80!white, draw=black,very thick] (8,-1) circle (0.2cm);
\node at (8, -1.5) {$j+1, n$};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment