pylbm.domain.
Domain
(dico, need_validation=True)¶Create a domain that defines the fluid part and the solid part and computes the distances between these two states.
that contains the following key:value
box : a dictionary that defines the computational box
- elementsthe 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
we only need the velocities to define a domain
boolean to specify if the dictionary has to be validated (optional)
Warning
the sizes of the box must be a multiple of the space step dx
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.
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
Examples
>>> dico = {'box': {'x': [0, 1], 'label': 0},
... 'space_step': 0.1,
... 'schemes': [{'velocities': list(range(3))}],
... }
>>> dom = Domain(dico)
>>> dom
+--------------------+
| Domain information |
+--------------------+
- spatial dimension: 1
- space step: 0.1
- with halo:
bounds of the box: [-0.05] x [1.05]
number of points: [12]
- without halo:
bounds of the box: [0.05] x [0.95]
number of points: [10]
<BLANKLINE>
+----------------------+
| Geometry information |
+----------------------+
- spatial dimension: 1
- bounds of the box: [0. 1.]
>>> dico = {'box': {'x': [0, 1], 'y': [0, 1], 'label': [0, 0, 1, 1]},
... 'space_step': 0.1,
... 'schemes': [{'velocities': list(range(9))},
... {'velocities': list(range(5))}
... ],
... }
>>> dom = Domain(dico)
>>> dom
+--------------------+
| Domain information |
+--------------------+
- spatial dimension: 2
- space step: 0.1
- with halo:
bounds of the box: [-0.05 -0.05] x [1.05 1.05]
number of points: [12, 12]
- without halo:
bounds of the box: [0.05 0.05] x [0.95 0.95]
number of points: [10, 10]
<BLANKLINE>
+----------------------+
| Geometry information |
+----------------------+
- spatial dimension: 2
- bounds of the box: [0. 1.] x [0. 1.]
see demo/examples/domain/
number of spatial dimensions (example: 1, 2, or 3)
the bounds of the box in each spatial direction
the local bounds of the process in each spatial direction
space step (example: 0.1, 1.e-3)
type of data (example: ‘float64’)
the stencil of the velocities (object of the class
Stencil
)
number of points in each direction
number of points to add on each side (max velocities)
coordinates of the domain
x
ndarrayx component of the coordinates in the interior domain.
y
ndarrayy component of the coordinates in the interior domain.
z
ndarrayz component of the coordinates in the interior domain.
defines the fluid and the solid part (fluid: value=valin, solid: value=valout)
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.
NumPy array that defines the flag of the border reached with the specified velocity
value in the fluid domain
value in the fluid domain
x_halo
ndarrayx component of the coordinates of the whole domain
y_halo
ndarrayy component of the coordinates of the whole domain
z_halo
ndarrayz component of the coordinates of the whole domain
shape_halo
listshape of the whole domain with the halo points.
shape_in
shape of the interior domain.
Methods
|
Create the mpi topology |
|
Create the coordinates of the interior domain and the whole domain with halo points. |
|
Return the coordinates of the bottom right and upper left corner of the interior domain. |
|
Return the coordinates of the bottom right and upper left corner of the whole domain with halo points. |
|
Get the list of all the labels used in the geometry. |
|
Visualize the domain by creating a plot. |