D2Q9 lattice with force
› Forums › OpenLB › General Topics › D2Q9 lattice with force
- This topic has 0 replies, 1 voice, and was last updated 7 years, 5 months ago by chris.
-
AuthorPosts
-
June 22, 2018 at 3:15 pm #1981chrisMember
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> {static void addExternalForce(
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) );
}
};Thank you in advance.
Chris
-
AuthorPosts
- You must be logged in to reply to this topic.
