%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  lb.tex
%
%  Section on lattice Boltzmann hydrodynamics
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Lattice Boltzmann Hydrodynamics}
\label{section:lb-hydrodynamics}

We review here the lattice Boltzmann method applied to a simple
Newtonian fluid with particular emphasis on the relevant
implementation in \textit{Ludwig}.

\subsection{The Navier Stokes Equation}

We seek to solve the isothermal Navier-Stokes equations which, often
written in vector form, express mass conservation
\begin{equation}
\partial_t \rho + \boldsymbol{\nabla}.(\rho\mathbf{u}) = 0
\label{eq_mass1}
\end{equation}
and the conservation of momentum
\begin{equation}
\partial_t (\rho\mathbf{u}) + \boldsymbol{\nabla}.(\mathbf{\rho uu}) =
-\boldsymbol{\nabla}p + \eta \nabla^2 \mathbf{u}
+\zeta \boldsymbol{\nabla}(\boldsymbol{\nabla}.\mathbf{u}).
\label{eq_momentum1}
\end{equation}
Equation~\ref{eq_mass1} expresses the local rate of change of the
density $\rho(\mathbf{r}; t)$ as the divergence of the flux of
mass associated with the velocity field $\mathbf{u}(\mathbf{r}; t)$.
Equation~\ref{eq_momentum1} expresses Newton's second law for
momentum, where the terms on the right hand side represent the
force on the fluid.

For this work, it is more convenient to rewrite these equations
in tensor notation, where Cartesian coordinates ${x,y,z}$ are
represented by indices $\alpha$ and $\beta$, viz
\begin{equation}
\partial_t \rho + \nabla_\alpha (\rho u_\alpha) = 0
\end{equation}
and
\begin{equation}
\partial_t (\rho u_\alpha) + \nabla_\beta (\rho u_\alpha u_\beta)
= -\nabla_\alpha p
+  \eta \nabla_\beta (u_\alpha \nabla_\beta + \nabla_\alpha u_\beta)
+ \zeta \nabla_\alpha (\nabla_\gamma u_\gamma).
\end{equation}
Here, repeated Greek indices are understood to be summed over.
The conservation law is seem better if the forcing terms of the
right hand side are combined in the fluid stress $\Pi_{\alpha\beta}$
so that
\begin{equation}
\partial_t (\rho u_\alpha) +\nabla_\beta \Pi_{\alpha\beta} = 0.
\end{equation}
In this case the expanded expression for the stress tensor is
\begin{equation}
\Pi_{\alpha\beta} = p \delta_{\alpha\beta} + \rho u_\alpha u_\beta
+ \eta \nabla_\alpha u_\beta + \zeta (\nabla_\gamma u_\gamma)\delta_{\alpha\beta}
\end{equation}
where $\delta_{\alpha\beta}$ is that of Kroneker. Th Navier-Stokes
equations in three dimensions have 10 degrees of freedom
(or hydrodynamic modes) being
$\rho$, three components of the mass flux $\rho u_\alpha$, and 6 independent
modes from the (symmetric) stress tensor $\Pi_{\alpha\beta}$.

\subsection{The Lattice Boltzmann Equation}

The Navier-Stokes equation may be approximated in a discrete system
by the lattice Boltzmann equation (LBE). A discrete density
distribution function $f_i(\mathbf{r}; t)$ at lattice points $\mathbf{r}$
and time $t$ evolves according to
\begin{equation}
f_i (\mathbf{r} + \mathbf{c}_i \Delta t; t + \Delta t) =
f_i (\mathbf{r}; t) + \sum_j \mathcal{L}_{ij}
\big( f_i(\mathbf{r};t) - f_i^{\mathrm{eq}}(\mathbf{r};t) \big)
\end{equation}
where $\mathbf{c}_i$ is the discrete velocity basis and $\Delta t$
is the discrete time step. The collision operator
$\mathcal{L}_{ij}$ provides the mechanism to compute a discrete
update from the non-equilibrium distribution
$f_i(\mathbf{r}; t)- f_i^\mathrm{eq}(\mathbf{r};t)$. Additional terms
may be added to this equation to represent external body forces,
thermal fluctuations, and so on. These additional terms are discussed
in the following sections.

\subsubsection{The distribution function and its moments}

In lattice Boltzmann, the density and velocity of the continuum fluid
are complemented by the  distribution function
$f_i(\mathbf{r}; t)$ defined with reference to the
discrete velocity space $c_{i\alpha}$.
It is possible to relate the hydrodynamic quantities to the distribution
function via its moments, that is
\begin{equation}
\rho(\mathbf{r};t) = \sum_i f_i(\mathbf{r};t),  \quad
\rho u_\alpha(\mathbf{r};t) = \sum_i f_i(\mathbf{r};t) c_{i\alpha},  \quad
\Pi_{\alpha\beta}(\mathbf{r};t) =
\sum_i f_i(\mathbf{r};t) c_{i\alpha} c_{i\beta}.
\label{equation-lb-f-moments}
\end{equation}
Here, the index of the summation is over the number of discrete
velocities used as the basis, a number which will be denoted
$N_\mathrm{vel}$. For example, in three dimensions
$N_\mathrm{vel}$ is often 19 and the basis is referred to as D3Q19.

The number of moments, or modes, supported by a velocity
set is exactly $N_\mathrm{vel}$, and these can be written in general as
\begin{equation}
M^a(\mathbf{r};t) = \sum_i m_i^a f_i(\mathbf{r};t),
\end{equation}
where the $m_i$ are the eigenvectors of the collision matrix in the LBE.
For example, in the case of the density, all the
$m_i^a = 1$ and the mode $M^a$ is the density $\rho = \sum_i f_i$. Note
that the number of modes supported by a given basis will generally exceed the
number of hydrodynamic modes; the excess modes have no direct physical
interpretation and are variously referred to as non-hydrodynamic, kinetic,
or ghost, modes.
The ghost modes take no part in bulk hydrodynamics, but may become important
in other contexts, such as thermal fluctuations and near boundaries.
The distribution function can be related to the modes
$M^a(\mathbf{r};t)$ via
\begin{equation}
f_i(\mathbf{r};t) = w_i \sum_a m_i^a N^a M^a(\mathbf{r};t).
\end{equation}
In this equation, $w_i$ are the standard LB weights appearing in the
equilibrium distribution function, while the $N^a$ are a per-mode
normalising factor uniquely determined by the orthogonality condition
\begin{equation}
N^a \sum_i w_i m_i^a m_i^b = \delta_{ab}.
\end{equation}
Writing the basis this way has the advantage that the equilibrium
distribution projects directly into the hydrodynamic modes only.
Putting it another way, we may write
\begin{equation}
f_i^\mathrm{eq} = w_i \big(\rho + \rho c_{i\alpha}u_\alpha / c_s^2
+ (c_{i\alpha} c_{i\beta} - c_s^2\delta_{\alpha\beta})
(\Pi_{\alpha\beta}^\mathrm{eq} - p\delta_{\alpha\beta})/2c_s^4 \big)
\end{equation}
where only (equilibrium) hydrodynamic quantities appear on the right hand side.

\subsubsection{Collision and relaxation times}

\subsection{Model Basis Descriptions}

\subsubsection{D2Q9}

The D2Q9 model in two dimensions consists one zero vector (0,0), four
vectors of length unity being $(\pm 1,0)$ and $(0, \pm 1)$, and four
vectors of length $\sqrt{2}$ being $(\pm 1, \pm 1)$. The eigenvectors of
the collision matrix, with associated weights and normalisers are shown
in Table~\ref{table-d2q9-spec}. In two dimensions there are six hydrodynamic
modes and a total of three kinetic modes, or ghost modes.

\begin{table}[t]
\begin{center}
\begin{tabular}{|l|r|rrrrrrrrr|r|l|}
\hline\hline
$M^a$ & $p$ & \multicolumn{9}{c|}{$m_i^a$} & $N^a$  &\\
\hline
$\rho$ & - & 1 &  1 &  1 &  1 &  1 &  1 &  1 &   1 &  1 & 1 &$\mathbf{1}$ \\
\hline
$\rho c_{ix}$ & - & 0 &  1 &  1 & 1 & 0 &  0 & -1 &  1 & -1 & 3 & $c_{ix}$ \\
\hline
$\rho c_{iy}$ & - & 0 & 1 &  0 &  -1 &  1 &  -1 & 1 & 0 & -1 & 3  &$c_{iy}$ \\
\hline
$Q_{xx}$ & 1/3 & -1 &  2 &  2 & 2 & -1 & -1 & 2 & 2 & 2 & 9/2
& $c_{ix} c_{ix} - c_s^2$ \\
\hline
$Q_{xy}$ & - & 0 &  1 & 0 & -1 & 0 & 0 & -1 & 0 & 1 & 9 & $c_{ix} c_{iy}$ \\
\hline
$Q_{yy}$ & 1/3 & -1 &  2 & -1 & 2 & 2 & 2 & 2 & -1 & 2 & 9/2
& $c_{iy} c_{iy} - c_s^2$ \\
\hline\hline
$\chi^1$ & - &  1 & 4 & -2 & 4 & -2 & -2 & 4 & -2 & 4 & 1/4 & $\chi^1$ \\
\hline
$J_{ix}$ & - & 0 &  4 & -2 & 4 & 0 & 0 & -4 & -2 & -4 & 3/8
& $\chi^1 \rho c_{ix}$\\
\hline
$J_{iy}$ & - & 0 & 4 & 0 & -4 & -2 & 2 & 4 & 0 & -4 & 3/8
& $\chi^1 \rho c_{iy}$\\
\hline\hline
$w_i$ & 1/36 & 16 & 1 & 4 & 1 & 4 & 4 & 1 & 4 & 1 & & $w_i$\\
\hline\hline
\end{tabular}
\end{center}
\caption{Table showing the details of the basis used for the D2Q9 model
in two dimensions. The nine modes $M^a$ include six hydrodynamic modes,
one scalar kinetic mode $\chi^1$, and one vector kinetic mode $J_{i\alpha}$.
The weights in the equilibrium distribution function are $w_i$ and the
normaliser for each mode is $N^a$. The eigenvectors of the collision
matrix are the columns of the transformation matrix $m^a_i$. The pre-factor
$p$ (where present) multiplies all the elements to the right in that row.}
\label{table-d2q9-spec}
\end{table}

\subsubsection{D3Q15}

The D3Q15 model in three dimensions consists of a set of vectors:
one zero vector $(0,0,0)$, six vectors of length unity being
$(\pm 1, 0, 0)$ cyclically permuted, and 8 vectors of length
$\sqrt{3}$ being $(\pm 1, \pm 1, \pm 1)$.
The eigenvalues and eigenvectors of the collision
matrix used for D3Q15 are given in Table~\ref{table-d3q15-spec}.

\begin{table}[t]
\centering
\tabcolsep=4pt
\begin{tabular}{|l|r|r|rrrrrr|rrrrrrrr|r|l|}
\hline\hline
$M^a$ & $p$ & \multicolumn{15}{c|}{$m_i^a$} & $N^a$  &\\
\hline
$\rho$ & - &
 1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &  1 &
1 &$\mathbf{1}$ \\
\hline
$\rho c_{ix}$ & - &
 0 &  1 & -1 &  0 &  0 &  0 &  0 &  1 & -1 &  1 & -1 &  1 & -1 &  1 & -1 &
3  & $c_{ix}$ \\
\hline
$\rho c_{iy}$ & - &
 0 &  0 &  0 &  1 & -1 &  0 &  0 &  1 &  1 & -1 & -1 &  1 &  1 & -1 & -1 &
3  &$c_{iy}$ \\
\hline
$\rho c_{iz}$ & - &
 0 &  0 &  0 &  0 &  0 &  1 & -1 &  1 &  1 &  1 &  1 & -1 & -1 & -1 & -1 &
3  & $c_{iz}$ \\
\hline
$Q_{xx}$ & 1/3 &
-1 &  2 &  2 & -1 & -1 & -1 & -1 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &
9/2  & $c_{ix} c_{ix} - c_s^2$ \\
\hline
$Q_{yy}$ & 1/3 &
-1 & -1 & -1 &  2 &  2 & -1 & -1 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &
 9/2 & $c_{iy} c_{iy} - c_s^2$ \\
\hline
$Q_{zz}$ & 1/3 &
-1 & -1 & -1 & -1 & -1 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &  2 &
 9/2 & $c_{iz} c_{iz} - c_s^2$ \\
\hline
$Q_{xy}$ & - &
 0 &  0 &  0 &  0 &  0 &  0 &  0 &  1 & -1 & -1 &  1 &  1 & -1 & -1 &  1 &
9  & $c_{ix} c_{iy}$ \\
\hline
$Q_{yz}$ & - &
 0 &  0 &  0 &  0 &  0 &  0 &  0 &  1 &  1 & -1 & -1 & -1 & -1 &  1 &  1 &
9  & $c_{iy} c_{iz}$ \\
\hline
$Q_{zx}$ & - &
 0 &  0 &  0 &  0 &  0 &  0 &  0 &  1 & -1 &  1 & -1 & -1 &  1 & -1 &  1 &
9  & $c_{iz} c_{ix}$ \\
\hline\hline
$\chi^1$ & - &
-2 &  1 &  1 &  1 &  1 &  1 &  1 & -2 & -2 & -2 & -2 & -2 & -2 & -2 & -2 &
1/2 & $\chi^1$ \\
\hline
$J_{ix}$ & - &
 0 &  1 & -1 &  0 &  0 &  0 &  0 & -2 &  2 & -2 &  2 & -2 &  2 & -2 &  2 &
3/2 & $\chi^1 \rho c_{ix}$\\
\hline
$J_{iy}$ & - &
 0 &   0 &  0 &  1 & -1 &  0 &  0 & -2 & -2 &  2 &  2 & -2 & -2 &  2 &  2 &
3/2 & $\chi^1 \rho c_{iy}$\\
\hline
$J_{iz}$ & - &
 0 &   0 &  0 &  0 &  0 &  1 & -1 & -2 & -2 & -2 & -2 &  2 &  2 &  2 &  2 &
3/2 & $\chi^1 \rho c_{iz}$\\
\hline
$\chi^3$ & - &
 0 &   0 &  0 &  0 &  0 &  0 &  0 &  1 & -1 & -1 &  1 & -1 &  1 &  1 & -1 &
9 & $c_{ix} c_{iy} c_{iz}$ \\
\hline\hline
$w_i$ & 1/72 &
$16$ & 8 & 8 & 8 & 8 & 8 & 8 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 &
 & $w_i$\\
\hline\hline
\end{tabular}

\caption{Table showing the details of the basis used for the D3Q15 model
in three dimensions. The fifteen modes $M^a$ include two scalar kinetic
modes $\chi^1$ and $\chi^3$, and one vector kinetic mode $J_{i\alpha}$.
The weights in the equilibrium distribution are $w_i$ and the normaliser
for each mode is $N^a$. The eigenvectors of the collision matrix are the
columns of the transformation matrix $m_i^a$. The pre-factor $p$ simply
multiplies all elements of $m_i^a$ in that row as a convenience.
\label{table-d3q15-spec}
}
\end{table}

\subsubsection{D3Q19}

The D3Q19 model in three dimensions is constructed with velocities:
one zero vector $(0,0,0)$, three vectors of length unity being
$(\pm 1, 0, 0)$ cyclically permuted, and twelve vectors of length
$\sqrt{2}$ being $(\pm 1, \pm 1, 0)$ cyclically permuted. The
details of the D3Q19 model are set out in Table~\ref{table-d3q19-spec}.

\begin{table}[t]
\centering
\tabcolsep=4pt
\begin{tabular}{|l||r|rrrrrr|rrrr|rrrr|rrrr|r||}
\hline\hline
$M^a$ & \multicolumn{19}{c||}{$m_i^a$} & $N^a$\\
\hline
$\rho $ & 1 &  1 &  1 &  1 &  1 &  1 &  1 &
         1 &  1 &  1 &   1 &  1 &  1 &  1 & 1 & 1 & 1 & 1 & 1
& 1\\
\hline
$\rho c_{ix}$ & 0 &  1 &  -1 &  0 &  0 &  0 &  0 &
         1 &  1 &  -1 &   -1 &  1 &  1 &  -1 & -1 & 0 & 0 & 0 & 0
& 3 \\
\hline
$\rho c_{iy}$ & 0 &  0 &  0 &  1 &  -1 &  0 &  0 &
         1 &  -1 &  1 &   -1 &  0 &  0 &  0 & 0 & 1 & 1 & -1 & -1
& 3\\
\hline
$\rho c_{iz}$ & 0 &  0 &  0 &  0 &  0 &  1 &  -1 &
         0 &  0 &  0 &   0 &  1 &  -1 &  1 & -1 & 1 & -1 & 1 & -1
& 3\\
\hline
$Q_{ixx}$ & -1 &  2 &  2 &  -1&  -1 &  -1 &  -1 &
         2 &  2 &  2 &   2 &  2 &  2 &  2 & 2 & -1 & -1 & -1 & -1
& 9/2\\
\hline
$Q_{iyy}$ & -1 &  -1 &  -1 &  2&  2 &  -1 &  -1 &
         2 &  2 &  2 &   2 &  -1 &  -1 &  -1 & -1 & 2 & 2 & 2 & 2
& 9/2\\
\hline
$Q_{izz}$ & -1 &  -1 &  -1 &  -1&  -1 &  2 &  2 &
         -1 &  -1 &  -1 &   -1 &  2 &  2 & 2 & 2 & 2 & 2 & 2 & 2
& 9/2\\
\hline
$Q_{ixy}$ & 0 &  0 &  0 &  0&  0 &  0 &  0 &
          1 &  -1 &  -1 &    1 &  0 &  0 & 0 & 0 & 0 & 0 & 0 & 0
& 9\\
\hline
$Q_{ixz}$ & 0 &  0 &  0 &  0&  0 &  0 &  0 &
          0 &   0 &   0 &   0 &  1 & -1 & -1 & 1 & 0 & 0 & 0 & 0
& 9\\
\hline
$Q_{iyz}$ & 0 &  0 &  0 &  0&  0 &  0 &  0 &
          0 &   0 &   0 &   0 &  0 & 0 & 0 & 0 & 1 & -1 & -1 & 1
& 9\\
\hline\hline
$\chi^1$ & 0 &  1 &  1 &  1 &  1 &  -2 &  -2 &
         -2 &  -2 &  -2 &  -2 &  1 &  1 & 1 & 1 & 1 & 1 & 1 & 1
& 3/4\\
\hline
$\chi^1 \rho c_{ix}$ & 0 &  1 &  -1 &  0&  0 &  0 &  0 &
         -2 &  -2 &  2 &  2 &  1 &  1 & -1 & -1 & 0 & 0 & 0 & 0
& 3/2\\
\hline
$\chi^1 \rho c_{iy}$ & 0 &  0 &  0 &  1&  -1 &  0 &  0 &
         -2 &  2 &  -2 &  2 &  0 &  0 & 0 & 0 & 1 & 1 & -1 & -1
& 3/2\\
\hline
$\chi^1 \rho c_{iz}$ & 0 &  0 &  0 &  0&  0 &  -2 &  2 &
         0 &  0 &  0 &  0 &  1 &  -1 & 1 & -1 & 1 & -1 & 1 & -1
& 3/2\\
\hline
$\chi^2$ & 0 &  1 &  1 &  -1&  -1 &  0 &  0 &
         0 &  0 &  0 &  0 &  -1 &  -1 & -1 & -1 & 1 & 1 & 1 & 1
& 9/4\\
\hline
$\chi^2 \rho c_{ix}$ & 0 &  1 &  -1 &  0&  0 &  0 &  0 &
         0 &  0 &  0 &  0 &  -1 &  -1 & 1 & 1 & 0 & 0 & 0 & 0
& 9/2\\
\hline
$\chi^2 \rho c_{iy}$ & 0 &  0 &  0 & -1&   1 &  0 &  0 &
         0 &  0 &  0 &  0 &   0 &  0 & 0 & 0 & 1 &  1 & -1 & -1
& 9/2\\
\hline
$\chi^2 \rho c_{iz}$ & 0 &  0 &  0 &  0&  0 &  0 &  0 &
         0 &  0 &  0 &  0 &  -1 &  1 & -1 & 1 & 1 & -1 & 1 & -1
& 9/2\\
\hline
$\chi^3$ & 1 &  -2 &  -2 &  -2&  -2 &  -2 &  -2 &
         1 &  1 &  1 &  1 &  1 &  1 & 1 & 1 & 1 & 1 & 1 & 1
& 1/2\\
\hline\hline
$w_i$ & 12 & 2 & 2 & 2 & 2 & 2 & 2 &
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1
& \\
\hline\hline
\end{tabular}
\caption{Table showing the details of the basis used for the D3Q19 model in
three dimensions. The nineteen modes $M^a$ include ten hydrodynamic modes,
three scalar kinetic modes $\chi^1$, $\chi^2$, and $\chi^3$; there are also
two vector kinetic modes $\chi^1 \rho c_{i\alpha}$
and $\chi^2 \rho c_{i\alpha}$. The weights in the equilibrium distribution
function are $w_i$, and the normaliser for each mode is $N^a$. The
eigenvectors of the collision matrix are the columns of the transformation
matrix $m^a_i$.
\label{table-d3q19-spec}
}
\end{table}

\subsection{Fluctuating LBE}

It is possible \cite{adhikari2005} to simulate fluctuating
hydrodynamics for an isothermal fluid via the inclusion of
a fluctuating stress $\sigma_{\alpha\beta}$:
\begin{equation}
\Pi_{\alpha\beta} = p\delta_{\alpha\beta} + \rho u_\alpha u_\beta
+ \eta_{\alpha\beta\gamma\delta} \nabla_\gamma u_\delta + \sigma_{\alpha\beta}.
\end{equation}
The fluctuation-dissipation theorem relates the magnitude of this
random stress to the isothermal temperature and the viscosity.

In the LBE, this translates to the addition of a random contribution
$\xi_i$ to the distribution at the collision stage, so that
\begin{equation}
\ldots + \xi_i.
\end{equation}

For the conserved modes $\xi_i = 0$. For all the non-conserved modes,
i.e., those with dissipation, the fluctuating part may be written
\begin{equation}
\xi_i (\mathbf{r}; t) = w_i m_i^a \hat{\xi}^a (\mathbf{r}; t) N^a
\end{equation}
where $\hat{\xi}^a$ is a noise term which has a variance determined
by the relaxation time for given mode
\begin{equation}
\left< \hat{\xi}^a \hat{\xi}^b \right> =
\frac{\tau_a + \tau_b + 1}{\tau_a \tau_b}
\left< \delta M^a \delta M^b \right>.
\label{eq_fvar}
\end{equation}

\subsubsection{Fluctuating stress}

For the stress, the random contribution to the distributions is
\begin{equation}
\xi_i = w_i \frac{Q_{i\alpha\beta} \hat{\sigma}_{\alpha\beta}}{4c_s^2}
\end{equation}
where $\hat{\sigma}_{\alpha\beta}$ is a symmetric matrix of random
variates drawn from a Gaussian distribution with variance given
by equation~\ref{eq_fvar}. In the case that the shear and bulk
viscosities are the same, i.e., there is a single relaxation
time, then the variances of the six independent components of
the matrix are given by
\begin{equation}
\left< \hat{\sigma}_{\alpha\beta} \hat{\sigma}_{\mu\nu} \right> =
\frac{2\tau + 1}{\tau^2}
(\delta_{\alpha\mu}\delta_{\beta\nu} + \delta_{\alpha\nu} \delta_{\beta\mu}).
\end{equation}

\subsection{Hydrodynamic Boundary Conditions}

\subsubsection{Bounce-Back on Links}

A very general method for the representation of solid objects
within the LB approach was put forward by Ladd \cite{l94a, l94b}.
Solid objects (of any shape) are defined by a boundary surface
which intersects some of the velocity vectors $\mathbf{c}_i$
joining lattice nodes. Sites inside are designated solid, while
sites outside remain fluid. The correct boundary condition is
defined by identifying \textit{links} between fluid and solid
sites, which allows those elements of the distribution which would
cross the boundary at the propagation step to be ``bounced-back''
into the fluid. This bounce-back on links is an efficient method
to obtain the  correct hydrodynamic interaction between solid
and fluid.

\subsubsection{Fixed objects}

\subsubsection{Moving objects}

Colloidal particles are assumed to be spherical with a geometrical
centre $\mathbf{r}_c$, which is also the centre of mass. The
centre is allowed to move continuously across the lattice
with velocity $\mathbf{U}$; the particle has an angular velocity
$\mathbf{\Omega}$. The surface of the colloid is defined by an
input radius, $a_0$, which determines which lattice nodes are
inside or outside the colloid. (The hydrodynamic properties of
the colloid are specified by a different radius $a_h$ --- more
of this later.) The boundary links are then the set of vectors
joining lattice nodes which intersect the spherical surface
$\{\mathbf{c}_b\}$. Note that a lattice node exactly at
the solid-fluid interface is defined to be outside the colloid.

In the original approach of Ladd, fluid occupied nodes both inside
and outside the particle. The effect of the ``internal fluid'' is
known to be restricted to short time scales (compared to the
characteristic time $a_0^2/\nu$), on which the fluid inside the
particle relaxes to a solid body rotation \cite{heemels}. However,
we use fully solid particles via the approach introduced by
Nguyen and Ladd \cite{nguyen-ladd2002}.

A boundary link is defined as joining a node $\mathbf{r}$
inside the particle to one outside at $\mathbf{r} + \mathbf{c}_b \Delta t$.
If the post-collision distributions are denoted by $f^\ast$, then
the distributions must be reflected at the solid surface so that
\begin{equation}
\label{eq:colloid_bbl1}
f_{b'}(\mathbf{r}; t + \Delta t) = f_b^\ast (\mathbf{r}; t)
- \frac{2w_{c_b} \rho_0 \mathbf{u}_b.\mathbf{c}_b}{c_s^2}
\end{equation}
where the boundary link $\mathbf{c}_{b'} = -\mathbf{c}_b$.
Note that the local density at the fluid site $\rho(\mathbf{r};t)$
is replaced by
the mean fluid density $\rho_0$. in the second term on the right-hand side.
The velocity at the boundary is
\begin{equation}
\label{eq-colloid-ub}
\mathbf{u}_b = \mathbf{U} + \mathbf{\Omega}\times\mathbf{r}_b.
\end{equation}

The force exerted on a
single link is
\begin{equation}
\mathbf{F}_b(\mathbf{r} + {\scriptstyle\frac{1}{2}}\mathbf{c}_b\Delta t;
t + {\scriptstyle\frac{1}{2}}\Delta t) = \frac{\Delta x^3}{\Delta t}
\Big[ 2f_b^\ast(\mathbf{r}; t) - \frac{2w_{c_b}\rho_0 \mathbf{u}_b .
\mathbf{c}_b}{c_s^2} \Big] \mathbf{c}_b,
\label{eq-colloid-fb}
\end{equation}
with corresponding torque $\mathbf{T}_b = \mathbf{r}_b \times \mathbf{F}_b$.
The total hydrodynamic force on the particle is then found by taking
the sum of
$\mathbf{F}_b$ over all the boundary links defining the particle.
There is an associated torque on each link of $\mathbf{r}_b\times\mathbf{F}_b$,
which again is summed over all links to give the total torque on the colloid.
Colloid dynamics is discussed in more detail in Section~\ref{section:colloids}.

% End section
\vfill
\pagebreak


\section{Records}
We build mutable records in addition to our preceding operators. A record simply needs labels and the possiblity to (mutably) select a
field from a record. Since we want to ensure mutability, we want our selection operator to take as input a reference to our record and
to return as output a reference to the selected field; references can be assigned and evaluated (thanks to the $:=$, $*=$ and $eval$
operators) and this is what does guarantee mutability:

\begin{lstlisting}
class (State st m) => Record r st m where
  data Label st r :: * -> *
  (<==) :: (Ref st) m r -> Label st r a -> (Ref st) m a\end{lstlisting}

Before Giuseppe's PhD/Monads/ObjectiveMonad/MonadicObjects/trunk/tex v2/3.records.tex