Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Bauer
lbmpy
Commits
49496409
Commit
49496409
authored
Feb 22, 2021
by
Markus Holzer
Browse files
Merge branch 'apple-arm64' into 'master'
fix some test problems found on Apple ARM64 See merge request
pycodegen/lbmpy!67
parents
3f3c98cd
3ac2bf38
Changes
6
Hide whitespace changes
Inline
Side-by-side
lbmpy/methods/centeredcumulant/centeredcumulantmethod.py
View file @
49496409
...
...
@@ -368,8 +368,8 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
lower_order_equilibrium
=
[
info
.
equilibrium_value
for
info
in
lower_order_relaxation_infos
]
lower_order_moment_collision_eqs
=
relax_lower_order_central_moments
(
lower_order_moments
,
lower_order_moment_symbols
,
lower_order_relaxation_rates
,
lower_order_equilibrium
)
lower_order_moments
,
tuple
(
lower_order_moment_symbols
)
,
tuple
(
lower_order_relaxation_rates
)
,
tuple
(
lower_order_equilibrium
)
)
# 5) Add relaxation rules for higher-order, polynomial cumulants
poly_relaxation_infos
=
[
cumulant_to_relaxation_info_dict
[
c
]
for
c
in
higher_order_polynomials
]
...
...
@@ -383,8 +383,8 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod):
galilean_correction_terms
=
None
cumulant_collision_eqs
=
relax_polynomial_cumulants
(
monomial_cumulants
,
higher_order_polynomials
,
poly_relaxation_rates
,
poly_equilibrium
,
tuple
(
monomial_cumulants
)
,
tuple
(
higher_order_polynomials
)
,
tuple
(
poly_relaxation_rates
)
,
tuple
(
poly_equilibrium
)
,
pre_simplification
,
galilean_correction_terms
=
galilean_correction_terms
)
...
...
lbmpy_tests/centeredcumulant/test_equilibrium.py
View file @
49496409
...
...
@@ -50,7 +50,7 @@ def test_equilibrium_pdfs(stencil_name, cm_transform):
if
ref_equilibrium
is
None
:
raw_moments
=
list
(
extract_monomials
(
c_lb_method
.
cumulants
,
dim
=
dim
))
ref_equilibrium
=
generate_equilibrium_by_matching_moments
(
stencil
,
raw_moments
,
rho
=
rho
,
u
=
u
,
c_s_sq
=
sp
.
Rational
(
1
,
3
),
order
=
2
*
dim
)
stencil
,
tuple
(
raw_moments
)
,
rho
=
rho
,
u
=
u
,
c_s_sq
=
sp
.
Rational
(
1
,
3
),
order
=
2
*
dim
)
reference_equilibria
[
stencil_name
]
=
ref_equilibrium
for
i
in
range
(
q
):
...
...
lbmpy_tests/full_scenarios/schaefer_turek/scenario_schaefer_turek.py
View file @
49496409
...
...
@@ -8,7 +8,9 @@ a cylinder. In Flow simulation with high-performance computers II (pp. 547-566).
import
warnings
import
numpy
as
np
import
pytest
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
from
lbmpy.boundaries.boundaryconditions
import
NoSlip
from
lbmpy.geometry
import
get_pipe_velocity_field
from
lbmpy.relaxationrates
import
relaxation_rate_from_lattice_viscosity
...
...
@@ -146,8 +148,9 @@ def long_run(steady=True, **kwargs):
plt
.
show
()
@
pytest
.
mark
.
skipif
(
not
get_supported_instruction_sets
(),
reason
=
'cannot detect CPU instruction set'
)
def
test_schaefer_turek
():
opt
=
{
'vectorization'
:
{
'instruction_set'
:
'avx'
,
'assume_aligned'
:
True
},
'openmp'
:
2
}
opt
=
{
'vectorization'
:
{
'instruction_set'
:
get_supported_instruction_sets
()[
-
1
]
,
'assume_aligned'
:
True
},
'openmp'
:
2
}
sc_2d_1
=
schaefer_turek_2d
(
30
,
max_lattice_velocity
=
0.08
,
optimization
=
opt
)
sc_2d_1
.
run
(
30000
)
result
=
evaluate_static_quantities
(
sc_2d_1
)
...
...
lbmpy_tests/test_geometry_setup_serial.py
View file @
49496409
import
os
import
numpy
as
np
import
pytest
from
lbmpy.boundaries
import
NoSlip
from
lbmpy.geometry
import
add_black_and_white_image
,
add_pipe_walls
...
...
@@ -49,6 +50,7 @@ def get_test_image_path():
def
test_image
():
pytest
.
importorskip
(
'scipy.ndimage'
)
sc
=
LatticeBoltzmannStep
(
domain_size
=
(
50
,
40
),
method
=
'srt'
,
relaxation_rate
=
1.9
,
optimization
=
{})
add_black_and_white_image
(
sc
.
boundary_handling
,
get_test_image_path
(),
keep_aspect_ratio
=
True
)
...
...
lbmpy_tests/test_postprocessing.py
View file @
49496409
import
numpy
as
np
import
pytest
from
lbmpy.postprocessing
import
scalar_field_interpolator
,
vector_field_interpolator
def
test_interpolation
():
pytest
.
importorskip
(
'scipy.ndimage'
)
scalar_arr
=
np
.
arange
(
0
,
3
*
3
).
reshape
(
3
,
3
)
scalar_ip
=
scalar_field_interpolator
(
scalar_arr
)
np
.
testing
.
assert_equal
(
scalar_ip
([[
1
,
1.5
],
[
0.5
,
1
]]),
[
2.5
,
0.5
])
...
...
lbmpy_tests/test_vectorization.py
View file @
49496409
import
numpy
as
np
import
pytest
from
pystencils.backends.simd_instruction_sets
import
get_supported_instruction_sets
from
lbmpy.scenarios
import
create_lid_driven_cavity
@
pytest
.
mark
.
skipif
(
not
get_supported_instruction_sets
(),
reason
=
'cannot detect CPU instruction set'
)
def
test_lbm_vectorization_short
():
print
(
"Computing reference solutions"
)
size1
=
(
64
,
32
)
...
...
@@ -13,7 +15,7 @@ def test_lbm_vectorization_short():
ldc1_ref
.
run
(
10
)
ldc1
=
create_lid_driven_cavity
(
size1
,
relaxation_rate
=
relaxation_rate
,
optimization
=
{
'vectorization'
:
{
'instruction_set'
:
'avx'
,
optimization
=
{
'vectorization'
:
{
'instruction_set'
:
get_supported_instruction_sets
()[
-
1
]
,
'assume_aligned'
:
True
,
'nontemporal'
:
True
,
'assume_inner_stride_one'
:
True
,
...
...
@@ -23,7 +25,7 @@ def test_lbm_vectorization_short():
ldc1
.
run
(
10
)
@
pytest
.
mark
.
parametrize
(
'instruction_set'
,
[
'sse'
,
'avx'
]
)
@
pytest
.
mark
.
parametrize
(
'instruction_set'
,
get_supported_instruction_sets
()
)
@
pytest
.
mark
.
parametrize
(
'aligned_and_padding'
,
[[
False
,
False
],
[
True
,
False
],
[
True
,
True
]])
@
pytest
.
mark
.
parametrize
(
'nontemporal'
,
[
False
,
True
])
@
pytest
.
mark
.
parametrize
(
'double_precision'
,
[
False
,
True
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment