Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lbmpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
lbmpy
Commits
d7e91b4c
Commit
d7e91b4c
authored
2 months ago
by
RudolfWeeber
Committed by
Frederik Hennig
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix fluctuating LB with zero centered pdf storage
parent
f7415a0d
No related branches found
No related tags found
1 merge request
!186
Fix fluctuating LB with zero centered pdf storage
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lbmpy/creationfunctions.py
+2
-2
2 additions, 2 deletions
src/lbmpy/creationfunctions.py
src/lbmpy/fluctuatinglb.py
+2
-6
2 additions, 6 deletions
src/lbmpy/fluctuatinglb.py
tests/test_fluctuating_lb.py
+262
-131
262 additions, 131 deletions
tests/test_fluctuating_lb.py
with
266 additions
and
139 deletions
src/lbmpy/creationfunctions.py
+
2
−
2
View file @
d7e91b4c
...
@@ -376,8 +376,8 @@ class LBMConfig:
...
@@ -376,8 +376,8 @@ class LBMConfig:
if
not
self
.
compressible
and
self
.
method
in
(
Method
.
MONOMIAL_CUMULANT
,
Method
.
CUMULANT
):
if
not
self
.
compressible
and
self
.
method
in
(
Method
.
MONOMIAL_CUMULANT
,
Method
.
CUMULANT
):
raise
ValueError
(
"
Incompressible cumulant-based methods are not supported (yet).
"
)
raise
ValueError
(
"
Incompressible cumulant-based methods are not supported (yet).
"
)
if
self
.
zero_centered
and
(
self
.
entropic
or
self
.
fluctuating
)
:
if
self
.
zero_centered
and
self
.
entropic
:
raise
ValueError
(
"
Entropic
and fluctuating
methods can only be created with `zero_centered=False`.
"
)
raise
ValueError
(
"
Entropic methods can only be created with `zero_centered=False`.
"
)
# Check or infer delta-equilibrium
# Check or infer delta-equilibrium
if
self
.
delta_equilibrium
is
not
None
:
if
self
.
delta_equilibrium
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
src/lbmpy/fluctuatinglb.py
+
2
−
6
View file @
d7e91b4c
...
@@ -19,9 +19,7 @@ def add_fluctuations_to_collision_rule(collision_rule, temperature=None, amplitu
...
@@ -19,9 +19,7 @@ def add_fluctuations_to_collision_rule(collision_rule, temperature=None, amplitu
""""""
""""""
if
not
(
temperature
and
not
amplitudes
)
or
(
temperature
and
amplitudes
):
if
not
(
temperature
and
not
amplitudes
)
or
(
temperature
and
amplitudes
):
raise
ValueError
(
"
Fluctuating LBM: Pass either
'
temperature
'
or
'
amplitudes
'
.
"
)
raise
ValueError
(
"
Fluctuating LBM: Pass either
'
temperature
'
or
'
amplitudes
'
.
"
)
if
collision_rule
.
method
.
conserved_quantity_computation
.
zero_centered_pdfs
:
raise
ValueError
(
"
The fluctuating LBM is not implemented for zero-centered PDF storage.
"
)
method
=
collision_rule
.
method
method
=
collision_rule
.
method
if
not
amplitudes
:
if
not
amplitudes
:
amplitudes
=
fluctuation_amplitude_from_temperature
(
method
,
temperature
,
c_s_sq
)
amplitudes
=
fluctuation_amplitude_from_temperature
(
method
,
temperature
,
c_s_sq
)
...
@@ -44,9 +42,7 @@ def fluctuation_amplitude_from_temperature(method, temperature, c_s_sq=sp.Symbol
...
@@ -44,9 +42,7 @@ def fluctuation_amplitude_from_temperature(method, temperature, c_s_sq=sp.Symbol
"""
Produces amplitude equations according to (2.60) and (3.54) in Schiller08
"""
"""
Produces amplitude equations according to (2.60) and (3.54) in Schiller08
"""
normalization_factors
=
sp
.
matrix_multiply_elementwise
(
method
.
moment_matrix
,
method
.
moment_matrix
)
*
\
normalization_factors
=
sp
.
matrix_multiply_elementwise
(
method
.
moment_matrix
,
method
.
moment_matrix
)
*
\
sp
.
Matrix
(
method
.
weights
)
sp
.
Matrix
(
method
.
weights
)
density
=
method
.
zeroth_order_equilibrium_moment_symbol
density
=
method
.
_cqc
.
density_symbol
if
method
.
conserved_quantity_computation
.
zero_centered_pdfs
:
density
+=
1
mu
=
temperature
*
density
/
c_s_sq
mu
=
temperature
*
density
/
c_s_sq
return
[
sp
.
sqrt
(
mu
*
norm
*
(
1
-
(
1
-
rr
)
**
2
))
return
[
sp
.
sqrt
(
mu
*
norm
*
(
1
-
(
1
-
rr
)
**
2
))
for
norm
,
rr
in
zip
(
normalization_factors
,
method
.
relaxation_rates
)]
for
norm
,
rr
in
zip
(
normalization_factors
,
method
.
relaxation_rates
)]
...
...
This diff is collapsed.
Click to expand it.
tests/test_fluctuating_lb.py
+
262
−
131
View file @
d7e91b4c
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment