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
ee978956
Commit
ee978956
authored
6 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Removed warnings in tests
parent
cb64d1b5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
maxwellian_equilibrium.py
+8
-7
8 additions, 7 deletions
maxwellian_equilibrium.py
quadratic_equilibrium_construction.py
+2
-1
2 additions, 1 deletion
quadratic_equilibrium_construction.py
with
10 additions
and
8 deletions
maxwellian_equilibrium.py
+
8
−
7
View file @
ee978956
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
quadratic_equilibrium_construction.py
+
2
−
1
View file @
ee978956
...
@@ -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
'
)]
...
...
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