Viewing 1 post (of 1 total)
• Author
Posts
• #1981
chris
Member

Hello,

I would like to know the original work of the code, related to D2Q9 lattice with force, quoted below. Is there any journal article to understand the following code?

Code:
// Efficient specialization for D2Q9 lattice with force
template<typename T>
struct lbExternalHelpers<T, descriptors::ForcedD2Q9Descriptor> {

Cell<T,descriptors::ForcedD2Q9Descriptor>& cell,
const T u[descriptors::ForcedD2Q9Descriptor<T>::d], T omega, T amplitude)
{
static const int forceBeginsAt
= descriptors::ForcedD2Q9Descriptor<T>::ExternalField::forceBeginsAt;
T* force = cell.getExternal(forceBeginsAt);
T mu = amplitude*((T)1-omega/(T)2);

cell[0] += mu *(T)4/(T)3 *( force[0] * (- u[0] ) +
force[1] * ( – u[1] ) );
cell[1] += mu *(T)1/(T)12 *( force[0] * ( 2*u[0] – 3*u[1] – 1) +
force[1] * (-3*u[0] + 2*u[1] + 1) );
cell[2] += mu *(T)1/(T)3 *( force[0] * ( 2*u[0] – 1) +
force[1] * ( – u[1] ) );
cell[3] += mu *(T)1/(T)12 *( force[0] * ( 2*u[0] + 3*u[1] – 1) +
force[1] * ( 3*u[0] + 2*u[1] – 1) );
cell[4] += mu *(T)1/(T)3 *( force[0] * (- u[0] ) +
force[1] * ( + 2*u[1] – 1) );
cell[5] += mu *(T)1/(T)12 *( force[0] * ( 2*u[0] – 3*u[1] + 1) +
force[1] * (-3*u[0] + 2*u[1] – 1) );
cell[6] += mu *(T)1/(T)3 *( force[0] * ( 2*u[0] + 1) +
force[1] * ( – u[1] ) );
cell[7] += mu *(T)1/(T)12 *( force[0] * ( 2*u[0] + 3*u[1] + 1) +
force[1] * ( 3*u[0] + 2*u[1] + 1) );
cell[8] += mu *(T)1/(T)3 *( force[0] * (- u[0] ) +
force[1] * ( + 2*u[1] + 1) );
}
};