-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFluidScales.tex
More file actions
169 lines (143 loc) · 6.88 KB
/
FluidScales.tex
File metadata and controls
169 lines (143 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
% Different scales of fluid modelling
% Author: Tobit Flatscher (https://github.com/2b-t)
%
% Description
% When describing the behaviour of fluids in fluid mechanics
% one could adapt multiple viewpoints, different scales of
% modelling. The complicated ordered macroscopic behaviour (where
% macroscopic state variables such as temperature T, pressure p
% and velocity v exist) of a fluid also emerges from simple
% interaction rules between single particles or fictitious particle
% clusters.
% Therefore one generally distinguishes between three different
% scales of fluid modelling:
% - Microscopic models: In very rarefied fluids, such as in a
% dilute gas, single particles interact with each other through
% pairwise elastic collisions that may be described using
% classical Newtonian mechanics. The gas is so dilute interactions
% between multiple particles at once are rare and a density for a
% point in space does not necessarily exist.
% - Macroscopic models: On a macroscopic level fluids are seen as
% dense collections of atoms - state variables like density and
% pressure must exist. This is the level of the well-known Navier-
% Stokes equations or the simple Bernoulli equation.
% - Mesoscopic models: As a gas at room temperature contains around
% 10^19 molecules per cm^3, microscopic models for dense fluids
% can't be applied with reasonable effort while for dilute gases
% macroscopic models do not exist (no density can be found).
% Thus probabilistic densities in space as well as in velocity
% space (the chance to find a particle in space with a certain
% microscopic particle velocity) may be introduced. For discrete
% models this results in a lattice, a discrete velocity space where
% the length f the corresponding vector reflects the chance of
% finding a particle in the particular space direction.
% The following script creates an image displaying those different
% modelling scales using random variables and patterns.
%document settings
\documentclass[border=10pt]{standalone}
\usepackage{xintexpr} %for if statements
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings} %library for patterns
%random number generator
\newcommand{\GenVar}[3]{
\pgfmathsetmacro{\RandomOne}{random(#1,#2)/#3} %generate two random numbers (x,y coordinates)
\pgfmathsetmacro{\RandomTwo}{random(#1,#2)/#3}
}
\begin{document}
%create lattice pattern
\tikzset{
lattice/.pic = {
\fill (0,0) circle [radius=2pt]; %center circle
\foreach \x in {-1,0,1}{ %for all velocities in x direction
\foreach \y in {-1,0,1}{ %for al velocities in y direction
\xintifboolexpr {\x == 0 && \y == 0} %for a velocity with velocity 0
{} %do nothing
{\GenVar{27}{40}{100} %else: generate a new random number
\draw [-stealth,line width=0.15mm] (\RandomOne*\x,\RandomOne*\y) to (0.08*\x,0.08*\y);} %plot an arrow with random length
}
}
}
}
%create atom with microscopic velocity
\tikzset{
atom/.pic = {
\GenVar{2}{14}{10} %generate random number
\draw [-stealth,line width=0.15mm, color=lightgray] (0,0) to (0.5-\RandomOne,0.5-\RandomTwo); %draw velocity (offset for negative values)
\fill[color=midgray] (0,0) circle [radius=3pt]; %draw atom
}
}
%define colors:different shades of gray
\definecolor{lightgray}{rgb}{0.8, 0.8, 0.8}
\definecolor{midgray}{rgb}{0.6, 0.6, 0.6}
\definecolor{darkgray}{rgb}{0.4, 0.4, 0.4}
%draw picture
\begin{tikzpicture}[scale=0.75, transform shape] %scale the whole picture
%MESOSCOPIC LEVEL
\foreach \countx in {-2,-1,0,1,2}{
\foreach \county in {-2,-1,0,1,2}{
\xintifboolexpr {\countx == 0 && \county == 0} %apart from center cell
{}
{\path[midgray] (\countx,\county) pic{lattice};} %insert lattice pattern
}
}
\path[black] (0,0) pic{lattice}; %center lattice pattern
%draw mesoscopic cells
\foreach \countx in {-3,-1,1,3}{
\draw[fill=none, draw=lightgray] (\countx/2,-2) -- (\countx/2,2); %vertical lines
}
\county=-3
\foreach \county in {-3,-1,1,3}{
\draw[fill=none, draw=lightgray] (-2,\county/2) -- (2,\county/2); %horizontal lines
}
\draw[fill=none, draw=darkgray] (-0.5,-0.5) rectangle (0.5,0.5); %draw center cell
%MICROSCOPIC LEVEL
\path[] (-6+1,1.3) pic{atom}; %create atoms at positions with random velocity direction
\path[] (-6-0.7,-0.7) pic{atom};
\path[] (-6-1.5,1.6) pic{atom};
\path[] (-6+1.3,-1) pic{atom};
\path[] (-6,-1.6) pic{atom};
\path[] (-6-1.3,0.75) pic{atom};
\path[] (-6,2) pic{atom};
\path[] (-6-1.5,-2.5) pic{atom};
\path[] (-6+1.75,-2.05) pic{atom};
\path[] (-6-1.95,-1.5) pic{atom};
\path[] (-6+2.1,2.1) pic{atom};
\draw [-stealth,line width=0.15mm, color=darkgray] (-6,0.2) to (-6+0.5,0.2-0.5); %colored atom
\fill[color=black] (-6,0.2) circle [radius=3pt];
%MACROSCOPIC LEVEL
\foreach \countx in {-1,0,1}{
\foreach \county in {-1,0,1}{
\xintifboolexpr {\countx == 0 && \county == 0} %apart from center cell
{}
{\node[draw=none,text=midgray] at (6+2*\countx, 2*\county) {$T, p, \vec v$};} %create label
}
}
\node[draw=none,text=black] at (6, 0) {$T, p, \vec v$}; %create center cell label
\draw[fill=none, draw=lightgray] (6-1,-2) -- (6-1,2); %draw vertical lines
\draw[fill=none, draw=lightgray] (6+1,-2) -- (6+1,2);
\draw[fill=none, draw=lightgray] (6-2,1) -- (6+2,1); %draw horizontal lines
\draw[fill=none, draw=lightgray] (6-2,-1) -- (6+2,-1);
\draw[fill=none, draw=darkgray] (6-1,-1) rectangle (6+1,1); %draw center cell
%overlay excess material with white boxes
\draw[fill=white, draw=none] (2,-3) rectangle (4,3);
\draw[fill=white, draw=none] (-4,-3) rectangle (-2,3);
\draw[fill=white, draw=none] (8,-3) rectangle (8.5,3);
\draw[fill=white, draw=none] (-8.25,-3) rectangle (-8,3);
\draw[fill=white, draw=none] (-8,2) rectangle (8,3);
\draw[fill=white, draw=none] (-8,-3) rectangle (8,-2);
%draw boxes
\draw[] (-2-6,-2) rectangle (2-6,2);
\draw[] (-2,-2) rectangle (2,2);
\draw[] (-2+6,-2) rectangle (2+6,2);
%add labels
\node[draw=none] at (-6, 2.6) {\LARGE Microscopic}; %add titles
\node[draw=none] at (0, 2.6) {\LARGE Mesoscopic};
\node[draw=none] at (6, 2.6) {\LARGE Macroscopic};
\node[draw=none,align=left] at (-6, -2.9) {\Large Particle collisions \\ Newtonian mechanics}; %add caption
\node[draw=none,align=left] at (0, -2.9) {\Large Probabilistic approach \\ Fictitious particle clusters};
\node[draw=none,align=left] at (6, -2.9) {\Large Continuum hypothesis \\ Macroscopic state variables};
%remove excess area
\pgfresetboundingbox
\path[use as bounding box, draw=none] (-7.5,-3.55) rectangle (8.5,3);
\end{tikzpicture}
\end{document}