from numbers import Numbervelocitygroups
VelocityGroups
def VelocityGroups(
bins:Union[Iterable, int]=6, # Iterable of velocity group edges or int specifying number of evenly spaced velocity groups
range:Union[numbers.Number, Iterable]=3, # Default range (`min_vel`, `max_vel`) or half-width `max_vel` for velocity groups
):VelocityGroups contains informations about the centers, edges, and relative densities of a list of velocity group bins.
Create a list of two evenly spaced velocity groups:
vg = VelocityGroups(2)
vg{'VGCenter': array([ -1.5 , 1.5 ]),
'VGDensity': array([ 0.5 , 0.5 ]),
'VGWidth': array([ 3.0 , 3.0 ]),
'VGInverseWidth': array([ 0.33 , 0.33 ]),
'VGNumber': 2,
'velocity_groups': array([ 1.0 , 1.0 ])}
VelocityGroups.subdivide
def subdivide(
indices:int | numpy.ndarray | slice=slice(None, None, None), # Indices, boolean array, or slice object specifying velocity groups to subdivide
n:int=2, # Number of groups to subdivide into
):Divide the velocity groups with indices indices in two.
Return a new VelocityGroups object with the groups at index 1 divided in two:
vg.subdivide([1]).subdivide([1, 2]){'VGCenter': array([ -1.5 , 0.38 , 1.1 , 1.9 , 2.6 ]),
'VGDensity': array([ 0.5 , 0.36 , 0.13 , 0.016 , 0.00072]),
'VGWidth': array([ 3.0 , 0.75 , 0.75 , 0.75 , 0.75 ]),
'VGInverseWidth': array([ 0.33 , 1.3 , 1.3 , 1.3 , 1.3 ]),
'VGNumber': 5,
'velocity_groups': array([ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ])}
vg.subdivide([1], n=4){'VGCenter': array([ -1.5 , 0.38 , 1.1 , 1.9 , 2.6 ]),
'VGDensity': array([ 0.5 , 0.36 , 0.13 , 0.016 , 0.00072]),
'VGWidth': array([ 3.0 , 0.75 , 0.75 , 0.75 , 0.75 ]),
'VGInverseWidth': array([ 0.33 , 1.3 , 1.3 , 1.3 , 1.3 ]),
'VGNumber': 5,
'velocity_groups': array([ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ])}
VelocityGroups.identity
def identity()->pymor.operators.interface.Operator:The velocity-space identity operator.
vg.identity()-
- IdentityOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
# _.to_numpy()VelocityGroups.velocity_diagonal
def velocity_diagonal()->pymor.operators.interface.Operator:A velocity-space operator with the velocity on the diagonal.
vg.velocity_diagonal()-
- XarrayMatrixOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
<xarray.DataArray (Atomic velocity (range): 2, Atomic velocity (source): 2)> Size: 32B <COO: shape=(2, 2), dtype=float64, nnz=2, fill_value=0.0> Coordinates: * Atomic velocity (range) (Atomic velocity (range)) float64 16B -1.5 1.5 * Atomic velocity (source) (Atomic velocity (source)) float64 16B -1.5 1.5
_.to_numpy()array([[ -1.5 , 0 ],
[ 0 , 1.5 ]])
VelocityGroups.n_times_1
def n_times_1()->pymor.operators.interface.Operator:Operator that sums over all velocity groups then scales by the Maxwell-Boltzmann distribution.
vg.n_times_1()-
- XarrayMatrixOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
<xarray.DataArray (Atomic velocity (range): 2, Atomic velocity (source): 2)> Size: 96B <COO: shape=(2, 2), dtype=float64, nnz=4, fill_value=0.0> Coordinates: * Atomic velocity (range) (Atomic velocity (range)) float64 16B -1.5 1.5 * Atomic velocity (source) (Atomic velocity (source)) float64 16B -1.5 1.5
_.to_numpy()array([[ 0.5 , 0.5 ],
[ 0.5 , 0.5 ]])
VelocityGroups.drho_dv
def drho_dv()->pymor.operators.interface.Operator:Derivative with respect to velocity operator.
vg.drho_dv()-
- XarrayMatrixOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
<xarray.DataArray (Atomic velocity (range): 2, Atomic velocity (source): 2)> Size: 48B <COO: shape=(2, 2), dtype=float64, nnz=3, fill_value=0.0> Coordinates: * Atomic velocity (range) (Atomic velocity (range)) float64 16B -1.5 1.5 * Atomic velocity (source) (Atomic velocity (source)) float64 16B -1.5 1.5
_.to_numpy()array([[ 0.33 , 0 ],
[ -0.33 , 0.33 ]])
VelocityGroups.trapezoidal
def trapezoidal()->pymor.operators.interface.Operator:Trapezoidal integration over velocity space.
vg1 = VelocityGroups(4)
vg1{'VGCenter': array([ -2.2 , -0.75 , 0.75 , 2.2 ]),
'VGDensity': array([ 0.017 , 0.48 , 0.48 , 0.017 ]),
'VGWidth': array([ 1.5 , 1.5 , 1.5 , 1.5 ]),
'VGInverseWidth': array([ 0.67 , 0.67 , 0.67 , 0.67 ]),
'VGNumber': 4,
'velocity_groups': array([ 1.0 , 1.0 , 1.0 , 1.0 ])}
vg1.trapezoidal()-
- XarrayMatrixOperator
- Atomic velocity(4) → Integral(1)
- []
<xarray.DataArray (Integral (range): 1, Atomic velocity (source): 4)> Size: 32B array([[ 0.75 , 1.5 , 1.5 , 0.75 ]]) Coordinates: * Integral (range) (Integral (range)) int64 8B 1 * Atomic velocity (source) (Atomic velocity (source)) float64 32B -2.25 .....
VelocityGroups.normalize
def normalize()->pymor.operators.interface.Operator:Returns the operator that normalizes a vector by dividing each component by the width of the corresponding velocity group.
vg.normalize()-
- ScaleOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
VelocityGroups.sum
def sum()->pymor.operators.interface.Operator:Returns the operator that sums a vector over velocity groups.
vg.sum()-
- SumOperator
- Atomic velocity(2) → Sum(1)
- []