forked from Open-Astrophysics-Bookshelf/numerical_exercises
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CompHydroTutorial.tex
423 lines (284 loc) · 9.53 KB
/
CompHydroTutorial.tex
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
\documentclass[11pt]{book}
% include figures
\usepackage{epsfig,wrapfig}
% prefer PDF to PNG
\DeclareGraphicsExtensions{%
.pdf, .png}
\graphicspath{{preface/}{intro/}{finite-volume/}{advection/}{burgers/}{diffusion/}{Euler/}{incompressible/}{multigrid/}{multiphysics/}{low_mach/}{pyro/}}
% AMS symbols
\usepackage{amsmath,amssymb}
% cancel
\usepackage{cancel}
% Palatino font (and math symbols) -- looks nicer than the standard
% LaTeX font
\usepackage{mathpazo}
%\usepackage{helvet}
% URLs (special font for monospace)
%\usepackage{inconsolata}
%\usepackage[T1]{fontenc}
% margins and paper size -- this needs to come before fncychap
% see http://stackoverflow.com/questions/3729099/latex-paper-size
\usepackage[top=0.75in,
bottom=0.75in,
inner=0.9in,
outer=0.65in]{geometry}
\geometry{papersize={7in,10in}}
% crop marks (for printing)
%\usepackage[
% noinfo,
% cam,
% cross, % crosses as marks
% width=7.25in, % the width of the galley
% height=10.25in, % the height of the galley
% center % actual page is centered on the galley
%]{crop}
% this needs to be done before the fncychap style, since that will
% redo the chapter stuff
\usepackage{sectsty}
\allsectionsfont{\sffamily}
% chapter title styles
%\usepackage[Bjornstrup]{fncychap}
%\ChNumVar{\fontsize{76}{80}\usefont{OT1}{pzc}{m}{n}\selectfont}
%\ChTitleVar{\raggedleft\Large\sffamily\bfseries}
\usepackage[PetersLenny]{fncychap}
\ChNameVar{\fontsize{16}{18}\usefont{OT1}{phv}{m}{n}\selectfont}
\ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
\ChTitleVar{\Huge\bfseries\sffamily}
\ChRuleWidth{1pt}
% part page style
% see http://tex.stackexchange.com/questions/6609/problems-with-part-labels-using-titlesec
\usepackage{titlesec}
\titleformat{\part}[display]
{\bfseries\sffamily\Huge\filcenter}
{{\partname{}} \thepart}
{0em}
{\hrule}
% hyperlinks -- load after fncychap
\usepackage{hyperref}
% color package
\usepackage{color}
\definecolor{mygray}{gray}{0.5}
% custom hrule for title page
\newcommand{\HRule}{\rule{\linewidth}{0.125mm}}
\newcommand{\pyro}{{\sf pyro}}
\newcommand{\git}{{\tt git}}
% footer
%% \usepackage{fancyhdr}
%% \pagestyle{fancy}
%% \fancyfoot[LO,LE]{\footnotesize \sffamily \color{mygray} M.\ Zingale---Notes on the Euler equations}
%% \fancyfoot[RO,RE]{\footnotesize \sffamily \color{mygray} (\today)}
%% \fancyfoot[CO,CE]{\thepage}
%% \fancyhead{}
%% \renewcommand{\headrulewidth}{0.0pt}
%% \renewcommand{\footrulewidth}{0.0pt}
% don't make the chapter/section headings uppercase. See the fancyhdr
% documentation (section 9)
\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername
\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection---#1}}
% don't put a header on blank pages, see
% http://www.latex-community.org/forum/viewtopic.php?f=4&p=51559
% change ``plain'' to ``empty'' to eliminate the page number
\makeatletter
\renewcommand*\cleardoublepage{\clearpage\if@twoside
\ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
% skip a bit of space between paragraphs, to enhance readability
\usepackage{parskip}
% captions
\usepackage{caption}
\renewcommand{\captionfont}{\footnotesize}
\renewcommand{\captionlabelfont}{\footnotesize}
\setlength{\captionmargin}{3em}
%-----------------------------------------------------------------------------
% define a new environment for exercises
%\newcounter{exercise} % simple way -- no TOC list
% toclot allows us to make a list of exercises
% the new environment stuff came from http://www.dickimaw-books.com/latex/novices/html/newenv.html
\usepackage{tocloft}
\newcommand{\listexercisename}{List of Exercises}
% the [chapter] argumenet here means that we reset the numbers each chapter
% exc is the short name we give to this new list
\newlistof[chapter]{exercise}{exc}{\listexercisename}
\usepackage{changepage} % used to adjust the margins within the environment
% environment name, with optional argument for display in the list of
% exercises
\newenvironment{exercise}[1][]
{% begin code
%
% this indents our text from the left and right
\begin{adjustwidth}{1.0cm}{1.0cm}
%
% this skips a line before
\par\vspace{\baselineskip}\noindent
%
% this increments our counter
\refstepcounter{exercise}%
%
% this displays the exercise number and starts italics
\textbf{Exercise \theexercise:}\ \begin{itshape}%
%
% this adds an entry to our custom List of Exercises
\addcontentsline{exc}{exercise}{\protect\numberline{\theexercise} #1}
}%
{% end code -- this is done at the end of the environment
%
% stop the italics
\end{itshape}%
%
% this stops our custom margins
\end{adjustwidth}%
%
% this skips a line at the end
\vspace{\baselineskip}\ignorespacesafterend
}
% this makes the List of Exercises have a line break before each chapter,
% just like in the main ToC.
%
% this has a bug -- it does not omit the space if the chapter has 0 exercises
\usepackage{etoolbox}
\preto\section{%
\ifnum\value{chapter}=1{}\else % don't skip before Ch 1
\ifnum\value{section}=0\addtocontents{exc}{\vskip10pt}\fi
\fi
}
% indent these the standard amount for a chaptered section
\setlength{\cftexerciseindent}{1.5em}
%-----------------------------------------------------------------------------
% license
\usepackage{ccicons}
% computer keyboard symbol
\usepackage{marvosym}
\newcommand{\evm}{{(-)}}
\newcommand{\evz}{{(\circ)}}
\newcommand{\evp}{{(+)}}
\newcommand{\enu}{{(\nu)}}
% shortcuts
\newcommand{\Dux}{\overline{\Delta u}^{(x)}}
\newcommand{\Duy}{\overline{\Delta u}^{(y)}}
\newcommand{\Dvx}{\overline{\Delta v}^{(x)}}
\newcommand{\Dvy}{\overline{\Delta v}^{(y)}}
% for dotted lines in the matrics/arrays
\usepackage{arydshln}
% fonts for TOC, list of figures, etc
\renewcommand*\listfigurename{\bf\textsf{List of Figures}}
\renewcommand*\listexercisename{\bf\textsf{List of Exercises}}
\renewcommand*\contentsname{\bf\textsf{Table of Contents}}
% short table of contents
\usepackage{shorttoc}
% pack more figures on a page
\usepackage{float}
\renewcommand\floatpagefraction{.9}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.9}
\renewcommand\textfraction{.1}
\newcommand{\hydroex}{{\sf hydro\_examples}}
\newcommand{\hydroexdoit}[1]{{\color{red} \LARGE \Keyboard}\/ \hydroex: {\tt #1}}
\usepackage{multirow}
% MarginPars
\setlength{\marginparwidth}{0.75in}
\newcommand{\MarginPar}[1]{\marginpar{\vskip-\baselineskip\raggedright\tiny\sffamily\hrule\smallskip{\color{red}#1}\par\smallskip\hrule}}
\begin{document}
\frontmatter
\begin{titlepage}
\ \\[2.5in]
\begin{center}
\HRule\\[0.5em]
{\Huge \textsf{{
Lecture Notes on\\[0.1em]
Computational Hydrodynamics\\[0.3em]
for Astrophysics}}
}
\HRule
\\[2em]
{\Large \sf Michael Zingale} \\ {\sf Stony Brook University}
\end{center}
\vfill
\begin{flushright}
\today
\end{flushright}
\end{titlepage}
\pagestyle{plain}
\null \vfill
\noindent \ccCopy\ 2013, 2014 Michael Zingale \\
\noindent document git version: \input git_info.tex
\noindent the source for these notes are available online (via \git):
\url{https://github.com/zingale/numerical_exercises}
\noindent \ccbyncsa \\
\noindent This work is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA
4.0) license.
\clearpage
\shorttoc{Chapter Listing}{0}
\clearpage
\setcounter{tocdepth}{2}
\tableofcontents
\clearpage
\listoffigures
\addcontentsline{toc}{chapter}{list of figures}
\clearpage
\listofexercise
\addcontentsline{toc}{chapter}{list of exercises}
\clearpage
\chapter*{preface}
\chaptermark{preface}
\addcontentsline{toc}{chapter}{preface}
\input preface/preface.tex
\clearpage
\pagestyle{headings}
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername
\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection---#1}}
\mainmatter
%\part{Basics}
\chapter{Simulation Overview}
\input intro/intro.tex
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Finite-Volume Grids}
\input finite-volume/finite-volume.tex
%\part{Hyperbolic Problems}
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Advection}
\input advection/advection.tex
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Burgers' Equation}
\input burgers/burgers.tex
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Euler Equations}
\input Euler/Euler.tex
%\part{Elliptic, Parabolic Problems, and Mixed-Type Problems}
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Multigrid and Elliptic Equations}
\input multigrid/multigrid.tex
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Diffusion}
\input diffusion/diffusion.tex
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Multiphysics Applications}
\input multiphysics/multiphysics.tex
%\part{Low Speed Hydrodynamics}
%\addtocontents{exc}{\protect\addvspace{10pt}}%
\chapter{Incompressible Flow and Projection Methods}
\input incompressible/incompressible.tex
\chapter{Low Mach Number Methods}
\input low_mach/low_mach.tex
%\part{Appendices}
\appendix
\chapter{Using \hydroex}
\input hydro_examples/hydro_examples.tex
\chapter{Using \pyro}
\input pyro/pyro.tex
%% \chapter{Software Engineering Practices}
%% \input software-engineering/software-engineering.tex
\backmatter
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{plain}
\bibliography{refs}
\end{document}