jaxrts.helpers.mass_density_from_electron_density

jaxrts.helpers.mass_density_from_electron_density(n_e, Z, number_fractions, elements, partial=False)[source]

Calculate the mass density of a mixture from electron density.

Parameters:
  • density) (n_e (electron) – electron density of mixture

  • (charge) (Z) – The charge of each chemical element in the plasma.

  • number_fractions (array_like) – The number fractions of each chemical element.

  • elements (list) – The masses of the respective chemical elements.

  • partial (boolean) – default false = density of mixture, if true: density vector splitted for mixture is returned.

Returns:

array_like – The mass density of the mixture. When partial=True: density is splitted up in mixture-componentes by multiply with mass_from_number_fraction().

Raises:

ValueError – If the lengths of Z, number_fractions and elements are not the same.

Examples

>>> n_e = 0.8e24 / ureg.cm**3
>>> number_fractions = jnp.array([1/2, 1/2])
>>> elements = [jaxrts.Element("C"), jaxrts.Element("H")]
>>> Z_free = jnp.array([4.0, 1.0])
>>> mass_density_from_electron_density(
>>>     n_e, Z_free, number_fractions, elements
>>> )
<Quantity(3.4589693021231165, 'gram / centimeter ** 3')>
>>> mass_density_from_electron_density(
>>>     n_e, Z_free, number_fractions, elements, partial=True
>>> )
<Quantity([3.19115756 0.26781174], 'gram / centimeter ** 3')>