Create the stencil of velocities used by the scheme(s).
The numbering of the velocities follows the convention for 1D and 2D.
dim : the value of the spatial dimension (1, 2 or 3)
the key:value velocities
[
{
'velocities': [...]
},
{
'velocities': [...]
},
{
'velocities': [...]
},
...
]
the spatial dimension (1, 2 or 3).
array of all velocities involved in the stencils. Each unique velocity appeared only once.
uvxNumPy arraythe x component of the unique velocities.
uvyNumPy arraythe y component of the unique velocities.
uvzNumPy arraythe z component of the unique velocities.
unumNumPy arraythe numbering of the unique velocities.
vmaxintthe maximal velocity in norm for each spatial direction.
vminintthe minimal velocity in norm for each spatial direction.
vmax_fullintthe maximal velocity in norm for each spatial direction.
the number of elementary stencils.
the number of velocities for each elementary stencil.
list of all the velocities for each elementary stencil.
vxNumPy arrayvx[k] the x component of the velocities for the stencil k.
vyNumPy arrayvy[k] the y component of the velocities for the stencil k.
vzNumPy arrayvz[k] the z component of the velocities for the stencil k.
numNumPy arraynum[k] the numbering of the velocities for the stencil k.
used to obtain the list of the velocities involved in a stencil. For instance, the list for the kth stencil is v[nv_ptr[k]:nv_ptr[k+1]]
unvtotintthe number of unique velocities involved in the stencils.
Methods
|
Append object to the end of the list. |
|
Remove all items from list. |
|
Return a shallow copy of the list. |
|
Return number of occurrences of value. |
|
Extend list by appending elements from the iterable. |
|
Extract the dimension from the dictionary |
|
get all the velocities for all the stencils in one array |
|
get the symmetric velocities. |
|
Return first index of value. |
|
Insert object before index. |
check if all the velocities have their symmetric. |
|
|
Remove and return item at index (default last). |
|
Remove first occurrence of value. |
|
Reverse IN PLACE. |
|
Sort the list in ascending order and return None. |
|
plot the velocities |
Notes
The velocities for each schemes are defined as a Python list.
Examples
>>> s = Stencil({'dim': 1,
... 'schemes':[{'velocities': list(range(9))},],
... })
>>> s
+---------------------+
| Stencil information |
+---------------------+
- spatial dimension: 1
- minimal velocity in each direction: [-4]
- maximal velocity in each direction: [4]
- information for each elementary stencil:
stencil 0
- number of velocities: 9
- velocities
(0: 0)
(1: 1)
(2: -1)
(3: 2)
(4: -2)
(5: 3)
(6: -3)
(7: 4)
(8: -4)
>>> s = Stencil({'dim': 2,
... 'schemes':[
{'velocities': list(range(9))},
... {'velocities': list(range(49))},
... ],
... })
>>> s
+---------------------+
| Stencil information |
+---------------------+
- spatial dimension: 2
- minimal velocity in each direction: [-3 -3]
- maximal velocity in each direction: [3 3]
- information for each elementary stencil:
stencil 0
- number of velocities: 9
- velocities
(0: 0, 0)
(1: 1, 0)
(2: 0, 1)
(3: -1, 0)
(4: 0, -1)
(5: 1, 1)
(6: -1, 1)
(7: -1, -1)
(8: 1, -1)
stencil 1
- number of velocities: 49
- velocities
(0: 0, 0)
(1: 1, 0)
(2: 0, 1)
(3: -1, 0)
(4: 0, -1)
(5: 1, 1)
(6: -1, 1)
(7: -1, -1)
(8: 1, -1)
(9: 2, 0)
(10: 0, 2)
(11: -2, 0)
(12: 0, -2)
(13: 2, 2)
(14: -2, 2)
(15: -2, -2)
(16: 2, -2)
(17: 2, 1)
(18: 1, 2)
(19: -1, 2)
(20: -2, 1)
(21: -2, -1)
(22: -1, -2)
(23: 1, -2)
(24: 2, -1)
(25: 3, 0)
(26: 0, 3)
(27: -3, 0)
(28: 0, -3)
(29: 3, 3)
(30: -3, 3)
(31: -3, -3)
(32: 3, -3)
(33: 3, 1)
(34: 1, 3)
(35: -1, 3)
(36: -3, 1)
(37: -3, -1)
(38: -1, -3)
(39: 1, -3)
(40: 3, -1)
(41: 3, 2)
(42: 2, 3)
(43: -2, 3)
(44: -3, 2)
(45: -3, -2)
(46: -2, -3)
(47: 2, -3)
(48: 3, -2)
get the x component of the unique velocities
>>> s.uvx
array([ 0, 1, 0, -1, 0, 1, -1, -1, 1, 2, 0, -2, 0, 2, -2, -2, 2,
2, 1, -1, -2, -2, -1, 1, 2, 3, 0, -3, 0, 3, -3, -3, 3, 3,
1, -1, -3, -3, -1, 1, 3, 3, 2, -2, -3, -3, -2, 2, 3])
get the y component of the velocity for the second stencil
>>> s.vy[1]
array([ 0, 0, 1, 0, -1, 1, 1, -1, -1, 0, 2, 0, -2, 2, 2, -2, -2,
1, 2, 2, 1, -1, -2, -2, -1, 0, 3, 0, -3, 3, 3, -3, -3, 1,
3, 3, 1, -1, -3, -3, -1, 2, 3, 3, 2, -2, -3, -3, -2])
Attributes
|
num[k] the numbering of the velocities for the stencil k. |
|
the numbering of the unique velocities. |
|
the number of unique velocities involved in the stencils. |
|
the x component of the unique velocities. |
|
the y component of the unique velocities. |
|
the z component of the unique velocities. |
|
the maximal velocity in norm for each spatial direction. |
|
the maximal velocity in norm for each spatial direction. |
|
the minimal velocity in norm for each spatial direction. |
|
vx[k] the x component of the velocities for the stencil k. |
|
vy[k] the y component of the velocities for the stencil k. |
|
vz[k] the z component of the velocities for the stencil k. |