Skip to content

Commit

Permalink
Correct second order term for forces in LB (#3885)
Browse files Browse the repository at this point in the history
The prefactor for the traceless part of the second order term is (1+gamma_shear)/2. Terms with this prefactor must cancel in the trace. Cf. Eq. (4.61) and (4.67) in my thesis.

Description of changes:
- Replace `gamma_bulk` by `gamma_shear` in the corresponding terms in `lb_apply_forces`
  • Loading branch information
kodiakhq[bot] authored Sep 14, 2020
2 parents 2fbea6e + 9987397 commit fe967ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/core/grid_based_algorithms/lb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,13 +894,13 @@ std::array<T, 19> lb_apply_forces(Lattice::index_t index,
density;

double C[6];
C[0] = (1. + lb_parameters.gamma_bulk) * u[0] * f[0] +
C[0] = (1. + lb_parameters.gamma_shear) * u[0] * f[0] +
1. / 3. * (lb_parameters.gamma_bulk - lb_parameters.gamma_shear) *
(u * f);
C[2] = (1. + lb_parameters.gamma_bulk) * u[1] * f[1] +
C[2] = (1. + lb_parameters.gamma_shear) * u[1] * f[1] +
1. / 3. * (lb_parameters.gamma_bulk - lb_parameters.gamma_shear) *
(u * f);
C[5] = (1. + lb_parameters.gamma_bulk) * u[2] * f[2] +
C[5] = (1. + lb_parameters.gamma_shear) * u[2] * f[2] +
1. / 3. * (lb_parameters.gamma_bulk - lb_parameters.gamma_shear) *
(u * f);
C[1] =
Expand Down
6 changes: 3 additions & 3 deletions src/core/grid_based_algorithms/lbgpu_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1012,21 +1012,21 @@ __device__ void apply_forces(unsigned int index, Utils::Array<float, 19> &mode,
u[1] = d_v[index].v[1];
u[2] = d_v[index].v[2];

C[0] += (1.0f + para->gamma_bulk) * u[0] *
C[0] += (1.0f + para->gamma_shear) * u[0] *
node_f.force_density[0 * para->number_of_nodes + index] +
1.0f / 3.0f * (para->gamma_bulk - para->gamma_shear) *
(u[0] * node_f.force_density[0 * para->number_of_nodes + index] +
u[1] * node_f.force_density[1 * para->number_of_nodes + index] +
u[2] * node_f.force_density[2 * para->number_of_nodes + index]);

C[2] += (1.0f + para->gamma_bulk) * u[1] *
C[2] += (1.0f + para->gamma_shear) * u[1] *
node_f.force_density[1 * para->number_of_nodes + index] +
1.0f / 3.0f * (para->gamma_bulk - para->gamma_shear) *
(u[0] * node_f.force_density[0 * para->number_of_nodes + index] +
u[1] * node_f.force_density[1 * para->number_of_nodes + index] +
u[2] * node_f.force_density[2 * para->number_of_nodes + index]);

C[5] += (1.0f + para->gamma_bulk) * u[2] *
C[5] += (1.0f + para->gamma_shear) * u[2] *
node_f.force_density[2 * para->number_of_nodes + index] +
1.0f / 3.0f * (para->gamma_bulk - para->gamma_shear) *
(u[0] * node_f.force_density[0 * para->number_of_nodes + index] +
Expand Down

0 comments on commit fe967ea

Please sign in to comment.