pylbm.Domain

class pylbm.Domain(dico=None, geometry=None, stencil=None, space_step=None, verif=True)

Create a domain that defines the fluid part and the solid part and computes the distances between these two states.

Parameters

dico (a dictionary that contains the following key:value) –

  • box : a dictionary that defines the computational box

  • elements : the list of the elements (available elements are given in the module elements)

  • space_step : the spatial step

  • schemes : a list of dictionaries, each of them defining a elementary Scheme

Notes

The dictionary that defines the box should contains the following key:value

  • x : a list of the bounds in the first direction

  • y : a list of the bounds in the second direction (optional)

  • z : a list of the bounds in the third direction (optional)

  • label : an integer or a list of integers (length twice the number of dimensions) used to label each edge (optional)

See Geometry for more details.

If the geometry and/or the stencil were previously generated, it can be used directly as following

>>> Domain(dico, geometry = geom, stencil = sten)

where geom is an object of the class Geometry and sten an object of the class Stencil In that case, dico does not need to contain the informations for generate the geometry and/or the stencil

In 1D, distance[q, i] is the distance between the point x[i] and the border in the direction of the qth velocity.

In 2D, distance[q, j, i] is the distance between the point (x[i], y[j]) and the border in the direction of qth velocity

In 3D, distance[q, k, j, i] is the distance between the point (x[i], y[j], z[k]) and the border in the direction of qth velocity

In 1D, flag[q, i] is the flag of the border reached by the point x[i] in the direction of the qth velocity

In 2D, flag[q, j, i] is the flag of the border reached by the point (x[i], y[j]) in the direction of qth velocity

In 2D, flag[q, k, j, i] is the flag of the border reached by the point (x[i], y[j], z[k]) in the direction of qth velocity

Warning

the sizes of the box must be a multiple of the space step dx

dim

number of spatial dimensions (example: 1, 2, or 3)

Type

int

globalbounds

the bounds of the box in each spatial direction

Type

numpy array

bounds

the local bounds of the process in each spatial direction

Type

numpy array

dx

space step (example: 0.1, 1.e-3)

Type

double

type

type of data (example: ‘float64’)

Type

string

stencil

the stencil of the velocities (object of the class Stencil)

global_size

number of points in each direction

Type

list of int

extent

number of points to add on each side (max velocities)

Type

list of int

coords

coordinates of the domain

Type

numpy array

x

first coordinate of the domain

Type

numpy array

y

second coordinate of the domain (None if dim<2)

Type

numpy array

z

third coordinate of the domain (None if dim<3)

Type

numpy array

in_or_out

defines the fluid and the solid part (fluid: value=valin, solid: value=valout)

Type

numpy array

distance

defines the distances to the borders. The distance is scaled by dx and is not equal to valin only for the points that reach the border with the specified velocity.

Type

numpy array

flag

NumPy array that defines the flag of the border reached with the specified velocity

Type

numpy array

valin

value in the fluid domain

Type

int

valout

value in the fluid domain

Type

int

x_halo
y_halo
z_halo
shape_halo
shape_in

Examples

see demo/examples/domain/

__init__(dico=None, geometry=None, stencil=None, space_step=None, verif=True)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([dico, geometry, stencil, …])

Initialize self.

check_dictionary(dico)

Check the validity of the dictionnary which define the domain.

construct_mpi_topology(dico)

Create the mpi topology

create_coords()

Create the coordinates of the interior domain and the whole domain with halo points.

get_bounds()

Return the coordinates of the bottom right and upper left corner of the interior domain.

get_bounds_halo()

Return the coordinates of the bottom right and upper left corner of the whole domain with halo points.

list_of_labels()

Get the list of all the labels used in the geometry.

visualize([viewer_app, view_distance, …])

Visualize the domain by creating a plot.

Attributes

shape_halo

shape of the whole domain with the halo points.

shape_in

shape of the interior domain.

x

x component of the coordinates in the interior domain.

x_halo

x component of the coordinates of the whole domain (halo points included).

y

y component of the coordinates in the interior domain.

y_halo

y component of the coordinates of the whole domain (halo points included).

z

z component of the coordinates in the interior domain.

z_halo

z component of the coordinates of the whole domain (halo points included).