diff --git a/lbmpy/methods/creationfunctions.py b/lbmpy/methods/creationfunctions.py index cf11abd94243e90d32607361b371f2c52acd8053..e6963aaeab332fba07ebde1e9ed663d883ed03e6 100644 --- a/lbmpy/methods/creationfunctions.py +++ b/lbmpy/methods/creationfunctions.py @@ -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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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.LBStencil` 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 - # 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: rr_iter = iter(relaxation_rates) for group in nested_moments: diff --git a/lbmpy/methods/default_moment_sets.py b/lbmpy/methods/default_moment_sets.py index ae7ada6a53be4c869423c90be0925cbb64952961..02e397c06c5b391a1d495803c588fb29da960f5c 100644 --- a/lbmpy/methods/default_moment_sets.py +++ b/lbmpy/methods/default_moment_sets.py @@ -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.LBStencil` is_weighted: whether to use weighted or unweighted orthogonality MRT schemes as described in the following references are used diff --git a/lbmpy_tests/test_fluctuating_lb.py b/lbmpy_tests/test_fluctuating_lb.py index 31fef9df0741de4ce8fde4a84af140feb58c6cfb..b531690303d4f9cb9df23105253eec8443f25338 100644 --- a/lbmpy_tests/test_fluctuating_lb.py +++ b/lbmpy_tests/test_fluctuating_lb.py @@ -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_stencil +from lbmpy.stencils import LBStencil 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_stencil('D3Q19') + stencil = LBStencil(Stencil.D3Q19) # Setup data handling dh = ps.create_data_handling(