$M(r)$ and the gas column density $\Sigma(z)$ in each case. Additional mass components or any external (gravitational or not) potential can be trivially accounted for, simply adding the appropriate contribution to the local acceleration $g_i$.

Finally, one has to modify the pressure loop so that the the term $\Delta P_{\rm grav}$ is added right after $\Delta P_{\rm rad}$ to balance the gravitational force. Then, the code proceeds exactly as in the original constant pressure case, trying different values of the gas density until the deviation from the desired pressure is smaller than the requested tolerance.

The Milky Way disk {#secResults}
==================

In order to test the proposed implementation of hydrostatic equilibrium, we consider a simple model of the ISM in the solar neighbourhood, assuming a plane-parallel geometry that is symmetric with respect to the Galactic mid plane, $z=0$. The gas chemical composition [@CowieSongaila86; @SavageSembach96; @Meyer+98], including dust grains [@Mathis+77], is set by the [[abundances ISM]{}]{} command, while cosmic ray heating and ionization are treated following @FerlandMushotzky84 with the instruction [[cosmic ray background]{}]{} (see Hazy[^3], the [Cloudy]{} documentation, for details).

![ Molecular, neutral, and ionized Hydrogen density as a function of height $z$ with respect to the disk mid plane (dotted, 