[Commits] [svn:einsteintoolkit] Workshop_Summer_2013/et_intro_details/ (Rev. 15)
rhaas at tapir.caltech.edu
rhaas at tapir.caltech.edu
Fri Jul 26 08:04:44 CDT 2013
User: rhaas
Date: 2013/07/26 08:04 AM
Modified:
/et_intro_details/
et_intro_details.tex
Log:
add wavetoy example
File Changes:
Directory: /et_intro_details/
=============================
File [modified]: et_intro_details.tex
Delta lines: +684 -7
===================================================================
--- et_intro_details/et_intro_details.tex 2013-07-26 13:04:35 UTC (rev 14)
+++ et_intro_details/et_intro_details.tex 2013-07-26 13:04:44 UTC (rev 15)
@@ -153,7 +153,9 @@
\begin{itemize}
\item $\sim 100$ thorns used for simulation
-\item Thorns come from a variety of sources: \texttt{git}, \texttt{svn}, \texttt{cvs}, \texttt{darcs}, \ldots
+\item Thorns come from a variety of sources: core Cactus thorns, ET thorns,
+ AEIthorns, LSUThorn, Carpet, github.com, bitbucket.org
+\item Thorns come in a variety of formats: \texttt{git}, \texttt{svn}, \texttt{cvs}, \texttt{darcs}, \ldots
\item Multiple access levels: publicly available, password required
\item Multiple thorns per repository? Separate documentation? Example files?
\item Specific code version, release date
@@ -175,15 +177,16 @@
\end{frame}
\begin{frame}[containsverbatim] \frametitle{GetComponents -- how?}
-\scriptsize\begin{alltt}
-!CRL_VERSION = 1.0
+\scriptsize%
+\begin{alltt}
+!CRL\_VERSION = 1.0
!DEFINE ROOT = Cactus
!DEFINE ARR = $ROOT/arrangements
!TARGET = $ROOT
!TYPE = svn
-!AUTH_URL = https://svn.cactuscode.org/flesh/trunk
+!AUTH\_URL = https://svn.cactuscode.org/flesh/trunk
!CHECKOUT = Cactus
!NAME = .
@@ -201,20 +204,694 @@
The Simulation Factory:
\begin{columns}
\column{0.25\textwidth}
- \includegraphics[width=\textwidth]{pics/factory.png}
+ \includegraphics[width=\textwidth]{factory.png}
\column{0.75\textwidth}
\begin{itemize}
\item Command-line tools for setting up Cactus distribution
and managing simulations on a variety of supercomputers,
- including most of the TeraGrid machines.
+ including most of the \texttt{XSEDE} machines.
\end{itemize}
\end{columns}
\begin{itemize}
\item Captures the best practices of experienced users, ensuring
repeatable and well-documented scientific results.
\item Developed by Erik Schnetter and Michael Thomas.
- \item Included in Cactus-OS distro: {\tt Cactus/simfactory}.
+ \item Included in virtual machine: {\tt Cactus/simfactory}.
\item For more, see: {\tt http://simfactory.org}
\end{itemize}
+ More on \texttt{Simfactory} in the hands-on session.
\end{frame}
+
+\begin{frame} \frametitle{Example: solving scalar wave equation}
+ For a given source function $S(x,y,t)$ find a scalar wave
+ field $\varphi(x,y,t)$ inside the domain $\mathcal{D}$
+ with a boundary condition:
+ \begin{columns}[t]
+ \column{.3\textwidth}
+ \begin{figure}[!htp]
+ \begin{center}
+ \begin{tikzpicture}[rotate=5,scale=1.2]
+ \filldraw[fill=green!60!white, draw=green!50!black, thick]
+ (-1,-1) rectangle (1,1);
+ \draw (0,0) node {{\large $\mathcal{D}$}};
+ \draw (1.4,0.2) node {$\partial\mathcal{D}$};
+ \draw[->,thick,color=red] (1.1,0.2) -- (1,0.2);
+ \end{tikzpicture}
+ \end{center}
+ \end{figure}
+
+ \column{.6\textwidth}
+ \begin{itemize}
+ \item inside $\mathcal{D}$:
+ \begin{equation*}
+ \frac{\partial^2\varphi}{\partial t^2} = c^2\Delta\varphi + S
+ \end{equation*}
+ \item on the boundary $\partial\mathcal{D}$:
+ \begin{equation*}
+ \varphi_{|\partial\mathcal{D}} = 0
+ \end{equation*}
+ \end{itemize}
+ \end{columns}
+\end{frame}
+
+\frame{ \frametitle{WaveToy Thorn: Discretization}
+ Discretization: \\
+ approximating continuous function $\varphi(x,y,t)$
+ with a grid function $\varphi^{(n)}_{i,j}$:
+ \begin{columns}[t]
+ \column{.2\textwidth}
+ \begin{figure}[!htp]
+ \begin{center}
+ \begin{tikzpicture}[scale=1.1]
+ \draw (-1,0) -- (1,0);
+ \draw (-1,1) -- (1,1);
+ \draw (-1,-1) -- (1,-1);
+ \scope[fill=green!50!blue, draw=black]
+ \filldraw (0,0) circle (0.07cm);
+ \filldraw (1,0) circle (0.07cm);
+ \filldraw (-1,0) circle (0.07cm);
+ \filldraw (0,1) circle (0.07cm);
+ \filldraw (1,1) circle (0.07cm);
+ \filldraw (-1,1) circle (0.07cm);
+ \filldraw (0,-1) circle (0.07cm);
+ \filldraw (1,-1) circle (0.07cm);
+ \filldraw (-1,-1) circle (0.07cm);
+ \endscope
+ \scope[xshift=0.45cm,yshift=0.25cm]
+ \draw (0,0) node {{\tiny $\varphi^{(n)}_{i}$}};
+ \draw (1,0) node {{\tiny $\varphi^{(n)}_{i+1}$}};
+ \draw (-1,0) node {{\tiny $\varphi^{(n)}_{i}$}};
+ \draw (0,1) node {{\tiny $\varphi^{(n+1)}_{i}$}};
+ \draw (1,1) node {{\tiny $\varphi^{(n+1)}_{i+1}$}};
+ \draw (-1,1) node {{\tiny $\varphi^{(n+1)}_{i}$}};
+ \draw (0,-1) node {{\tiny $\varphi^{(n+1)}_{i}$}};
+ \draw (1,-1) node {{\tiny $\varphi^{(n+1)}_{i+1}$}};
+ \draw (-1,-1) node {{\tiny $\varphi^{(n+1)}_{i}$}};
+ \endscope
+ \end{tikzpicture}
+ \end{center}
+ \end{figure}
+
+ \column{.8\textwidth}
+ \begin{gather*}
+ \\
+ \frac{\partial^2\varphi}{\partial t^2} =
+ c^2 (\partial_x^2\varphi + \partial_y^2\varphi)
+ + S \\
+ \Downarrow (c\equiv1)\\
+ \begin{aligned}
+ %\text{\makebox[0pt][l]{\framebox{\parbox{4cm}{Semi-descretization for Method of Lines}}}}
+ \frac{\partial \phi_{i,j}}{\partial t} = & \psi_{i,j} \\
+ \frac{\partial \psi_{i,j}}{\partial t} = &
+ \frac{\varphi_{i+1,j} - 2\varphi_{i,j}+\varphi_{i-1,j}}
+ {2\Delta x^2} + \\
+ & \frac{\varphi_{i,j+1} - 2\varphi_{i,j}+\varphi_{i,j-1}}
+ {2\Delta y^2} + S_{i,j}
+ \end{aligned}
+ \end{gather*}
+ \end{columns}
+}
+
+\frame{ \frametitle{WaveToyMoL Thorn}
+ Thorn structure:
+
+ \begin{columns}[t]
+ \column{.4\textwidth}
+ \begin{exampleblock}{interface.ccl}
+ \begin{itemize}
+ \item grid function {\color{blue}phi[3]}:
+ \end{itemize}
+ \begin{figure}[!htp]
+ \begin{center}
+ \begin{tikzpicture}
+ \scope[fill=white!90!green, draw=black]
+ \filldraw (-1.5,-1) -- (0.5,-1) -- (1.5,-0.2) -- (-0.5,-0.2) -- cycle;
+ \filldraw (-1.5,-0.4) -- (0.5,-0.4) -- (1.5,0.4) -- (-0.5,0.4) -- cycle;
+ \filldraw (-1.5,0.2) -- (0.5,0.2) -- (1.5,1) -- (-0.5,1) -- cycle;
+ \endscope
+ \scope[fill=green!50!blue, draw=black, dashed, very thin]
+ \draw (-0.6,0) -- (0.6,0);
+ \draw (0,-0.6) -- (0,0.6);
+ \draw (-0.35,-0.3) -- (0.35,0.3);
+ \filldraw (0,0) circle (0.07cm);
+ \filldraw (0.6,0) circle (0.07cm);
+ \filldraw (0,0.6) circle (0.07cm);
+ \filldraw (-0.6,0) circle (0.07cm);
+ \filldraw (0,-0.6) circle (0.07cm);
+ \filldraw (-0.35,-0.3) circle (0.07cm);
+ \filldraw (0.35,0.3) circle (0.07cm);
+ \endscope
+ \scope[left=2pt,yshift=0.2cm]
+ \draw (-1.5,-1) node {\color{blue}phi\_p\_p};
+ \draw (-1.5,-0.4) node {\color{blue}phi\_p};
+ \draw (-1.5, 0.2) node {\color{blue}phi};
+ \endscope
+ \scope[xshift=0.6cm,yshift=0.2cm]
+ \draw (-1.5,-1) node {{\tiny $\varphi^{(n-2)}$}};
+ \draw (-1.5,-0.4) node {{\tiny $\varphi^{(n-1)}$}};
+ \draw (-1.5, 0.2) node {{\tiny $\varphi^{(n)}$}};
+ \endscope
+ %\includegraphics[height=0.3\textheight]{time_levels}
+ \end{tikzpicture}
+ \end{center}
+ \end{figure}
+ \begin{itemize}
+ \item {\small Boundary\_SelectVarForBC}
+ \end{itemize}
+ \end{exampleblock}
+
+ \column{.4\textwidth}
+ \begin{exampleblock}{param.ccl}
+ \begin{itemize}
+ \item Parameters of initial Gaussian pulse:
+ amplitude {\color{brown}$A$},
+ radius {\color{brown}$R$},
+ width {\color{brown}$\sigma$}
+ \end{itemize}
+ \end{exampleblock}
+
+ \begin{exampleblock}{schedule.ccl}
+ \begin{itemize}
+ \item WaveToy\_InitialData
+ \item WaveToy\_Evolution
+ \item WaveToy\_Boundaries
+ \end{itemize}
+ \end{exampleblock}
+ \end{columns}
+}
+
+% \frame{ \frametitle{WaveToy Thorn}
+% \begin{itemize}
+% \item Choose initial values $\Phi_{i,j,k,0}$;
+% \item Loop:
+% \begin{itemize}
+% \item Calculate field at current time based on discretized wave equation
+% \item On boundary points, where derivatives may not be present, apply chosen
+% boundary conditions
+% \end{itemize}
+% \end{itemize}
+% }
+
+\frame{ \frametitle{WaveToy Thorn: Algorithm Illustration}
+ \begin{columns}[t]
+ \column{.7\textwidth}
+ \begin{figure}[!htp]
+ \begin{center}
+ \begin{tikzpicture}
+
+ %\draw[->] (0,0) -- (1,1);
+ % Step 1: axes and grid
+ \draw[->,very thin] (-.6,-.4) -- (6,-.4);
+ \draw[->,very thin] (-.4,-.6) -- (-.4,3);
+ \draw[left=2pt] (-.4,2.5) node {$t$};
+ \draw[above=2pt] (5.8,-0.4) node {$x$};
+
+ \uncover<1>{
+ \draw[xstep=.6cm,ystep=.4cm,gray,dashed]
+ (0,0) grid(5.4cm,2.6cm);
+ }%
+
+ % Step 2: splitting between two processors
+ \uncover<2->{
+ \draw (0,2.8) -- (.6,3.2) -- (2.4,3.2) -- (3,2.8);
+ \draw[above=1pt] (1.4,3.2) node {\emph{PROC0}};
+
+ \draw[xshift=2.4cm] (0,2.8) -- (.6,3.2) -- (2.4,3.2) -- (3,2.8);
+ \draw[above=1pt] (3.8,3.2) node {\emph{PROC1}};
+ }%
+ \uncover<2-4>{
+ \draw[xstep=.6cm,ystep=.4cm,gray,dashed]
+ (0,0) grid (3.0cm,2.6cm);
+ \draw[xstep=.6cm,ystep=.4cm,gray,dashed,xshift=0.05cm,yshift=0.05cm]
+ (2.4,0) grid (5.4cm,2.6cm);
+ }%
+
+ % Step 3: memory "allocations"
+ \uncover<3>{
+ \draw[color=blue] (1.5,-0.6) node {\tiny x, phi, phi\_p, phi\_p\_p};
+ \draw[color=blue] (4.2,-0.6) node {\tiny x, phi, phi\_p, phi\_p\_p};
+ }%
+
+ % Step 4: CoordBase / CartGrid3D
+ \uncover<4->{
+ \foreach \x in {0.0,0.6,1.2,1.8,2.4,3.0,3.6,4.2,4.8,5.4}
+ \draw (\x cm,-0.4cm) node[anchor=south] {{\tiny $\x$}};
+ \draw[very thick,color=brown,xstep=0.6cm,ystep=1cm,yshift=-0.4cm]
+ (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[color=blue] (1.5,-0.6) node {\small x};
+
+ \draw[very thick,color=brown,xstep=0.6cm,ystep=1cm,xshift=2.45cm,yshift=-0.35cm]
+ (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[color=blue] (4.2,-0.6) node {\small x};
+ }
+ \uncover<4-5>{
+ \draw[color=blue] (1.5,-1.0) node {\tiny phi, phi\_p, phi\_p\_p};
+ \draw[color=blue] (4.2,-1.0) node {\tiny phi, phi\_p, phi\_p\_p};
+ }%
+
+ % Step 5: Time
+ \uncover<5->{
+ \draw[xstep=.6cm,ystep=.4cm,gray,dashed]
+ (0,0) grid (3.0cm,2.6cm);
+ \draw[xstep=.6cm,ystep=.4cm,gray,dashed,xshift=0.05cm,yshift=0.05cm]
+ (2.4,0) grid (5.4cm,2.6cm);
+ }%
+ \uncover<5>{
+ \scope[color=red,thick,fill=white]
+ \draw (-0.5,0.4) -- (0.0,0.4);
+ \draw (-0.5,0.8) -- (0.0,0.8);
+ \draw[->] (-0.1,1.2) -- (-0.1,0.8);
+ \draw[<-] (-0.1,0.4) -- (-0.1,0.0);
+ \endscope
+ \draw (0,0.6) node[anchor=west,fill=white] {$\Delta t = \lambda\Delta x_{\min}$};
+ }
+
+ % Step 6: Initial data routines
+ \uncover<6>{
+ \scope[very thick,color=green,xstep=0.6cm,ystep=1cm]
+ \draw[xshift=0cm,yshift=0cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.05cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=0.4cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.45cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=0.8cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.85cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);
+ \endscope
+ \scope[color=blue]
+ \draw (-0.5,0.4) node[anchor=east] {\small phi\_p};
+ \draw (-0.5,0.8) node[anchor=east] {\small phi};
+ \draw (-0.5,0.0) node[anchor=east] {\small phi\_p\_p};
+ \endscope
+ }
+
+ % Step 7: Layers rotation
+ \uncover<7->{
+ \scope[very thick,color=green,xstep=0.6cm,ystep=1cm]
+ \draw[xshift=0cm,yshift=0cm,color=gray] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.05cm,color=gray] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=0.4cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.45cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=0.8cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.85cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=1.2cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=1.25cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);
+ \endscope
+ }%
+ \uncover<7>{
+ %\draw[thick,color=red,->] (-0.5,-0.1) arc (-25:25:1.1cm);
+ \draw[thick,color=red,->] (-1.8, 0.0) arc (205:155:1.5cm);
+ }
+ \uncover<7-11>{
+ \scope[color=blue]
+ \draw (-0.5,0.4) node[anchor=east] {\small phi\_p\_p};
+ \draw (-0.5,0.8) node[anchor=east] {\small phi\_p};
+ \draw (-0.5,1.2) node[anchor=east] {\small phi};
+ \endscope
+ }
+
+ % Step 8: Evaluation of RHS
+ \uncover<8>{
+ \scope[draw=red,thick,fill=green]
+ \draw (0.0,0.8) -- (1.2,0.8);
+ \draw[->] (0.6,0.8) -- (0.6,1.1);
+ \filldraw (0.6,1.2) circle (0.1cm);
+ \filldraw (0.6,0.4) circle (0.1cm);
+ \filldraw (0.0,0.8) circle (0.1cm);
+ \filldraw (0.6,0.8) circle (0.1cm);
+ \filldraw (1.2,0.8) circle (0.1cm);
+
+ % second processor:
+ \scope[xshift=0.05cm,yshift=0.05cm]
+ \fill (3.0,0.8) circle (0.05cm);
+ \fill (3.6,0.8) circle (0.05cm);
+ \scope[xshift=3.6cm]
+ \draw (0.0,0.8) -- (1.2,0.8);
+ \draw[->] (0.6,0.8) -- (0.6,1.1);
+ \filldraw (0.6,1.2) circle (0.1cm);
+ \filldraw (0.6,0.4) circle (0.1cm);
+ \filldraw (0.0,0.8) circle (0.1cm);
+ \filldraw (0.6,0.8) circle (0.1cm);
+ \filldraw (1.2,0.8) circle (0.1cm);
+ \endscope
+ \endscope
+ \endscope
+ }%
+
+ % Step 9: Ghost zones
+ \uncover<9>{
+ \scope[very thick,color=green,xstep=0.6cm,ystep=1cm]
+ \draw[xshift=0.6cm,yshift=1.2cm] (0cm,-1pt) grid (1.8cm,1pt);
+ \draw[xshift=3.05cm,yshift=1.25cm] (0cm,-1pt) grid (1.8cm,1pt);
+ \draw[->,color=red] (2.4,1.1) -- (2.4,1.3);
+ \draw[->,color=red] (3.05,1.3) -- (3.05,1.1);
+ \endscope
+ }%
+
+ % Step 10: Boundary conditions
+ \uncover<10>{
+ \scope[very thick,color=green,xstep=0.6cm,ystep=1cm]
+ \draw[xshift=0.6cm,yshift=1.2cm] (0cm,-1pt) grid (2.4cm,1pt);
+ \draw[xshift=2.45cm,yshift=1.25cm] (0cm,-1pt) grid (2.4cm,1pt);
+ \draw[->,color=red] (-0.4,1.2) -- (0.0,1.2);
+ \draw[->,color=red] (5.85,1.25) -- (5.45,1.25);
+ \endscope
+ }%
+
+ % Step 11: Output data
+ \uncover<11->{
+ \scope[very thick,color=green,xstep=0.6cm,ystep=1cm]
+ \draw[xshift=0cm,yshift=1.2cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=1.25cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \endscope
+ }
+
+ % Step 12: Advance to the next time level
+ \uncover<12>{
+ \draw[thick,color=red,->] (-1.8, 0.4) arc (205:155:1.5cm);
+ \scope[very thick,color=green,xstep=0.6cm,ystep=1.4cm]
+ \draw[xshift=0cm,yshift=1.6cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=1.65cm,color=black] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=1.2cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=1.25cm] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=0cm,yshift=0.4cm,color=gray] (0cm,-1pt) grid (3.0cm,1pt);
+ \draw[xshift=2.45cm,yshift=0.45cm,color=gray] (0cm,-1pt) grid (3.0cm,1pt);
+ \endscope
+ \scope[color=blue]
+ \draw (-0.5,0.8) node[anchor=east] {\small phi\_p\_p};
+ \draw (-0.5,1.2) node[anchor=east] {\small phi\_p};
+ \draw (-0.5,1.6) node[anchor=east] {\small phi};
+ \endscope
+ }
+
+ \end{tikzpicture}
+ \end{center}
+ \end{figure}
+
+
+ \column{.3\textwidth}
+ \begin{figure}[!htp]
+ \begin{center}
+ \vspace{-1cm}
+ \begin{tikzpicture}
+ \draw (0,7) node
+ [anchor=north,right,text width=3cm,rounded corners,fill=green!20,draw=blue!50!black] %,inner sep=1ex]
+ (begin)
+ {\begin{footnotesize}
+ \begin{itemize}
+ \item[] \hspace{-0.5cm} {\color<2>{blue}Grid structure}
+ \item[] \hspace{-0.5cm} {\color<3>{blue}GF allocation}
+ \end{itemize}
+ \end{footnotesize}};
+
+ \draw (0,5.3) node
+ [anchor=north,right,text width=3cm,rounded corners,fill=green!20,draw=blue!50!black] %,inner sep=1ex]
+ (init)
+ {\begin{footnotesize}
+ \begin{itemize}
+ \item[] \hspace{-0.5cm} {\color<4>{blue}Set up coords}
+ \item[] \hspace{-0.5cm} {\color<5>{blue}Compute $\Delta t$}
+ \item[] \hspace{-0.5cm} {\color<6>{blue}Initial data}
+ \end{itemize}
+ \end{footnotesize} };
+
+ \draw[->,thick,draw=blue!50!black] (0,2.15) -- (-0.3,2.15) -- (-0.3,3.8) -- (-0.05,3.8);
+
+ \draw (0,3) node
+ [anchor=north,right,text width=3cm,rounded corners,fill=green!20,draw=blue!50!black] %,inner sep=1ex]
+ (evol)
+ {\begin{footnotesize}
+ \begin{itemize}
+ \item[]\hspace{-0.5cm} {\color<7,12>{blue}Rotate timelevels}
+ \item[]\hspace{-0.5cm} {\color<8>{blue}Evolve GF}, {\color<9>{blue}sync}
+ \item[]\hspace{-0.5cm} {\color<10>{blue}Apply BCs}
+ \item[]\hspace{-0.5cm} {\color<11>{blue}Output data}
+ \end{itemize}
+ \end{footnotesize} };
+
+ \scope[color=blue!50!black,thick]
+ \draw[->,shorten >=2pt] (begin.south) -- (init.north);
+ \draw[->,shorten >=2pt] (init.south) -- (evol.north);
+ \endscope
+ \end{tikzpicture}
+ \end{center}
+ \end{figure}
+ \end{columns}
+}
+
+%\frame[containsverbatim]{ \frametitle{WaveToy Thorn}
+% Implemented in \verb|CactusWave/WaveToy|:
+% \begin{itemize}
+% \item \href{http://www.cct.lsu.edu/~bentivegna/WaveToy/interface.ccl}{interface.ccl}
+% \item \href{http://www.cct.lsu.edu/~bentivegna/WaveToy/schedule.ccl}{schedule.ccl}
+% \item \href{http://www.cct.lsu.edu/~bentivegna/WaveToy/param.ccl}{param.ccl}
+% \item \href{http://www.cct.lsu.edu/~bentivegna/WaveToy/src}{src/ directory}
+% \end{itemize}
+%}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn}
+ Directory structure:
+ \begin{alltt}
+WaveToy/
+|-- COPYRIGHT
+|-- README
+|-- configuration.ccl
+|-- doc
+| `-- documentation.tex
+|-- interface.ccl
+|-- schedule.ccl
+|-- param.ccl
+`-- src
+ |-- WaveToy.c
+ `-- make.code.defn
+\end{alltt}
+}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn}
+ Directory structure:
+ \begin{alltt}
+WaveToy/
+|-- COPYRIGHT
+|-- README
+|-- configuration.ccl
+|-- doc
+| `-- documentation.tex
+\textcolor{blue}{|-- interface.ccl
+|-- schedule.ccl
+|-- param.ccl}
+`-- src
+ |-- WaveToy.c
+ `-- make.code.defn
+\end{alltt}
+}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn}
+ \begin{itemize}
+ \item \verb|interface.ccl|:
+ \tiny\begin{verbatim}
+ IMPLEMENTS: wavetoy_simple
+ INHERITS: grid
+
+ PUBLIC:
+
+ CCTK_REAL scalarevolve TYPE=gf TIMELEVELS=3
+ {
+ phi
+ } "The evolved scalar field"
+
+ CCTK_INT FUNCTION Boundary_SelectVarForBC( \
+ CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, \
+ CCTK_INT IN boundary_width, CCTK_INT IN table_handle, \
+ CCTK_STRING IN var_name, CCTK_STRING IN bc_name)
+
+ REQUIRES FUNCTION Boundary_SelectVarForBC\end{verbatim}
+ \end{itemize}
+}
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn cont.}
+ \begin{itemize}
+ \item \verb|schedule.ccl|:
+ \tiny\begin{verbatim}
+ STORAGE: scalarevolve[3]
+
+ SCHEDULE WaveToy_InitialData AT CCTK_INITIAL
+ {
+ LANG: C
+ } "Initial data for 3D wave equation"
+
+ SCHEDULE WaveToy_Evolution AT CCTK_EVOL
+ {
+ LANG: C
+ SYNC: scalarevolve
+ } "Evolution of 3D wave equation"
+
+ SCHEDULE WaveToy_Boundaries AT CCTK_EVOL AFTER WaveToy_Evolution
+ {
+ LANG: C
+ } "Select boundary conditions for the evolved scalar"
+
+ SCHEDULE GROUP ApplyBCs as WaveToy_ApplyBCs AT CCTK_EVOL AFTER WaveToy_Boundaries
+ {
+ } "Apply boundary conditions"\end{verbatim}
+ \end{itemize}
+}
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn cont.}
+ \begin{itemize}
+ \item \verb|param.ccl|:
+ \tiny\begin{verbatim}
+ CCTK_REAL amplitude "The amplitude of the waves"
+ {
+ *:* :: "Anything"
+ } 1.0
+
+ CCTK_REAL radius "The radius of the gaussian wave"
+ {
+ 0:* :: "Positive"
+ } 0.0
+
+ CCTK_REAL sigma "The sigma for the gaussian wave"
+ {
+ 0:* :: "Positive"
+ } 0.1\end{verbatim}
+ \end{itemize}
+}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn cont.}
+ Directory structure:
+ \begin{alltt}
+WaveToy/
+|-- COPYRIGHT
+|-- README
+|-- configuration.ccl
+|-- doc
+| `-- documentation.tex
+|-- interface.ccl
+|-- schedule.ccl
+|-- param.ccl
+`-- src
+\textcolor{blue}{ |-- WaveToy.c
+ `-- make.code.defn}
+\end{alltt}
+}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn cont.}
+ \begin{itemize}
+ \item \verb|WaveToy.c|:
+ \tiny\begin{alltt}
+void WaveToy\_Evolution(\textcolor{BurntOrange}{CCTK\_ARGUMENTS}) \{
+ \textcolor{BurntOrange}{DECLARE\_CCTK\_ARGUMENTS;}
+
+ CCTK\_REAL dt2,dx2i,dy2i,dz2i;
+
+ dt2 = CCTK\_DELTA\_TIME*CCTK\_DELTA\_SPACE(2);
+ dx2i = 1.0/(CCTK\_DELTA\_SPACE(0)*CCTK\_DELTA\_SPACE(0));
+ dy2i = 1.0/(CCTK\_DELTA\_SPACE(1)*CCTK\_DELTA\_SPACE(1));
+ dz2i = 1.0/(CCTK\_DELTA\_SPACE(2)*CCTK\_DELTA\_SPACE(2));
+
+ /* Do the evolution */
+ \textcolor{Green}{for (int k=1; k<cctk\_lsh[2]-1; k++) \{
+ for (int j=1; j<cctk\_lsh[1]-1; j++) \{
+ for (int i=1; i<cctk\_lsh[0]-1; i++) \{}
+ \textcolor{blue}{phi[CCTK\_GFINDEX3D(cctkGH,i,j,k)] = 2*(1 - (dt2)*(dx2i + dy2i + dz2i)) *
+ phi\_p[CCTK\_GFINDEX3D(cctkGH,i,j,k)] - phi\_p\_p[CCTK\_GFINDEX3D(cctkGH,i,j,k)]
+ + (dt2) *
+ ( ( phi\_p[CCTK\_GFINDEX3D(cctkGH,i+1,j ,k )]
+ +phi\_p[CCTK\_GFINDEX3D(cctkGH,i-1,j ,k )] )*dx2i
+ +( phi\_p[CCTK\_GFINDEX3D(cctkGH,i ,j+1,k )]
+ +phi\_p[CCTK\_GFINDEX3D(cctkGH,i ,j-1,k )] )*dy2i
+ +( phi\_p[CCTK\_GFINDEX3D(cctkGH,i ,j ,k+1)]
+ +phi\_p[CCTK\_GFINDEX3D(cctkGH,i ,j, k-1)] )*dz2i);}
+ \textcolor{Green}{\}
+ \}
+ \}}
+\}
+\end{alltt}
+ \end{itemize}
+}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn cont.}
+ \begin{itemize}
+ \item \verb|WaveToy.c cont.|:
+ \tiny\begin{alltt}
+void WaveToy\_InitialData(\textcolor{BurntOrange}{CCTK\_ARGUMENTS}) \{
+ \textcolor{BurntOrange}{DECLARE\_CCTK\_ARGUMENTS;
+ DECLARE\_CCTK\_PARAMETERS;}
+
+ \textcolor{Green}{for(int k=0; k<cctk\_lsh[2]; k++) \{
+ for(int j=0; j<cctk\_lsh[1]; j++) \{
+ for(int i=0; i<cctk\_lsh[0]; i++) \{}
+ int vindex = CCTK\_GFINDEX3D(cctkGH,i,j,k);
+ CCTK\_REAL dt = CCTK\_DELTA\_TIME;
+ CCTK\_REAL X = x[vindex];
+ CCTK\_REAL Y = y[vindex];
+ CCTK\_REAL Z = z[vindex];
+ CCTK\_REAL R = sqrt(X*X + Y*Y + Z*Z);
+
+ \textcolor{blue}{phi[vindex] = amplitude*exp( - SQ( (R - radius) / sigma ) );}
+
+ if (R == 0.0) \{
+ phi\_p[vindex] = amplitude*(1.0 - 2.0*dt*dt/sigma)*exp(-dt*dt/sigma);
+ \} else \{
+ phi\_p[vindex] = amplitude/2.0*(R-dt)/R*
+ exp( - SQ( (R - radius - dt)/ sigma ) )
+ + amplitude/2.0*(R+dt)/R*
+ exp( - SQ( (R - radius + dt)/ sigma ) );
+ \textcolor{Green}{\}
+ \}
+ \}}
+ \}
+\}
+\end{alltt}
+ \end{itemize}
+}
+
+\frame[containsverbatim]{ \frametitle{WaveToy Thorn cont.}
+ \begin{itemize}
+ \item \verb|WaveToy.c|:
+ \tiny\begin{alltt}
+void WaveToy\_Boundaries(\textcolor{BurntOrange}{CCTK\_ARGUMENTS}) \{
+ \textcolor{BurntOrange}{DECLARE\_CCTK\_ARGUMENTS;}
+
+ /* Uses all default arguments, so invalid table handle -1 can be passed */
+ if (\textcolor{blue}{Boundary\_SelectVarForBC (cctkGH, CCTK\_ALL\_FACES, 1, -1,
+ "wavetoy\_simple::phi", "scalar")} < 0) \{
+ CCTK\_WARN (0, "WaveToy\_Boundaries: Error selecting boundary condition");
+ \}
+\}
+\end{alltt}
+ \item \verb|make.config.defn|:
+ \tiny\begin{verbatim}
+SRCS = WaveToy.c
+\end{verbatim}
+ \end{itemize}
+}
+
+
+\frame[containsverbatim]{ \frametitle{Parameter file}
+ \begin{itemize}
+ \item Example parameter file:
+ \tiny\begin{verbatim}
+Cactus::cctk_run_title = "Simple WaveToy"
+
+ActiveThorns = "Time Boundary Carpet CarpetLib CartGrid3D CoordBase IOUtil
+ CarpetIOBasic CarpetIOASCII CarpetIOHDF5 SymBase WaveToy"
+
+Cactus::cctk_itlast = 10000
+Time::dtfac = 0.5
+
+IO::out_dir = $parfile
+IOBasic::outInfo_every = 1
+IOASCII::out1D_every = 10
+IOASCII::out1D_vars = "wavetoy_simple::phi"
+
+IOHdf5::out_every = 100
+IOHdf5::out_vars = "wavetoy_simple::phi"
+\end{verbatim}
+ \end{itemize}
+}
+
+\frame{\frametitle{Exercise: compute wave energy}
+\begin{itemize}
+\item compute energy density $\rho_E = \phi^2 \, \mathrm{d}x \, \mathrm{d}y \, \mathrm{d}z$
+\item compute integral as '\texttt{sum}' reduction of \texttt{IOScalar::out\_reductions} during output
+\end{itemize}
+}
+
\end{document}
More information about the Commits
mailing list