% vim: set foldmethod=marker foldmarker=<<<,>>>: \section{Software} %<<< \begin{frame}[t,fragile] \frametitle{{CSBQ library}} \framesubtitle{{}} %<<< \vspace{0.5em} {\bf Code:} ~~ {\color{blue} \url{https://github.com/dmalhotra/CSBQ}} (remember to checkout submodule SCTL) %\vspace{0.5em} %{\bf Documentation:} ~~ {\color{blue} \url{https://csbq.readthedocs.io/}} \vspace{1.5em} {\bf Requirements:} ~~ {\color{red}C++11} ~compiler ~with ~{\color{red}OpenMP} \vspace{1.5em} {\bf Build system:} ~~ none (header only) \vspace{0.5em} {\bf \begin{minted}[ %frame=lines, fontsize=\small, %linenos, gobble=0, mathescape ]{C++} #include \end{minted} } \only<2->{ \vspace{4em} {\bf Optional dependencies:} ~~ BLAS, ~~LAPACK, ~~FFTW, ~~MPI, ~~and ~~PVFMM} %\begin{itemize} %\item includes simple `Makefile' for example codes. %\end{itemize} \end{frame} %>>> \begin{FIframe}{Library overview}{} %<<< \resizebox{0.91\linewidth}{!}{\begin{tikzpicture} \node[anchor=north west, draw=none, rounded corners=.45cm, minimum height=8.3cm, minimum width=13.5cm] at (0.65,2) {}; \only<4->{ \node[anchor=north west, draw=DarkGreen,thick, rounded corners=.45cm, scale=1.7] at (4.7,1.9) {\begin{tabular}{c} \bf Applications \end{tabular}}; \draw [line width=1mm] (0.8,0.20) -- (14.0,0.20); } \only<3->{ \draw [->,line width=0.6mm] (2.7,-1.79) -- (2.7,-3.2); } \only<2->{ \node[anchor=north west, draw=black,thick, rounded corners=.55cm] at (1,-0.2) { \begin{tabular}{c} {\bf CSBQ:} Convergent Slender Body Quadrature\\ \hspace{12cm} \vspace{0.5cm} \end{tabular}}; \node[anchor=north west, draw=blue,thick, rounded corners=.45cm] at (1.25,-1.0) {\begin{tabular}{c} \bf SlenderElemL \end{tabular}}; \node[anchor=north west, draw=blue,thick, rounded corners=.45cm] at (4.50,-1.0) {\begin{tabular}{c} \bf RigidBodyL, Mobility \end{tabular}}; \node[anchor=north west, draw=blue,thick, rounded corners=.45cm] at (9.00,-1.0) {\begin{tabular}{c} \bf CubeVolumeVis, Utils \end{tabular}}; %\node[anchor=north west, draw=blue,thick, rounded corners=.45cm] at (12.20,-1.0) {\begin{tabular}{c} \bf Utils \end{tabular}}; } \node[anchor=north west, draw=black,thick, rounded corners=.55cm] at (1,-2.4) { \begin{tabular}{c} {\bf SCTL:} Scientific Computing Template Library\\ \hspace{12cm} \vspace{2.39cm} \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (1.50,-3.2) {\begin{tabular}{c} \bf BoundaryIntegralOp \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (6.15,-3.2) {\begin{tabular}{c} \bf Kernel \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (8.60,-3.2) {\begin{tabular}{c} \bf FMM \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (10.50,-3.2) {\begin{tabular}{c} \bf Quadrature \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (1.50,-4.2) {\begin{tabular}{c} \bf GMRES \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (3.95,-4.2) {\begin{tabular}{c} \bf SDC \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (5.90,-4.2) {\begin{tabular}{c} \bf Profile \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (8.15,-4.2) {\begin{tabular}{c} \bf Vec (SIMD) \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (11.30,-4.2) {\begin{tabular}{c} \bf Comm \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (1.50,-5.2) {\begin{tabular}{c} \bf Vector \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (3.70,-5.2) {\begin{tabular}{c} \bf Matrix \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (5.90,-5.2) {\begin{tabular}{c} \bf VTUData \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (8.40,-5.2) {\begin{tabular}{c} \bf Interpolation \end{tabular}}; \node[anchor=north west, draw=red,thick, rounded corners=.45cm] at (11.70,-5.2) {\begin{tabular}{c} \bf Tree \end{tabular}}; \end{tikzpicture}} \end{FIframe}%>>> \begin{FIframe}{Solving BIEs with CSBQ}{} %<<< \vspace{-1em} {\bf Step 1: Stokes Dirichlet boundary value problem (exterior)} \vspace{-0.5em} \begin{columns}[t] \column{0.5\textwidth} \begin{itemize} \item Stokes equations: \vspace{-0.5em} \begin{align*} \Delta \mathbf{u} - \nabla p &= 0 \qquad ~\mbox{ in } \mathbb{R}^3 \setminus \overline{\Omega}, \\ \nabla \cdot \mathbf{u} &= 0 \qquad ~\mbox{ in } \mathbb{R}^3 \setminus \overline{\Omega}, \\ \end{align*} \vspace{-2.5em} \item Boundary conditions: \vspace{-0.8em} \begin{align*} \mathbf{u}|_{\Gamma} &= \mathbf{u}_0 \qquad \mbox{ on } \Gamma, \\ \mathbf{u}(\mathbf{x}) &\rightarrow \mathbf{0} \qquad \mbox{ as } |\mathbf{x}| \rightarrow \infty \\ \end{align*} \end{itemize} \column{0.5\textwidth} \centering \vspace{2em} \resizebox{0.75\linewidth}{!}{\begin{tikzpicture} % Draw the irregular domain Omega \draw[fill=blue!20] plot [smooth cycle] coordinates {(1,0) (1.5,1) (2,1.5) (3,1) (3.5,0.5) (2.5,0)}; \node at (2,1) {\(\Omega\)}; % Draw the boundary Gamma \draw[line width=1.5pt] plot [smooth cycle] coordinates {(1,0) (1.5,1) (2,1.5) (3,1) (3.5,0.5) (2.5,0)}; \node at (2.0,-0.3) {\(\Gamma = \partial\Omega \)}; \node at (4.5,1.8) {\( \mathbb{R}^3 \setminus \overline{\Omega} \)}; \end{tikzpicture}} \end{columns} \end{FIframe}%>>> \begin{FIframe}{Solving BIEs with CSBQ}{} %<<< \vspace{-1em} {\bf Step 2: Integral Equation Formulation} \vspace{-0.5em} \begin{columns}[t] \column{0.5\textwidth} \begin{itemize} \item Boundary integral representation: \vspace{-0.5em} \begin{align*} \mathbf{u} = \mathcal{D}[\mathbf{\sigma}] + \eta \, \mathcal{S}[\mathbf{\sigma}] \quad \mbox{ in } \mathbb{R}^3 \setminus \overline{\Omega}, \end{align*} \vspace{-0.8em} \item[] where\\ {\small \qquad $\displaystyle\mathcal{S}[\mathbf{\sigma}](\mathbf{x}) \coloneq \int_{\Gamma} S(\mathbf{x} - \mathbf{y}) \, \mathbf{\sigma}(\mathbf{y}) \, dS_{\mathbf{y}}$, \qquad $\displaystyle\mathcal{D}[\mathbf{\sigma}](\mathbf{x}) \coloneq \int_{\Gamma} D(\mathbf{x} - \mathbf{y}) \, \mathbf{\sigma}(\mathbf{y}) \, dS_{\mathbf{y}}$, \qquad $\displaystyle\eta = 1/(\epsilon \log \epsilon^{-1})$ } \vspace{0.9em} \item Enforce boundary conditions: \vspace{-0.5em} \begin{align*} (I/2 + D + \eta \, S) \mathbf{\sigma} = \mathbf{u}_0 \quad \mbox{ on } \Gamma, \end{align*} \vspace{-1.0em} \item[] Solve for unknown { \color{red} $\sigma$ } \end{itemize} \column{0.5\textwidth} \centering \vspace{2em} \resizebox{0.75\linewidth}{!}{\begin{tikzpicture} % Draw the irregular domain Omega \draw[fill=blue!20] plot [smooth cycle] coordinates {(1,0) (1.5,1) (2,1.5) (3,1) (3.5,0.5) (2.5,0)}; \node at (2,1) {\(\Omega\)}; % Draw the boundary Gamma \draw[line width=1.5pt] plot [smooth cycle] coordinates {(1,0) (1.5,1) (2,1.5) (3,1) (3.5,0.5) (2.5,0)}; \node at (2.0,-0.3) {\(\Gamma = \partial\Omega \)}; \node at (4.5,1.8) {\( \mathbb{R}^3 \setminus \overline{\Omega} \)}; \end{tikzpicture}} \end{columns} \end{FIframe}%>>> \begin{frame}[t,fragile] \frametitle{{Solving BIEs with CSBQ}} \framesubtitle{{}} %<<< \vspace{-1em} {\bf Step 3: Discretize the geometry} \vspace{-0.5em} \begin{columns}[t] \column{0.7\textwidth} \only<2->{ \begin{itemize} \item Geometry described by centerline {\color{red} $\gamma$}. \only<3->{\item Partition into panels.\\ \begin{itemize} \item Choose panel order and Fourier order. \end{itemize} } \only<4->{\item Determine nodes {\color{blue} $\mathbf{x}_c$} and radius {\color{blue} $\epsilon$}.} \end{itemize} } \vspace{1em} \only<5>{~~ Code:} \begin{overprint} \onslide<5>%<<< \bf \begin{minted}[ %frame=lines, fontsize=\footnotesize, %linenos, gobble=5, ]{C++} Vector ElemOrder, FourierOrder; Vector Xc, eps; // set vector data ... SlenderElemList elem_lst(ElemOrder, FourierOrder, Xc, eps); \end{minted} %>>> \end{overprint} \column{0.4\textwidth} \only<1>{\includegraphics[width=0.99\textwidth]{figs/geom1}} \only<2>{\resizebox{0.99\linewidth}{!}{\begin{tikzpicture} \node[inner sep=0pt] at (0,0) {\includegraphics[width=5cm]{figs/geom2}}; \node at (1,0) {\color{red} \( \gamma \)}; \end{tikzpicture}}} \only<3>{\resizebox{0.99\linewidth}{!}{\begin{tikzpicture} \node[inner sep=0pt] at (0,0) {\includegraphics[width=5cm]{figs/geom3_}}; \node at (1.3,0) {\color{red} \( \gamma_k \)}; \end{tikzpicture}}} \only<4->{\resizebox{0.99\linewidth}{!}{\begin{tikzpicture} \node[inner sep=0pt] at (0,0) {\includegraphics[width=5cm]{figs/geom4}}; \node at (1.3,0) {\color{red} \( \gamma_k \)}; \node at (1.4,1.2) {\color{blue} \( \mathbf{x}_c, \epsilon \)}; \end{tikzpicture}}} \end{columns} \end{frame} %>>> \begin{frame}[t,fragile] \frametitle{{Solving BIEs with CSBQ}} \framesubtitle{{}} %<<< \vspace{-1em} {\bf Step 4: Discretize Integral Operator} \begin{itemize} \item {Stokes combined field kernel:} \end{itemize} {\bf \begin{minted}[ %frame=lines, fontsize=\scriptsize, %linenos, gobble=3, ]{C++} struct Stokes3D_CF_ { template static void uKerMatrix(VecType (&u)[3][3], const VecType (&r)[3], const VecType (&n)[3], const void* ctx_ptr) { // u[i][j] = [Stokes-SL] + [Stokes-DL]; } // other member functions ... }; \end{minted} } %using Stokes3D_CF = GenericKernel; \vspace{-1.7em} \begin{overprint} \onslide<2> \begin{columns} \column{0.78\textwidth} \vspace{1em} \begin{itemize} \item {Boundary integral operator:} \end{itemize} {\bf \begin{minted}[ %frame=lines, fontsize=\scriptsize, %linenos, gobble=3, ]{C++} Stokes3D_CF ker; BoundaryIntegralOp LayerPotenOp(ker); LayerPotenOp.AddElemList(elem_lst); // add geometry to operator LayerPotenOp.SetAccuracy(tol); // set accuracy const auto BIO = [&LayerPotenOp](Vector* U, const Vector& sigma) { LayerPotenOp.ComputePotential(*U, sigma); (*U) += sigma * 0.5; }; \end{minted} } \column{0.23\textwidth} \small \vspace{2em} $\displaystyle {\mathbf u}({\mathbf x}) = (\mathcal{D} + \mathcal{S})[\sigma]({\mathbf{x}})$ %\quad\qquad for ~~ ${\mathbf x} \in \mathbb{R}^3 \setminus \overline \Omega$ \[ K \, \sigma \coloneq (I/2 + D + S) \, \sigma \] \end{columns} \end{overprint} \end{frame} %>>> \begin{frame}[t,fragile] \frametitle{{Solving BIEs with CSBQ}} \framesubtitle{{}} %<<< \vspace{-1em} {\bf Step 5: Solve Integral Equation} \vspace{1em} {\bf \begin{minted}[ %frame=lines, fontsize=\footnotesize, %linenos, gobble=4, ]{C++} Vector sigma, U0(LayerPotenOp.Dim(0)); // set boundary condition U0 GMRES solver; solver(&sigma, BIO, U0, tol); \end{minted} } \end{frame} %>>> \begin{frame}[t,fragile] \frametitle{{Solving BIEs with CSBQ}} \framesubtitle{{}} %<<< \vspace{-1em} {\bf Step 6: Post-process} \vspace{1em} {\bf \begin{minted}[ %frame=lines, fontsize=\footnotesize, %linenos, gobble=4, ]{C++} Vector U; LayerPotenOp.SetTargetCoord(Xtrg); // Set targets for LayerPotenOp LayerPotenOp.ComputePotential(U, sigma); // Evaluate solution //... Write to VTK file \end{minted} } %CubeVolumeVis cube(50, 2.0); // 50x50x50 grid, side length 2 %LayerPotenOp.SetTargetCoord(cube.GetCoord()); // Set targets for LayerPotenOp %Vector U; %LayerPotenOp.ComputePotential(U, sigma); // Evaluate solution %cube.WriteVTK("vis/bie-solution", U); // Write to VTK file \vspace{1em} \only<2->{ \centering \includegraphics[width=0.75\textwidth]{figs/stokes-dirichlet} } \end{frame} %>>> %>>>