Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RudolfWeeber
lbmpy
Commits
6cf5eab3
Commit
6cf5eab3
authored
Jul 26, 2019
by
Martin Bauer
Browse files
Added documentation
parent
eb7c6efb
Changes
3
Hide whitespace changes
Inline
Side-by-side
lbmpy/continuous_distribution_measures.py
View file @
6cf5eab3
...
...
@@ -69,9 +69,10 @@ def multi_differentiation(generating_function, index, symbols):
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
:param generating_function: function with is differentiated
:param index: the i'th index specifies how often to differentiate w.r.t. to symbols[i]
:param symbols: symbol to differentiate
Args:
generating_function: function with is differentiated
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"
...
...
@@ -119,9 +120,10 @@ def __continuous_moment_or_cumulant(func, moment, symbols, generating_function):
def
continuous_moment
(
func
,
moment
,
symbols
=
None
):
"""Computes moment of given function.
:param func: function to compute moments of
:param moment: tuple or polynomial describing the moment
:param symbols: if moment is given as polynomial, pass the moment symbols, i.e. the dof of the polynomial
Args:
func: function to compute moments of
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
)
...
...
lbmpy/cumulants.py
View file @
6cf5eab3
...
...
@@ -43,7 +43,7 @@ def __partition(collection):
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.
...
...
lbmpy/maxwellian_equilibrium.py
View file @
6cf5eab3
...
...
@@ -199,6 +199,24 @@ def get_moments_of_discrete_maxwellian_equilibrium(stencil, moments,
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
=
term
.
expand
()
if
term
.
func
!=
sp
.
Add
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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