From 98350acd799faf3bbd8deadbffc832b2bd4fae23 Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Sun, 29 Apr 2018 13:40:14 +0200 Subject: [PATCH] Extended scaling tutorial & more documentation cleanup --- creationfunctions.py | 4 ++-- cumulants.py | 6 +++--- forcemodels.py | 2 +- geometry.py | 7 +++++++ maxwellian_equilibrium.py | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/creationfunctions.py b/creationfunctions.py index 15cf5e5a..4d16aab1 100644 --- a/creationfunctions.py +++ b/creationfunctions.py @@ -11,7 +11,7 @@ General: - ``stencil='D2Q9'``: stencil name e.g. 'D2Q9', 'D3Q19'. See :func:`pystencils.stencils.get_stencil` for details - ``method='srt'``: name of lattice Boltzmann method. This determines the selection and relaxation pattern of - moments/cumulants, i.e. which moment/cumulant basis is chosen, and which of the basis vectors are relaxed together + moments/cumulants, i.e. which moment/cumulant basis is chosen, and which of the basis vectors are relaxed together - ``srt``: single relaxation time (:func:`lbmpy.methods.create_srt`) - ``trt``: two relaxation time, first relaxation rate is for even moments and determines the viscosity (as in SRT), the second relaxation rate is used for relaxing odd moments, and controls the bulk viscosity. @@ -66,7 +66,7 @@ Entropic methods: LES methods: -- ``smagorinsky=False``: set to Smagorinsky constant to activate turbulence model, `omega_output_field` can be set to +- ``smagorinsky=False``: set to Smagorinsky constant to activate turbulence model, 'omega_output_field' can be set to write out adapted relaxation rates diff --git a/cumulants.py b/cumulants.py index 049d0244..ef241e81 100644 --- a/cumulants.py +++ b/cumulants.py @@ -146,10 +146,10 @@ def cumulants_from_pdfs(stencil, cumulant_indices=None, pdf_symbols=None): """Transformation of pdfs (or other discrete function on a stencil) to cumulant space. Args: - stencil: + stencil: stencil object cumulant_indices: sequence of cumulant indices, could be tuples or polynomial representation - if left to default and a full stencil was passed, - the full set i.e. `moments_up_to_component_order(2)` is used + if left to default and a full stencil was passed, + the full set i.e. `moments_up_to_component_order` with 'order=2' is used pdf_symbols: symbolic values for pdf values, if not passed they default to :math:`f_0, f_1, ...` Returns: diff --git a/forcemodels.py b/forcemodels.py index 3cdbf5ad..5b65b271 100644 --- a/forcemodels.py +++ b/forcemodels.py @@ -4,7 +4,7 @@ r""" Get started: ------------ +------------ This module offers different models to introduce a body force in the lattice Boltzmann scheme. If you don't know which model to choose, use :class:`lbmpy.forcemodels.Guo`. diff --git a/geometry.py b/geometry.py index 87f2fe05..5d8bf228 100644 --- a/geometry.py +++ b/geometry.py @@ -26,6 +26,13 @@ def add_box_boundary(boundary_handling, boundary=NoSlip(), replace=True): return flag +def add_sphere(boundary_handling, midpoint, radius, boundary=NoSlip(), replace=True): + """Sets boundary in spherical region.""" + def set_sphere(x, y): + return (x - midpoint[0]) ** 2 + (y - midpoint[1]) ** 2 < radius ** 2 + return boundary_handling.set_boundary(boundary, mask_callback=set_sphere, replace=replace) + + def add_pipe_inflow_boundary(boundary_handling, u_max, slice_obj, flow_direction=0, diameter=None): """Adds velocity inflow UBB boundary for pipe flow. diff --git a/maxwellian_equilibrium.py b/maxwellian_equilibrium.py index 7ac36b59..e5d958a5 100644 --- a/maxwellian_equilibrium.py +++ b/maxwellian_equilibrium.py @@ -57,7 +57,7 @@ def discrete_maxwellian_equilibrium(stencil, rho=sp.Symbol("rho"), u=tuple(sp.sy :param stencil: tuple of directions :param rho: sympy symbol for the density - :param u: symbols for macroscopic velocity, only the first `dim` entries are used + :param u: symbols for macroscopic velocity, only the first 'dim' entries are used :param order: highest order of velocity terms (for hydrodynamics order 2 is sufficient) :param c_s_sq: square of speed of sound :param compressible: compressibility -- GitLab