Stellar atmosphere (or stellar envelope) is the tenuous outer layer of a star. The mass of this layer is negligible compared with that of the star, so one can assume that gravity is constant throughout. The condition for mechanical equilibrium is
Where is the pressure and is the density. If the atmosphere is adiabatic where is a constant and is the adiabatic constant. Solving for the density
Where is the radius of the star (the point where the density vanishes). For a non radiative atmosphere and . For radiative atmospheres and .