**Christoph Schwarzmeier**
(13924a65)
*
at
03 Feb 14:24
*

This merge request fixes an error in the evaluation of the bubble's center of mass in the showcases `TaylorBubble`

and `RisingBubble`

.

In bb313c98, the code was changed so that a `Vector3`

type is MPI-reduced. However, the reduced vector was forgotten to be used in the computation.

**Christoph Schwarzmeier**
(13924a65)
*
at
02 Feb 17:33
*

Fix error in center of mass computation

**Christoph Schwarzmeier**
(6e8d3fa6)
*
at
01 Feb 15:03
*

**Christoph Schwarzmeier**
(a6f4265b)
*
at
01 Feb 14:19
*

**Christoph Schwarzmeier**
(a6f4265b)
*
at
30 Jan 16:38
*

Use force density field in lbmpy kernels

**Christoph Schwarzmeier**
(dbbbb758)
*
at
27 Jan 09:52
*

Fix bug that prevented the force density field to be updated

This merge request renames "force" to "forceDensity" in the LBM force models. With this change, we aim to emphasize that the user must specify a body force density in waLBerla's force models.

The force is defined as `\boldsymbol{F} = m \rho \boldsymbol{a}`

, where `m = \Delta x^{3} \rho`

is a cell's mass, `\rho`

is the macroscopic fluid density, and `\boldsymbol{a}`

is an acceleration.
The force density is `\boldsymbol{F_\rho} = \boldsymbol{F} / \Delta x^{3} = \rho \boldsymbol{a}`

, because we use `\Delta x = 1`

in waLBerla.

When using a incompressible lattice model, the density does not change and is equal to the LBM reference density `\rho_{0}=1`

. Therefore, `\boldsymbol{F} = \boldsymbol{F_\rho}`

.
In contrast, when using a compressible lattice model, the density may vary in space and time, so that `\boldsymbol{F} \neq \boldsymbol{F_\rho}`

.

Additionally, this merge request adds a warning when Guo's forcing model is used in conjunction with a TRT or MRT collision operator. This warning addresses #176 and should be removed once the issue is resolved in !560.

This merge request fixes the incorrect treatment of external body forces, that is, body force densities in the FSLBM module.
In the FSLBM, we relax the particle distribution functions to their compressible state. However, external body force densities were incorrectly assumed as if they were relaxed to an incompressible equilibrium. More specifically, the force density was `\boldsymbol{F} = \boldsymbol{a} \rho_0`

, where `\boldsymbol{a}`

is a user-chosen acceleration and `\rho_0=1`

is the LBM reference density.

Now, the force density is correctly taken into account by `\boldsymbol{F}(\boldsymbol{x}, t) = \boldsymbol{a} \rho(\boldsymbol{x}, t) \varphi(\boldsymbol{x}, t)`

, where `\rho(\boldsymbol{x},t)`

is the density and `\varphi(\boldsymbol{x}, t)`

is the fill level of a cell located at `\boldsymbol{x}`

.

This merge request also updates all showcases accordingly.

**Christoph Schwarzmeier**
(6e8d3fa6)
*
at
26 Jan 17:34
*

Rename force to forceDensity in LBM force models

**Christoph Schwarzmeier**
(1f673d7d)
*
at
26 Jan 16:22
*

Fix incorrect treatment of body force density in FSLBM module

Forcing terms are currently used incorrectly when using the compressible form of the PDF's equilibrium in `lbmpy`

.

In LBM, we want the user to specify the variable `force`

in terms of a body force density vector `\boldsymbol{F}`

.
In the compressible case, is should be formally `\boldsymbol{F}(\boldsymbol{x},t) = \rho(\boldsymbol{x},t) \boldsymbol{a}`

, where `\rho(\boldsymbol{x},t)`

is the density and `\boldsymbol{a}`

is an acceleration. I assume that `\boldsymbol{a}`

is constant in the whole domain, as I could not find a counter example where this is not the case. In contrast, I assume `\rho(\boldsymbol{x},t)`

to depend on the position `\boldsymbol{x}`

and time `t`

because that's what one observes in compressible fluids.

In `lbmpy`

, such a compressible case is currently treated as follows:

- A user can only specify the body force density
`\boldsymbol{F} = \text{const.}`

, which is a single vector and independent of`\boldsymbol{x}`

or`t`

. Let us assume that`\rho(\boldsymbol{x},0) = 1`

. During the simulation,`\rho(\boldsymbol{x},t)`

will eventually change because of the flow dynamics. - In
`conservedquantitycomputation.py`

, line 240, the macroscopic velocity for constructing the equilibrium, is shifted by`\boldsymbol{F}/2/\rho(\boldsymbol{x},t)`

. The density is indeed taken dependent on`\boldsymbol{x}`

and`t`

here. Since the user has specified a force density independent of`\boldsymbol{x}`

and`t`

,`lbmpy`

essentially assumes that the acceleration`\boldsymbol{a}`

varies with`\boldsymbol{x}`

and`t`

: We have`\boldsymbol{F} = \text{const.} = \rho(\boldsymbol{x},0) \boldsymbol{a}`

. Therefore, if`\boldsymbol{F} / \rho(\boldsymbol{x},t)`

with`\rho(\boldsymbol{x},0) \neq \rho(\boldsymbol{x},t)`

, the acceleration`\boldsymbol{a}`

must change in time`t`

and likewise, it could also change in`\boldsymbol{x}`

, so that`\boldsymbol{a}(\boldsymbol{x}, t) \neq \text{const.}`

- Then, in
`momentbasedmethod.py`

, line 397,`lbmpy`

directly uses`\boldsymbol{F}`

as specified by the user. Here, the change in`\boldsymbol{a}(\boldsymbol{x}, t)`

is not taken into account.

How it should be implemented: When using a compressible equilibrium with a force model, the user should be allowed to either specify

- a whole force density field, where the force density may change, so that
`\boldsymbol{F}(\boldsymbol{x},t)`

- the acceleration
`\boldsymbol{a} = \text{const.}`

rather than a force density`\boldsymbol{F}`

. This acceleration can be directly used in the computation of the macroscopic velocity, without needing to take the density into account. Finally, in the LBM collision,`lbmpy`

should use the force density`\rho(\boldsymbol{x},t) \boldsymbol{a}`

.

To illustrate the problem, I have reprinted the relevant equations from the book of T. Krüger, p. 233:

`\boldsymbol{u}(\boldsymbol{x},t) = 1/\rho(\boldsymbol{x},t) \sum_{i}f_{i}(\boldsymbol{x},t) + \boldsymbol{F} \Delta t / 2 / \rho(\boldsymbol{x},t)`

, where I assumed that a user specifies a constant force density `\boldsymbol{F}`

for the whole domain.

`\boldsymbol{S_{i}}(\boldsymbol{x},t) \sim \boldsymbol{F}`

, where `\boldsymbol{S_{i}}`

is a source term added to the collision operator. Note that the index `i`

should not be bold, but the LaTeX interpreter here does not allow to write it correctly.

**Christoph Schwarzmeier**
(dbdaebea)
*
at
24 Jan 17:44
*

Add script for plotting 3d view with pyvista [ci skip]

**Christoph Schwarzmeier**
(e3db0c99)
*
at
24 Jan 13:17
*

Update resolution study in evaluation script [ci skip]