WallGo.collisionArray
Class for loading and storing the collision files used in boltzmann.py.
Classes
|
Class used to load, transform, interpolate and hold the collision array which is needed in |
- class CollisionArray(grid, basisType, particles)[source]
Class used to load, transform, interpolate and hold the collision array which is needed in
WallGo.BoltzmannSolver. Internally the collision array is represented by aWallGo.Polynomialobject. Specifically, this describes a rank-4 tensor \(C_{ab}[\bar{T}_j(\rho_{z}^{(\alpha)}) \tilde{T}_k(\rho_{\parallel}^{(\beta)})]\) where the \(\rho\) are momenta on the grid, and the particle indices \(a, b\) are fixed. Index ordering is hardcoded as: \(\alpha, \beta, j, k\). There is one CollisionArray object for each pair of off-equilibrium particles.Initializes a CollisionArray for a given grid and basis. Collision data will be set to zero.
- Parameters:
grid (Grid) – Grid object that the collision array lives on (non-owned).
basisType (str) – Basis to use for the polynomials. Note that unlike in the
WallGo.Polynomialclass, our basis is just a string. We always use “Cardinal” basis on momentum axes and basisType on polynomial axes. We do NOT support different basis types for the two polynomials.particles (list[Particle]) – List of the
WallGo.Particleobjects this collision array describes.
- Return type:
None.
- AXIS_LABELS: Final[tuple[str, ...]] = ('particles', 'pz', 'pp', 'particles', 'polynomial1', 'polynomial2')
Static axis labels in correct order, \(a, \alpha, \beta, b, j, k\).
- AXIS_TYPES: Final[tuple[str, ...]] = ('Array', 'pz', 'pp', 'Array', 'pz', 'pp')
Static axis types in correct order.
- changeBasis(newBasisType)[source]
Changes the basis in our polynomial indices.
- Parameters:
newBasisType (str) – The new basis type to be used.
- Returns:
The modified CollisionArray object.
- Return type:
Notes
Momentum indices always use the Cardinal basis.
This method modifies the object in place.
- getBasisSize()[source]
Returns the size of the basis.
- Returns:
The size of the basis.
- Return type:
int
- getBasisType()[source]
Returns the basis type of the CollisionArray.
- Returns:
The basis type of the CollisionArray.
- Return type:
str
- static interpolateCollisionArray(srcCollision, targetGrid)[source]
Interpolate collision array to match a target grid size.
- Parameters:
srcCollision (CollisionArray) – The source collision array to be interpolated.
targetGrid (Grid) – The target grid to match the size of the interpolated collision array.
- Returns:
The interpolated collision array.
- Return type:
- Raises:
AssertionError – If the target grid size is larger than or equal to the source grid size.
Notes
This function interpolates a collision array to match the size of a target grid. It takes the source collision array and the target grid as input, and returns the interpolated collision array.
The interpolation is performed by evaluating the original collisions on the interpolated grid points. The resulting data is used to create a new polynomial, which is then used to create a new CollisionArray object.
The source collision array must be in the Chebyshev basis for interpolation. The target grid should have a size smaller than the source grid size.
Example
>>> srcCollision = CollisionArray(...) >>> targetGrid = Grid(...) >>> interpolatedCollision = interpolateCollisionArray(srcCollision, targetGrid)
- static newFromDirectory(directoryPath, grid, basisType, particles, bInterpolate=True)[source]
Create a new CollisionArray object from a directory containing collision files.
- Parameters:
collision (Collision) – Collision class that holds path of the directory containing the collision files. The collision files must have names with the form collisions_particle1_particle2.hdf5.
grid (Grid) – The grid object representing the computational grid.
basisType (str) – The basis type for the CollisionArray object.
particles (list[Particle]) – The list of particles involved in the collisions.
bInterpolate (bool, optional) – Interpolate the data to match the grid size. Extrapolation is not possible. Default is True.
directoryPath (Path)
- Returns:
The new CollisionArray object created from the collision files.
- Return type:
- Raises:
CollisionLoadError – If any of the collision files are not found, or if there is a grid size mismatch and bInterpolate is set to False.
- static newFromPolynomial(inputPolynomial, particles)[source]
Creates a new CollisionArray object from polynomial data (which contains a grid reference). This only makes sense if the polynomial is already in correct shape.
- Parameters:
inputPolynomial (Polynomial) – The input polynomial data.
particles (list[Particle]) – The list of particles.
- Returns:
The newly created CollisionArray object.
- Return type:
“CollisionArray”
- Raises:
AssertionError – If the input polynomial does not meet the required conditions.