WallGo.boltzmann.BoltzmannSolver

class BoltzmannSolver(grid, basisM='Cardinal', basisN='Chebyshev', derivatives='Spectral', collisionMultiplier=1.0, truncationOption=ETruncationOption.AUTO)[source]

Bases: object

Class for solving Boltzmann equations for small deviations from equilibrium.

Initialisation of BoltzmannSolver

Parameters:
  • grid (Grid) – An object of the Grid class. integrals.

  • basisM (str, optional) – The position polynomial basis type, either ‘Cardinal’ or ‘Chebyshev’. Default is ‘Cardinal’.

  • basisN (str, optional) – The momentum polynomial basis type, either ‘Cardinal’ or ‘Chebyshev’. Default is ‘Chebyshev’.

  • derivatives ({'Spectral', 'Finite Difference'}, optional) – Choice of method for computing derivatives. Default is ‘Spectral’ which is expected to be more accurate.

  • collisionMultiplier (float, optional) – Factor by which the collision term is multiplied. Can be used for testing. Default is 1.0.

  • truncationOption (ETruncationOption, optional) – Option for truncating the spectral expansion. Default is ETruncationOption.AUTO. Other options are ETruncationOption.NONE and ETruncationOption.THIRD.

Returns:

cls – An object of the BoltzmannSolver class.

Return type:

BoltzmannSolver

__init__(grid, basisM='Cardinal', basisN='Chebyshev', derivatives='Spectral', collisionMultiplier=1.0, truncationOption=ETruncationOption.AUTO)[source]

Initialisation of BoltzmannSolver

Parameters:
  • grid (Grid) – An object of the Grid class. integrals.

  • basisM (str, optional) – The position polynomial basis type, either ‘Cardinal’ or ‘Chebyshev’. Default is ‘Cardinal’.

  • basisN (str, optional) – The momentum polynomial basis type, either ‘Cardinal’ or ‘Chebyshev’. Default is ‘Chebyshev’.

  • derivatives ({'Spectral', 'Finite Difference'}, optional) – Choice of method for computing derivatives. Default is ‘Spectral’ which is expected to be more accurate.

  • collisionMultiplier (float, optional) – Factor by which the collision term is multiplied. Can be used for testing. Default is 1.0.

  • truncationOption (ETruncationOption, optional) – Option for truncating the spectral expansion. Default is ETruncationOption.AUTO. Other options are ETruncationOption.NONE and ETruncationOption.THIRD.

Returns:

cls – An object of the BoltzmannSolver class.

Return type:

BoltzmannSolver

Methods

__init__(grid[, basisM, basisN, ...])

Initialisation of BoltzmannSolver

buildLinearEquations()

Constructs matrix and source for Boltzmann equation.

checkLinearization([deltaF])

Compute two criteria to verify the validity of the linearisation of the Boltzmann equation: \(\delta f/f_{eq}\) and \(\delta f_2/(f_{eq}+\delta f)\), with \(\delta f_2\) the first-order correction due to nonlinearities.

checkSpectralConvergence(deltaF)

Check for spectral convergence.

estimateTruncationError(deltaF, shapeTruncated)

Quick estimate of the polynomial truncation error using John Boyd's Rule-of-thumb-2: the last coefficient of a Chebyshev polynomial expansion is the same order-of-magnitude as the truncation error.

getDeltas([deltaF])

Computes Deltas necessary for solving the Higgs equation of motion.

loadCollisions(directoryPath)

Loads collision files for use with the Boltzmann solver.

setBackground(background)

Setter for the BoltzmannBackground

setCollisionArray(collisionArray)

Setter for the CollisionArray

solveBoltzmannEquations()

Solves Boltzmann equation for \(\delta f\), equation (32) of [LC22].

updateParticleList(offEqParticles)

Setter for the list of out-of-equilibrium Particle objects

Attributes

MAX_EXPONENT

grid

offEqParticles

background

collisionArray

truncationOption

buildLinearEquations()[source]

Constructs matrix and source for Boltzmann equation.

Note, we make extensive use of numpy’s broadcasting rules.

Return type:

tuple[ndarray, ndarray, ndarray, ndarray]

checkLinearization(deltaF=None)[source]

Compute two criteria to verify the validity of the linearisation of the Boltzmann equation: \(\delta f/f_{eq}\) and \(\delta f_2/(f_{eq}+\delta f)\), with \(\delta f_2\) the first-order correction due to nonlinearities. To be valid, at least one of the two criteria must be small for each particle.

Parameters:

deltaF (array-like, optional) – Solution of the Boltzmann equation. The default is None.

Returns:

  • deltaFCriterion (tuple)

  • collCriterion (tuple) – Criteria for the validity of the linearization.

Return type:

tuple[float, float]

checkSpectralConvergence(deltaF)[source]

Check for spectral convergence.

Fits to the exponential slope of the last 1/3 of coefficients in the Chebyshev basis, and truncates if they are increasing. Also returns the positions of the spectral peaks of the distribution in each dimension.

Parameters:

deltaF (array_like) – The solution for which to estimate the truncation error, a rank 3 array, with shape (len(z), len(pz), len(pp)).

Returns:

  • deltaFTruncated (np.ndarray) – Potentially truncated version of input deltaF, padded with zeros if truncated, so same shape as input.

  • shapeTruncated (tuple[int, int, int, int]) – Shape of truncated array.

  • spectralPeaks (tuple[int, int, int]) – Indices of the peaks in the (potentially truncated) spectral expansion.

Return type:

tuple[ndarray, tuple[int, int, int, int], tuple[int, int, int]]

estimateTruncationError(deltaF, shapeTruncated)[source]

Quick estimate of the polynomial truncation error using John Boyd’s Rule-of-thumb-2: the last coefficient of a Chebyshev polynomial expansion is the same order-of-magnitude as the truncation error.

Parameters:
  • deltaF (array_like) – The solution for which to estimate the truncation error, a rank 3 array, with shape (len(z), len(pz), len(pp)).

  • shapeTruncated (tuple[int, ...])

Returns:

truncationError – Estimate of the relative trucation error.

Return type:

float

getDeltas(deltaF=None)[source]

Computes Deltas necessary for solving the Higgs equation of motion.

These are defined in equation (15) of 2204.13120 [LC22].

Parameters:

deltaF (array_like, optional) – The deviation of the distribution function from local thermal equilibrium.

Returns:

Deltas – Defined in equation (15) of [LC22]. A collection of 4 arrays, each of which is of size len(z).

Return type:

BoltzmannDeltas

loadCollisions(directoryPath)[source]

Loads collision files for use with the Boltzmann solver.

Parameters:

directoryPath (pathlib.Path) – Directory containing the .hdf5 collision data.

Returns:

None

Raises:

CollisionLoadError

Return type:

None

setBackground(background)[source]

Setter for the BoltzmannBackground

Parameters:

background (BoltzmannBackground)

Return type:

None

setCollisionArray(collisionArray)[source]

Setter for the CollisionArray

Parameters:

collisionArray (CollisionArray)

Return type:

None

solveBoltzmannEquations()[source]

Solves Boltzmann equation for \(\delta f\), equation (32) of [LC22].

The Boltzmann equations are linearised and expressed in a spectral expansion, so that they take the form

\[\left(\mathcal{L}[\alpha,\beta,\gamma;i,j,k]\delta_{ab} + \bar T_i(\chi^{(\alpha)})\mathcal{C}_{ab}[\beta,\gamma; j,k] \right) \delta f^b_{ijk} = \mathcal{S}_a[\alpha,\beta,\gamma],\]

where \(\mathcal{L}\) is the Lioville operator, \(\mathcal{C}\) is the collision operator, and \(\mathcal{S}\) is the source.

As regards the indicies,

  • \(\alpha, \beta, \gamma\) denote points on the coordinate lattice \(\{\xi^{(\alpha)},p_{z}^{(\beta)},p_{\Vert}^{(\gamma)}\}\),

  • \(i, j, k\) denote elements of the basis of spectral functions \(\{\bar{T}_i, \bar{T}_j, \tilde{T}_k\}\),

  • \(a, b\) denote particle species.

For more details see the WallGo paper.

Returns:

delta_f – The deviation from equilibrium, a rank 6 array, with shape (len(z), len(pz), len(pp), len(z), len(pz), len(pp)).

Return type:

array_like

References

[LC22] (1,2)

B. Laurent and J. M. Cline, First principles determination of bubble wall velocity, Phys. Rev. D 106 (2022) no.2, 023501 doi:10.1103/PhysRevD.106.023501

updateParticleList(offEqParticles)[source]

Setter for the list of out-of-equilibrium Particle objects

Parameters:

offEqParticles (list[Particle])

Return type:

None