Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 788 additions and 582 deletions
import sympy as sp
from pystencils.simp import (
SimplificationStrategy, apply_to_all_assignments,
insert_aliases, insert_zeros, insert_constants)
def create_phasefield_simplification_strategy(lb_method):
s = SimplificationStrategy()
expand = apply_to_all_assignments(sp.expand)
s.add(expand)
s.add(insert_zeros)
s.add(insert_aliases)
s.add(insert_constants)
s.add(lambda ac: ac.new_without_unused_subexpressions())
return s
......@@ -46,9 +46,9 @@ def match_generic_equilibrium_ansatz(stencil, equilibrium, u=sp.symbols("u_:3"))
generic quadratic form, a ValueError is raised
Example:
>>> from lbmpy.stencils import get_stencil
>>> from lbmpy import LBStencil, Stencil
>>> from lbmpy.maxwellian_equilibrium import discrete_maxwellian_equilibrium
>>> stencil = get_stencil("D2Q9")
>>> stencil = LBStencil(Stencil.D2Q9)
>>> eq = discrete_maxwellian_equilibrium(stencil)
>>> result = match_generic_equilibrium_ansatz(stencil, eq)
>>> result[sp.Symbol('A_0')]
......@@ -94,12 +94,13 @@ def moment_constraint_equations(stencil, equilibrium, moment_to_value_dict, u=sp
def hydrodynamic_moment_values(up_to_order=3, dim=3, compressible=True):
"""Returns the values of moments that are required to approximate Navier Stokes (if up_to_order=3)"""
from lbmpy.maxwellian_equilibrium import get_moments_of_continuous_maxwellian_equilibrium
from lbmpy.maxwellian_equilibrium import get_equilibrium_values_of_maxwell_boltzmann_function
from lbmpy.moments import moments_up_to_order
moms = moments_up_to_order(up_to_order, dim)
c_s_sq = sp.Symbol("p") / sp.Symbol("rho")
moment_values = get_moments_of_continuous_maxwellian_equilibrium(moms, dim=dim, c_s_sq=c_s_sq, order=2)
moment_values = get_equilibrium_values_of_maxwell_boltzmann_function(moms, dim=dim, c_s_sq=c_s_sq, order=2,
space="moment")
if not compressible:
moment_values = [compressible_to_incompressible_moment_value(m, sp.Symbol("rho"), sp.symbols("u_:3")[:dim])
for m in moment_values]
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
from statistics import median
import numpy as np
import pytest
import sympy as sp
from lbmpy.scenarios import create_lid_driven_cavity
......@@ -228,11 +227,11 @@ def study_block_sizes_trt(study):
study.add_run(params, weight=ds[0] // domain_sizes[0][0])
@pytest.mark.longrun
def test_run():
"""Called by test suite - ensures that benchmark can be run"""
s = ParameterStudy(run)
study_optimization_options(s, domain_sizes=((17, 23), (19, 17, 18))).run()
# @pytest.mark.longrun
# def test_run():
# """Called by test suite - ensures that benchmark can be run"""
# s = ParameterStudy(run)
# study_optimization_options(s, domain_sizes=((17, 23), (19, 17, 18))).run()
def study_compiler_flags(study):
......
......@@ -250,8 +250,8 @@ def run(re=6000, eval_interval=0.05, total_time=3.0, domain_size=100, u_0=0.05,
def create_full_parameter_study(gpu=False):
"""Creates a parameter study that can run the Kida vortex flow with entropic, KBC, Smagorinsky and MRT methods."""
opt_cpu = {'target': 'cpu', 'openmp': 4}
opt_gpu = {'target': 'gpu'}
opt_cpu = {'target': ps.Target.CPU, 'openmp': 4}
opt_gpu = {'target': ps.Target.GPU}
mrt_one = [{'method': 'mrt3', 'relaxation_rates': ['viscosity', 1, 1], 'stencil': stencil}
for stencil in ('D3Q19', 'D3Q27')]
......