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
6cf5eab3
Commit
6cf5eab3
authored
5 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation
parent
eb7c6efb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lbmpy/continuous_distribution_measures.py
+8
-6
8 additions, 6 deletions
lbmpy/continuous_distribution_measures.py
lbmpy/cumulants.py
+1
-1
1 addition, 1 deletion
lbmpy/cumulants.py
lbmpy/maxwellian_equilibrium.py
+18
-0
18 additions, 0 deletions
lbmpy/maxwellian_equilibrium.py
with
27 additions
and
7 deletions
lbmpy/continuous_distribution_measures.py
+
8
−
6
View file @
6cf5eab3
...
@@ -69,9 +69,10 @@ def multi_differentiation(generating_function, index, symbols):
...
@@ -69,9 +69,10 @@ def multi_differentiation(generating_function, index, symbols):
Computes moment from moment-generating function or cumulant from cumulant-generating function,
Computes moment from moment-generating function or cumulant from cumulant-generating function,
by differentiating the generating function, as specified by index and evaluating the derivative at symbols=0
by differentiating the generating function, as specified by index and evaluating the derivative at symbols=0
:param generating_function: function with is differentiated
Args:
:param index: the i
'
th index specifies how often to differentiate w.r.t. to symbols[i]
generating_function: function with is differentiated
:param symbols: symbol to differentiate
index: the i
'
th index specifies how often to differentiate w.r.t. to symbols[i]
symbols: symbol to differentiate
"""
"""
assert
len
(
index
)
==
len
(
symbols
),
"
Length of index and length of symbols has to match
"
assert
len
(
index
)
==
len
(
symbols
),
"
Length of index and length of symbols has to match
"
...
@@ -119,9 +120,10 @@ def __continuous_moment_or_cumulant(func, moment, symbols, generating_function):
...
@@ -119,9 +120,10 @@ def __continuous_moment_or_cumulant(func, moment, symbols, generating_function):
def
continuous_moment
(
func
,
moment
,
symbols
=
None
):
def
continuous_moment
(
func
,
moment
,
symbols
=
None
):
"""
Computes moment of given function.
"""
Computes moment of given function.
:param func: function to compute moments of
Args:
:param moment: tuple or polynomial describing the moment
func: function to compute moments of
:param symbols: if moment is given as polynomial, pass the moment symbols, i.e. the dof of the polynomial
moment: tuple or polynomial describing the moment
symbols: if moment is given as polynomial, pass the moment symbols, i.e. the dof of the polynomial
"""
"""
return
__continuous_moment_or_cumulant
(
func
,
moment
,
symbols
,
moment_generating_function
)
return
__continuous_moment_or_cumulant
(
func
,
moment
,
symbols
,
moment_generating_function
)
...
...
This diff is collapsed.
Click to expand it.
lbmpy/cumulants.py
+
1
−
1
View file @
6cf5eab3
...
@@ -43,7 +43,7 @@ def __partition(collection):
...
@@ -43,7 +43,7 @@ def __partition(collection):
def
__cumulant_raw_moment_transform
(
index
,
dependent_var_dict
,
outer_function
,
default_prefix
,
centralized
):
def
__cumulant_raw_moment_transform
(
index
,
dependent_var_dict
,
outer_function
,
default_prefix
,
centralized
):
"""
Function to express cumulants as function of moments a
s
vice versa.
"""
Function to express cumulants as function of moments a
nd
vice versa.
Uses multivariate version of Faa di Bruno
'
s formula.
Uses multivariate version of Faa di Bruno
'
s formula.
...
...
This diff is collapsed.
Click to expand it.
lbmpy/maxwellian_equilibrium.py
+
18
−
0
View file @
6cf5eab3
...
@@ -199,6 +199,24 @@ def get_moments_of_discrete_maxwellian_equilibrium(stencil, moments,
...
@@ -199,6 +199,24 @@ def get_moments_of_discrete_maxwellian_equilibrium(stencil, moments,
def
compressible_to_incompressible_moment_value
(
term
,
rho
,
u
):
def
compressible_to_incompressible_moment_value
(
term
,
rho
,
u
):
"""
Compressible to incompressible equilibrium moments
Transforms so-called compressible equilibrium moments (as obtained from the continuous Maxwellian) by
removing the density factor in all monomials where velocity components are multiplied to the density.
Examples:
>>>
rho
,
*
u
=
sp
.
symbols
(
"
rho u_:2
"
)
>>>
compressible_to_incompressible_moment_value
(
rho
+
rho
*
u
[
0
]
+
rho
*
u
[
0
]
*
u
[
1
],
rho
,
u
)
rho
+
u_0
*
u_1
+
u_0
Args:
term: compressible equilibrium value
rho: symbol for density
u: symbol for velocity
Returns:
incompressible equilibrium value
"""
term
=
sp
.
sympify
(
term
)
term
=
sp
.
sympify
(
term
)
term
=
term
.
expand
()
term
=
term
.
expand
()
if
term
.
func
!=
sp
.
Add
:
if
term
.
func
!=
sp
.
Add
:
...
...
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