force_model.py 1.1 KB
Newer Older
Frederik Hennig's avatar
Frederik Hennig committed
1
2
3
4
5
6
7
8
from lbmpy.forcemodels import default_velocity_shift


#   =========================== Centered Cumulant Force Model ==========================================================


class CenteredCumulantForceModel:
    """
Markus Holzer's avatar
Markus Holzer committed
9
10
11
12
13
14
15
    A force model to be used with the centered cumulant-based LB Method.
    It only shifts the macroscopic and equilibrium velocities and does not introduce a forcing term to the
    collision process. Forcing is then applied through relaxation of the first central moments in the shifted frame of
    reference (cf. https://doi.org/10.1016/j.camwa.2015.05.001).

    Args:
        force: force vector which should be applied to the fluid
Frederik Hennig's avatar
Frederik Hennig committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    """

    def __init__(self, force):
        self._force = force
        self.override_momentum_relaxation_rate = 2

    def __call__(self, lb_method, **kwargs):
        raise Exception('This force model does not provide a forcing term.')

    def macroscopic_velocity_shift(self, density):
        return default_velocity_shift(density, self._force)

    def equilibrium_velocity_shift(self, density):
        return default_velocity_shift(density, self._force)