Introduction to Lattice Boltzmann Method

The Lattice Boltzmann Method (LBM) is a computational fluid dynamics (CFD) technique used to simulate fluid flow at a mesoscopic level. It is based on the kinetic theory of gases and solves the Boltzmann equation, which describes the behavior of particles in a fluid.

In LBM, the fluid domain is divided into a lattice of cells, and the fluid is simulated by tracking the movement of “particles” within each cell. These particles represent the distribution of fluid properties, such as density and velocity. Collisions between particles are simulated using collision models, which ensure the conservation of mass, momentum, and energy.

The lattice structure allows for easy parallelization and efficient computation since the interactions between neighboring cells can be calculated independently. This makes LBM particularly suitable for simulating complex flows, such as those involving multiple phases or fluid-structure interactions.

LBM has gained popularity due to its ability to handle a wide range of flow regimes, including low-speed, high-speed, and complex flows. It has been successfully used in various fields, such as engineering, physics, and biology, to simulate fluid phenomena and analyze flow behavior.

Overall, LBM offers a versatile and efficient approach to solving fluid flow problems and has become a valuable tool in the field of computational fluid dynamics.

lbm方程推导

fix lb/fluid 的代码实现

 fix_lb_fluid.cpp
//==========================================================================
// rescale the simulation parameters so that dx_lb=dt_lb=dm_lb=1.
// This assumes that all the simulation parameters have been given in
// terms of distance, time and mass units.
//==========================================================================
void FixLbFluid::rescale()
{

  densityinit = densityinit_real * dx_lb * dx_lb * dx_lb;
  if (dm_lb < 0) {    // indicating it was not set by user
    dm_lb = densityinit;
    densityinit = 1.0;
  } else
    densityinit /= dm_lb;

  vwtp = vwtp * dt_lb / dx_lb;
  vwbt = vwbt * dt_lb / dx_lb;

  bodyforcex = bodyforcex * dt_lb * dt_lb / dx_lb;
  bodyforcey = bodyforcey * dt_lb * dt_lb / dx_lb;
  bodyforcez = bodyforcez * dt_lb * dt_lb / dx_lb;

  if (pressure) {
    rhoH = (1.0 + rhofactor * 0.5) * densityinit_real;
    rhoL = (1.0 - rhofactor * 0.5) * densityinit_real;
    rhoH = rhoH * dx_lb * dx_lb * dx_lb / dm_lb;
    rhoL = rhoL * dx_lb * dx_lb * dx_lb / dm_lb;
  } else
    rhoH = rhoL = densityinit;

  tau = (3.0 * viscosity / densityinit_real) * dt_lb * dt_lb / dx_lb / dx_lb;
  tau /= dt_lb;
  tau = tau + 0.5;

  a_0 = a_0_real * dt_lb * dt_lb / (dx_lb * dx_lb);

  // Warn if using the D3Q19 model with noise, and a0 is too small.
  if (numvel == 19 && noisestress == 1 && a_0 < 0.2) {
    error->warning(FLERR, "Fix lb/fluid WARNING: Chosen value for a0 may be too small. \
Check temperature reproduction.\n");
  }

  if (noisestress == 1) {
    if (a_0 > 0.5555555) {
      error->all(FLERR, "Fix lb/fluid ERROR: the Lattice Boltzmann dx and dt need \
to be chosen such that the scaled a_0 < 5/9\n");
    }
  }

  // Courant Condition:
  if (a_0 >= 1.0) {
    error->all(FLERR, "Fix lb/fluid ERROR: the lattice Boltzmann dx and dt do not \
satisfy the Courant condition.\n");
  }

  kB = (force->boltz / force->mvv2e) * dt_lb * dt_lb / dx_lb / dx_lb / dm_lb;

  namp = 2.0 * kB * T * (tau - 0.5) / 3.0;
  noisefactor = 1.0;
  if (a_0 <= 0.333333333333333) {
    K_0 = 5.17 * (0.333333333333333 - a_0);
  } else {
    K_0 = 2.57 * (a_0 - 0.333333333333333);
  }
}

希望你能够评论一下我,这样我就可以给你点赞了💖