Skip to content
Snippets Groups Projects
Commit ee978956 authored by Martin Bauer's avatar Martin Bauer
Browse files

Removed warnings in tests

parent cb64d1b5
Branches
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ from pystencils.cache import disk_cache ...@@ -15,7 +15,7 @@ from pystencils.cache import disk_cache
def get_weights(stencil, c_s_sq): def get_weights(stencil, c_s_sq):
q = len(stencil) q = len(stencil)
if c_s_sq != sp.Rational(1, 3): if c_s_sq != sp.Rational(1, 3) and c_s_sq != sp.Symbol("c_s") ** 2:
warnings.warn("Weights of discrete equilibrium are only valid if c_s^2 = 1/3") warnings.warn("Weights of discrete equilibrium are only valid if c_s^2 = 1/3")
def weight_for_direction(direction): def weight_for_direction(direction):
...@@ -55,12 +55,13 @@ def discrete_maxwellian_equilibrium(stencil, rho=sp.Symbol("rho"), u=tuple(sp.sy ...@@ -55,12 +55,13 @@ def discrete_maxwellian_equilibrium(stencil, rho=sp.Symbol("rho"), u=tuple(sp.sy
""" """
Returns the common discrete LBM equilibrium as a list of sympy expressions Returns the common discrete LBM equilibrium as a list of sympy expressions
:param stencil: tuple of directions Args:
:param rho: sympy symbol for the density stencil: tuple of directions
:param u: symbols for macroscopic velocity, only the first 'dim' entries are used rho: sympy symbol for the density
:param order: highest order of velocity terms (for hydrodynamics order 2 is sufficient) u: symbols for macroscopic velocity, only the first 'dim' entries are used
:param c_s_sq: square of speed of sound order: highest order of velocity terms (for hydrodynamics order 2 is sufficient)
:param compressible: compressibility c_s_sq: square of speed of sound
compressible: compressibility
""" """
weights = get_weights(stencil, c_s_sq) weights = get_weights(stencil, c_s_sq)
assert len(stencil) == len(weights) assert len(stencil) == len(weights)
......
...@@ -48,7 +48,8 @@ def match_generic_equilibrium_ansatz(stencil, equilibrium, u=sp.symbols("u_:3")) ...@@ -48,7 +48,8 @@ def match_generic_equilibrium_ansatz(stencil, equilibrium, u=sp.symbols("u_:3"))
>>> from lbmpy.stencils import get_stencil >>> from lbmpy.stencils import get_stencil
>>> from lbmpy.maxwellian_equilibrium import discrete_maxwellian_equilibrium >>> from lbmpy.maxwellian_equilibrium import discrete_maxwellian_equilibrium
>>> stencil = get_stencil("D2Q9") >>> stencil = get_stencil("D2Q9")
>>> result = match_generic_equilibrium_ansatz(get_stencil('D2Q9'), discrete_maxwellian_equilibrium(stencil) ) >>> eq = discrete_maxwellian_equilibrium(stencil)
>>> result = match_generic_equilibrium_ansatz(stencil, eq)
>>> result[sp.Symbol('A_0')] >>> result[sp.Symbol('A_0')]
4*rho/9 4*rho/9
>>> result[sp.Symbol('B_1')] >>> result[sp.Symbol('B_1')]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment