Exemplo n.º 1
0
             (0.45, 0.3), (0, 0.4), (0.1, 0),
             label=2, isfluid=True
         ),
     ],
     'space_step': 0.025,
     'schemes': [
         {
             'velocities': list(range(9))
         }
     ],
 },
 {
     'box': {'x': [-3, 3], 'y': [-3, 3], 'z': [-3, 3], 'label': 0},
     'elements': [
         pylbm.CylinderEllipse(
             [0.5, 0, 0], [0, 1, 1], [0, -1.5, 1.5], [1, -1, 0],
             label=[1, 2, 3]
         )
     ],
     'space_step': .5,
     'schemes': [{'velocities': list(range(19))}]
 },
 {
     'box': {
         'x': [0, 3],
         'y': [0, 3],
         'z': [0, 3],
         'label': list(range(1, 7))
     },
     'elements': [
         pylbm.Ellipsoid(
             (1.5, 1.5, 1.5),
Exemplo n.º 2
0
#
# License: BSD 3 clause
"""
pylbm: tests for the geometry
"""

import pytest
import pylbm

ELEMENTS = [
    [2, pylbm.Circle([0, 0], 1)],
    [2, pylbm.Ellipse([0, 0], [1, 0], [0, 1])],
    [2, pylbm.Triangle([-1, -1], [0, 2], [2, 0])],
    [2, pylbm.Parallelogram([-1, -1], [0, 2], [2, 0])],
    [3, pylbm.CylinderCircle([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.CylinderEllipse([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.CylinderTriangle([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.Parallelepiped([-1, -1, -1], [2, 0, 0], [0, 2, 0], [0, 0, 2])],
    [3, pylbm.Ellipsoid([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1])],
    [3, pylbm.Sphere([0, 0, 0], 1)],
]


@pytest.fixture(params=ELEMENTS,
                ids=[elem[1].__class__.__name__ for elem in ELEMENTS])
def get_element(request):
    """get one element of the geometry"""
    return request.param


BOX = [
Exemplo n.º 3
0
the cube [-3, 3] x [-3, 3] x [-3, 3] with a cylindrical hole
"""
import pylbm

V1 = [0, 1., 1.]
V2 = [0, -1.5, 1.5]
V3 = [1, 0, 0]
D_DOM = {
    'box': {
        'x': [-3, 3],
        'y': [-3, 3],
        'z': [-3, 3],
        'label': 0
    },
    'elements':
    [pylbm.CylinderEllipse((0.5, 0, 0), V1, V2, V3, label=[1, 2, 3])],
    'space_step': 1,
    'schemes': [{
        'velocities': list(range(19))
    }]
}
DOMAIN = pylbm.Domain(D_DOM)
print(DOMAIN)
DOMAIN.visualize(view_distance=False,
                 view_in=False,
                 view_out=False,
                 view_bound=True,
                 view_geom=True,
                 label=[1, 2, 3])
DOMAIN.visualize(view_distance=False,
                 view_in=False,
Exemplo n.º 4
0
"""
Example of a 3D domain: the cube [0,1] x [0,1] x [0,1] with a cylindrical hole
"""
from six.moves import range
import pylbm

v1 = [0, 1., 1.]
v2 = [0, -1.5, 1.5]
v3 = [1, -1, 0]
dico = {
    'box': {
        'x': [-3, 3],
        'y': [-3, 3],
        'z': [-3, 3],
        'label': 0
    },
    'elements':
    [pylbm.CylinderEllipse((0.5, 0, 0), v1, v2, v3, label=[1, 2, 3])],
    'space_step': .5,
    'schemes': [{
        'velocities': list(range(19))
    }]
}
dom = pylbm.Domain(dico)
print(dom)
dom.visualize(view_distance=False,
              view_in=False,
              view_out=False,
              view_bound=True,
              label=[1, 2, 3])