Skip to content

Instantly share code, notes, and snippets.

@aitatanit
Created January 22, 2017 06:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aitatanit/5e7c2115f15725622aec06034d8e6b88 to your computer and use it in GitHub Desktop.
Save aitatanit/5e7c2115f15725622aec06034d8e6b88 to your computer and use it in GitHub Desktop.
Finite Difference Method - explicit stencil in TikZ
% Author: JE Touma (aitatanit@gmail.com)
% Finite difference method - explicit 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, 1.5) {$j, n$};
\draw[line width=0.4mm] (4.8,2) -- (2.2,2);
\filldraw[fill=red!80!white, draw=black,very thick] (2,2) circle (0.2cm);
\node at (2, 1.5) {$j-1, n$};
\draw[line width=0.4mm] (5.2,2) -- (7.8,2);
\filldraw[fill=red!80!white, draw=black,very thick] (8,2) circle (0.2cm);
\node at (8, 1.5) {$j+1, n$};
%\draw[line width=0.4mm] (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-1$};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment