pyCE.polytropes module

Module contents

Polytropic stellar models via the Lane-Emden equation.

A polytrope is a self-gravitating fluid sphere with equation of state P = K * rho**gamma, gamma = 1 + 1/n. In scaled variables the structure is governed by the Lane-Emden equation

theta’’ + (2/r) theta’ = -theta**n,

with theta(0) = 1 and theta’(0) = 0; the density is rho = theta**n and the (first) zero of theta marks the stellar surface.

class pyCE.polytropes.polytrope(n=1.5, dr=0.01)[source]

Bases: object

Polytropic stellar model from the Lane-Emden equation.

Creates a polytrope with index n, which is related to the adiabatic index via gamma = 1 + 1/n. Uses an RK4 method to solve the Lane-Emden equation.

Parameters:
  • n (float, optional) – Polytropic index (default 1.5).

  • dr (float, optional) – Radial step size (default .01).

Variables:
  • theta (ndarray) – Lane-Emden profile.

  • psi (ndarray) – Radial derivative of theta.

  • rho (ndarray) – Scaled density profile.

  • r (ndarray) – Radial distance array in scaled lengths.