pisces.physics.virialization.eddington.compute_relative_energy#

pisces.physics.virialization.eddington.compute_relative_energy(energy: unyt_array, boundary_value: unyt_quantity = unyt_quantity(0, 'km**2/s**2')) unyt_array[source]#

Compute the relative energy \(\mathcal{E}\) from the total energy.

The relative energy is defined as:

\[\mathcal{E} = -\left(E - E_0\right),\]

where \(E\) is the total energy and \(E_0\) is the reference energy at the chosen boundary (typically zero).

Parameters:
  • energy (unyt_array) – The total energy values, typically of the form \(\frac{1}{2}v^2 + \Phi(r)\).

  • boundary_value (unyt_quantity, optional) – The energy at the reference boundary (default is 0, with units inferred from energy).

Returns:

The relative energy \(\mathcal{E}\), same units and shape as the input energy.

Return type:

unyt_array