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
Markus Holzer
lbmpy
Commits
ff76158c
Commit
ff76158c
authored
Oct 18, 2021
by
Markus Holzer
Browse files
Adapted doc strings
parent
61cdfc98
Pipeline
#34855
failed with stages
in 26 minutes and 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lbmpy/methods/creationfunctions.py
View file @
ff76158c
...
...
@@ -65,7 +65,7 @@ def create_with_discrete_maxwellian_eq_moments(stencil, moment_to_relaxation_rat
:class:`lbmpy.methods.momentbased.CentralMomentBasedLbMethod`
"""
mom_to_rr_dict
=
OrderedDict
(
moment_to_relaxation_rate_dict
)
assert
len
(
mom_to_rr_dict
)
==
len
(
stencil
)
,
\
assert
len
(
mom_to_rr_dict
)
==
stencil
.
Q
,
\
"The number of moments has to be the same as the number of stencil entries"
density_velocity_computation
=
DensityVelocityComputation
(
stencil
,
compressible
,
force_model
)
...
...
@@ -100,7 +100,7 @@ def create_with_continuous_maxwellian_eq_moments(stencil, moment_to_relaxation_r
By using the continuous Maxwellian we automatically get a compressible model.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
moment_to_relaxation_rate_dict: dict that has as many entries as the stencil. Each moment, which can be
represented by an exponent tuple or in polynomial form
(see `lbmpy.moments`), is mapped to a relaxation rate.
...
...
@@ -159,7 +159,7 @@ def create_generic_mrt(stencil, moment_eq_value_relaxation_rate_tuples, compress
Creates a generic moment-based LB method.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
moment_eq_value_relaxation_rate_tuples: sequence of tuples containing (moment, equilibrium value, relax. rate)
compressible: compressibility, determines calculation of velocity for force models
force_model: see create_with_discrete_maxwellian_eq_moments
...
...
@@ -181,7 +181,7 @@ def create_from_equilibrium(stencil, equilibrium, moment_to_relaxation_rate_dict
Creates a moment-based LB method using a given equilibrium distribution function
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
equilibrium: list of equilibrium terms, dependent on rho and u, one for each stencil direction
moment_to_relaxation_rate_dict: relaxation rate for each moment, or a symbol/float if all should relaxed with
the same rate
...
...
@@ -209,7 +209,7 @@ def create_srt(stencil, relaxation_rate, maxwellian_moments=False, **kwargs):
r
"""Creates a single relaxation time (SRT) lattice Boltzmann model also known as BGK model.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
relaxation_rate: relaxation rate (inverse of the relaxation time)
usually called :math:`\omega` in LBM literature
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
...
...
@@ -253,7 +253,7 @@ def create_trt_with_magic_number(stencil, relaxation_rate, magic_number=sp.Ratio
For possible parameters see :func:`lbmpy.methods.create_trt`
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
relaxation_rate: relaxation rate (inverse of the relaxation time)
usually called :math:`\omega` in LBM literature
magic_number: magic number which is used to calculate the relxation rate for the odd moments.
...
...
@@ -271,7 +271,7 @@ def create_mrt_raw(stencil, relaxation_rates, maxwellian_moments=False, **kwargs
Creates a MRT method using non-orthogonalized moments.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
used to compute the equilibrium moments.
...
...
@@ -293,7 +293,7 @@ def create_central_moment(stencil, relaxation_rates, nested_moments=None,
Creates moment based LB method where the collision takes place in the central moment space.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment
nested_moments: a list of lists of modes, grouped by common relaxation times.
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
...
...
@@ -402,7 +402,7 @@ def create_mrt_orthogonal(stencil, relaxation_rates, maxwellian_moments=False, w
To create a generic MRT method use `create_with_discrete_maxwellian_eq_moments`
Args:
stencil: instance of :class:
`LBStencil`
stencil: instance of :class:`
lbmpy.stencils.
LBStencil`
relaxation_rates: relaxation rates for the moments
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
used to compute the equilibrium moments
...
...
@@ -457,7 +457,7 @@ def create_centered_cumulant_model(stencil, cumulant_to_rr_dict, force_model=Non
r
"""Creates a cumulant lattice Boltzmann model.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
cumulant_to_rr_dict: dict that has as many entries as the stencil. Each cumulant, which can be
represented by an exponent tuple or in polynomial form is mapped to a relaxation rate.
See :func:`lbmpy.methods.default_moment_sets.cascaded_moment_sets_literature`
...
...
@@ -513,7 +513,7 @@ def create_with_polynomial_cumulants(stencil, relaxation_rates, cumulant_groups,
r
"""Creates a cumulant lattice Boltzmann model based on a default polynomial set.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
relaxation_rates: relaxation rates for each cumulant group. If None are provided a list of symbolic relaxation
rates is created and used. If only a list with one entry is provided this relaxation rate is
used for determine the viscosity of the simulation. All other cumulants are relaxed with one.
...
...
@@ -534,7 +534,7 @@ def create_with_monomial_cumulants(stencil, relaxation_rates, **kwargs):
r
"""Creates a cumulant lattice Boltzmann model based on a default polinomial set.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
relaxation_rates: relaxation rates for each cumulant group. If None are provided a list of symbolic relaxation
rates is created and used. If only a list with one entry is provided this relaxation rate is
used for determine the viscosity of the simulation. All other cumulants are relaxed with one.
...
...
@@ -609,7 +609,7 @@ def _get_relaxation_info_dict(relaxation_rates, nested_moments, dim):
else
:
result
[
moment
]
=
1
# i
s
relaxation rate for each moment is specified they are all used
# i
f
relaxation rate for each moment is specified they are all used
if
len
(
relaxation_rates
)
==
number_of_moments
:
rr_iter
=
iter
(
relaxation_rates
)
for
group
in
nested_moments
:
...
...
lbmpy/methods/default_moment_sets.py
View file @
ff76158c
...
...
@@ -144,7 +144,7 @@ def mrt_orthogonal_modes_literature(stencil, is_weighted):
This is for commonly used MRT models found in literature.
Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil`
stencil: instance of :class:`lbmpy.stencils.LBSten
c
il`
is_weighted: whether to use weighted or unweighted orthogonality
MRT schemes as described in the following references are used
...
...
lbmpy_tests/test_fluctuating_lb.py
View file @
ff76158c
...
...
@@ -2,11 +2,12 @@
import
pystencils
as
ps
from
lbmpy.creationfunctions
import
*
from
lbmpy.enums
import
Stencil
from
lbmpy.forcemodels
import
Guo
from
lbmpy.macroscopic_value_kernels
import
macroscopic_values_setter
import
numpy
as
np
from
lbmpy.moments
import
is_bulk_moment
,
is_shear_moment
,
get_order
from
lbmpy.stencils
import
get_s
tencil
from
lbmpy.stencils
import
LBS
tencil
from
pystencils.rng
import
PhiloxTwoDoubles
import
pytest
...
...
@@ -64,7 +65,7 @@ def add_pressure_output_to_collision_rule(collision_rule, pressure_field):
def
get_fluctuating_lb
(
size
=
None
,
kT
=
None
,
omega_shear
=
None
,
omega_bulk
=
None
,
omega_odd
=
None
,
omega_even
=
None
,
rho_0
=
None
,
target
=
None
):
# Parameters
stencil
=
get_s
tencil
(
'
D3Q19
'
)
stencil
=
LBS
tencil
(
Stencil
.
D3Q19
)
# Setup data handling
dh
=
ps
.
create_data_handling
(
...
...
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