Skip to content
Snippets Groups Projects
Commit ff76158c authored by Markus Holzer's avatar Markus Holzer
Browse files

Adapted doc strings

parent 61cdfc98
No related branches found
No related tags found
1 merge request!98Generalisation of Relaxation rate setter
...@@ -65,7 +65,7 @@ def create_with_discrete_maxwellian_eq_moments(stencil, moment_to_relaxation_rat ...@@ -65,7 +65,7 @@ def create_with_discrete_maxwellian_eq_moments(stencil, moment_to_relaxation_rat
:class:`lbmpy.methods.momentbased.CentralMomentBasedLbMethod` :class:`lbmpy.methods.momentbased.CentralMomentBasedLbMethod`
""" """
mom_to_rr_dict = OrderedDict(moment_to_relaxation_rate_dict) 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" "The number of moments has to be the same as the number of stencil entries"
density_velocity_computation = DensityVelocityComputation(stencil, compressible, force_model) density_velocity_computation = DensityVelocityComputation(stencil, compressible, force_model)
...@@ -100,7 +100,7 @@ def create_with_continuous_maxwellian_eq_moments(stencil, moment_to_relaxation_r ...@@ -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. By using the continuous Maxwellian we automatically get a compressible model.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
moment_to_relaxation_rate_dict: dict that has as many entries as the stencil. Each moment, which can be 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 represented by an exponent tuple or in polynomial form
(see `lbmpy.moments`), is mapped to a relaxation rate. (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 ...@@ -159,7 +159,7 @@ def create_generic_mrt(stencil, moment_eq_value_relaxation_rate_tuples, compress
Creates a generic moment-based LB method. Creates a generic moment-based LB method.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
moment_eq_value_relaxation_rate_tuples: sequence of tuples containing (moment, equilibrium value, relax. rate) moment_eq_value_relaxation_rate_tuples: sequence of tuples containing (moment, equilibrium value, relax. rate)
compressible: compressibility, determines calculation of velocity for force models compressible: compressibility, determines calculation of velocity for force models
force_model: see create_with_discrete_maxwellian_eq_moments force_model: see create_with_discrete_maxwellian_eq_moments
...@@ -181,7 +181,7 @@ def create_from_equilibrium(stencil, equilibrium, moment_to_relaxation_rate_dict ...@@ -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 Creates a moment-based LB method using a given equilibrium distribution function
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
equilibrium: list of equilibrium terms, dependent on rho and u, one for each stencil direction 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 moment_to_relaxation_rate_dict: relaxation rate for each moment, or a symbol/float if all should relaxed with
the same rate the same rate
...@@ -209,7 +209,7 @@ def create_srt(stencil, relaxation_rate, maxwellian_moments=False, **kwargs): ...@@ -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. r"""Creates a single relaxation time (SRT) lattice Boltzmann model also known as BGK model.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rate: relaxation rate (inverse of the relaxation time) relaxation_rate: relaxation rate (inverse of the relaxation time)
usually called :math:`\omega` in LBM literature usually called :math:`\omega` in LBM literature
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is 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 ...@@ -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` For possible parameters see :func:`lbmpy.methods.create_trt`
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rate: relaxation rate (inverse of the relaxation time) relaxation_rate: relaxation rate (inverse of the relaxation time)
usually called :math:`\omega` in LBM literature usually called :math:`\omega` in LBM literature
magic_number: magic number which is used to calculate the relxation rate for the odd moments. 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 ...@@ -271,7 +271,7 @@ def create_mrt_raw(stencil, relaxation_rates, maxwellian_moments=False, **kwargs
Creates a MRT method using non-orthogonalized moments. Creates a MRT method using non-orthogonalized moments.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
used to compute the equilibrium moments. used to compute the equilibrium moments.
...@@ -293,7 +293,7 @@ def create_central_moment(stencil, relaxation_rates, nested_moments=None, ...@@ -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. Creates moment based LB method where the collision takes place in the central moment space.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rates: relaxation rates (inverse of the relaxation times) for each moment 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. nested_moments: a list of lists of modes, grouped by common relaxation times.
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is 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 ...@@ -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` To create a generic MRT method use `create_with_discrete_maxwellian_eq_moments`
Args: Args:
stencil: instance of :class: `LBStencil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rates: relaxation rates for the moments relaxation_rates: relaxation rates for the moments
maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is maxwellian_moments: determines if the discrete or continuous maxwellian equilibrium is
used to compute the equilibrium moments used to compute the equilibrium moments
...@@ -457,7 +457,7 @@ def create_centered_cumulant_model(stencil, cumulant_to_rr_dict, force_model=Non ...@@ -457,7 +457,7 @@ def create_centered_cumulant_model(stencil, cumulant_to_rr_dict, force_model=Non
r"""Creates a cumulant lattice Boltzmann model. r"""Creates a cumulant lattice Boltzmann model.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
cumulant_to_rr_dict: dict that has as many entries as the stencil. Each cumulant, which can be 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. 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` 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, ...@@ -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. r"""Creates a cumulant lattice Boltzmann model based on a default polynomial set.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rates: relaxation rates for each cumulant group. If None are provided a list of symbolic relaxation 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 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. 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): ...@@ -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. r"""Creates a cumulant lattice Boltzmann model based on a default polinomial set.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
relaxation_rates: relaxation rates for each cumulant group. If None are provided a list of symbolic relaxation 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 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. 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): ...@@ -609,7 +609,7 @@ def _get_relaxation_info_dict(relaxation_rates, nested_moments, dim):
else: else:
result[moment] = 1 result[moment] = 1
# is relaxation rate for each moment is specified they are all used # if relaxation rate for each moment is specified they are all used
if len(relaxation_rates) == number_of_moments: if len(relaxation_rates) == number_of_moments:
rr_iter = iter(relaxation_rates) rr_iter = iter(relaxation_rates)
for group in nested_moments: for group in nested_moments:
......
...@@ -144,7 +144,7 @@ def mrt_orthogonal_modes_literature(stencil, is_weighted): ...@@ -144,7 +144,7 @@ def mrt_orthogonal_modes_literature(stencil, is_weighted):
This is for commonly used MRT models found in literature. This is for commonly used MRT models found in literature.
Args: Args:
stencil: instance of :class:`lbmpy.stencils.LBStenil` stencil: instance of :class:`lbmpy.stencils.LBStencil`
is_weighted: whether to use weighted or unweighted orthogonality is_weighted: whether to use weighted or unweighted orthogonality
MRT schemes as described in the following references are used MRT schemes as described in the following references are used
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
import pystencils as ps import pystencils as ps
from lbmpy.creationfunctions import * from lbmpy.creationfunctions import *
from lbmpy.enums import Stencil
from lbmpy.forcemodels import Guo from lbmpy.forcemodels import Guo
from lbmpy.macroscopic_value_kernels import macroscopic_values_setter from lbmpy.macroscopic_value_kernels import macroscopic_values_setter
import numpy as np import numpy as np
from lbmpy.moments import is_bulk_moment, is_shear_moment, get_order from lbmpy.moments import is_bulk_moment, is_shear_moment, get_order
from lbmpy.stencils import get_stencil from lbmpy.stencils import LBStencil
from pystencils.rng import PhiloxTwoDoubles from pystencils.rng import PhiloxTwoDoubles
import pytest import pytest
...@@ -64,7 +65,7 @@ def add_pressure_output_to_collision_rule(collision_rule, pressure_field): ...@@ -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, 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): rho_0=None, target=None):
# Parameters # Parameters
stencil = get_stencil('D3Q19') stencil = LBStencil(Stencil.D3Q19)
# Setup data handling # Setup data handling
dh = ps.create_data_handling( dh = ps.create_data_handling(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment