Conversion of ideal gas to real gas via $Z$ compression factor The ideal gas equation $PV=nRT$ can be converted into real gas equation by compression factor $Z$ i.e $PV=Z~ nRT)$. My question is what is $Z$ and how does it arise? Is $PV/nRT$ a compression ratio of any gas? How does $Z$ adjust the ideal gas assumptions and allow for calculations with a real gas?
 A: An ideal gas is treated as a set of $N$ indistinguishable particles with no interactions, which means the partition function of a single particle is simply,
$$Z = \int d^3p \, d^3 q \, \exp \left\{ -\beta\frac{p^2}{2m}\right\}$$
and the partition function of the entire system is $Z^N/N!$. From this, we can obtain the ideal gas law,
$$PV = N k_B T$$
Of course, this equation has many limitations due to the simplifying assumptions, but it is a good approximation if $N/V$ is small. Otherwise, there are higher order corrections, namely,
$$\frac{P}{k_B T} =  \frac{N}{V} + B_2(T) \frac{N^2}{V^2} + B_3 \frac{N^3}{V^3} + \dots$$
which is known as the virial expansion, and $B_n$ are Virial coefficients. These correspond to higher order computations of the partition function if we expand the exponential. In fact, it is quite similar to quantum field theory in that one can assign diagrams to these terms. Now the compressibility factor $Z$ (not to be confused with the partition function) is just an experimental way to take into account that one is omitting these higher order corrections that describe the real behaviour of the gas. One possible potential is to use a hard-core potential, namely,
$$U(r) =  \left\{ \begin{array}{lr} \infty, & r < r_0 \\ -U_0 \frac{r_0^6}{r^6}, & r \geq r_0\end{array} \right.$$
It takes into account van der Waals interactions, but only at a certain point, hence the name 'hard core' since the particles cannot get closer than some distance $r_0$ to each other.
A: You can define $Z$ phenomenologically as follows: calculate the ratio $PV/(nRT)$ for each PV. Call the ratio as a function of $PV$ the compression ratio, and assume it's independent of temperature and mole number. Then $PV=Z(nRT)$.
A: Compressibility factor comes from the virial expansion, any (monoatomic) gas can be study as an ideal gas with Z=1 but it's obviously just an approximation. The problem is that for the ideal gas law you assume that the particles (atoms) are punctiform without a proper volume. In the real gas model we have to correct volume and pressure because of the finite dimension of particles, and this correction introduce successive element of the virial expansion. I give you just an idea of the problem.
A: Hopefully, I will not be "bad mouthing" those who have a background similar to my own, but here goes.
In the world of chemical engineering, there are quite a few equations that are much more empirical than "first principle" based.  This is particularly true for heat transfer problems, which usually have to deal with turbulent fluids.  From a practical standpoint, many of these equations are dealt with by using a "fudge factor".  In effect, the Z compression factor is much akin to a fudge factor, but it obviously has to cover a much larger range than a single point.  Due to this, a chart has been developed which allows you to specify a substance's reduced pressure (absolute pressure divided by critical pressure) and reduced temperature (Rankine or Kelvin temperature divided by critical temperature), such that you can then look up the value of Z that corresponds to these data.  This idea is based on the principle of corresponding states, as shown in the following link:
https://en.wikipedia.org/wiki/Theorem_of_corresponding_states
Hopefully, this answers your question.
