During a discussion on thermodynamics of ideal and real gases. A colleague, who is actually my prof, recently, claimed that during compression, work done on a van der Waals gas is lower due to intermolecular attractions, that the gas molecules are attracting each other, overall being attracted towards the 'inward' direction making it easier to do work on the gas. In other words, since the molecules attract each other, it is easier to compress the gas, or for compression (atleast) $W_{\text{vdW}} < W_{\text{prefect}}$. I had three problems with this.

The 3 Problems

  1. No matter what the gas, or any material is, as long as it follows the same curve on the $P$$V$ graph, the work, vis (negative of) the area under the curve, would remain the same. I am quite sure about this, but could someone verify?

Edit: Some comments have resolved this problem.

  1. If we consider the frictional nature of real gases, in general, to carry out any process, more work should be done on a system of real gases for any process.

  2. Even if the system is neither frictional nor following the same curve and the process, considering the external influences used to bring about the changes decides the work, there should be a difference in the work done on more compressible and less compressible gases (I am talking about the compressibility factor here).

The formula for reversible work done on a perfect gas undergoing an isothermal process is going from initial to final volume $v_1$ and $v_2$, repectively, is given by: $$\left(W_\text{perfect}\right)_T = -nRt\ln(\dfrac{v_2}{v_1})$$

The formula for reversible work done on a van der Waals gas undergoing an isothermal process is going from initial to final volume $v_1$ and $v_2$, repectively, is given by: $$\left(W_{\text{vdW}}\right)_T = -nRt\ln{\dfrac{v_2-nb}{v_1-nb}} - an^2\left(\dfrac{1}{v_2}-\dfrac{1}{v_1}\right)$$

My approach

Now, my first thought was to calculate $\left(W_{\text{perfect}}\right)_T-\left(W_{\text{vdW}}\right)_T$ and show that it is not positive for all values of $n$, $T$, $v_1$, and $v_2$; however, multivariable calculus isn't my forte, so I didn't do this analysis. Instead, I did a simulation. The code is shown at the end of the question.

Conditions for the simulation: I considered $1$ atm pressure, $1$ mol of gas, temperatures between $500$ and $2000$ Kelvin and volumes between $10$ and $200$ liters; I considered van der Waals constants corresponding to ammonia, butane, carbon dioxide, and helium. I calculated the mean and variance of the difference in isothermal works performed on the perfect and van der Waals gases $(W_{\text{perfect}})_T-(W_{\text{vdW}})_T$. The corresponding results I obtained are as follows.

Results of thermodynamic simulations of isothermal work on perfect and van der Waals gases


Now, I have tried to choose appropriate values of volumes and temperatures, to obtain an idea of how gases behave in real conditions. There seems no particular relation between the two works, except that both are very close to each other (mean$\approx 0\ \text{L atm}$), with a variance of the order of $0.01\ \text{L}^2\ \text{atm}^2$, which is significant, especially, if one converts it to SI units, but surely one is not more than the other as a general rule.


Could someone help me get to these results more rigorously? I am guessing that analysis might be useful here. Have I reached the right conclusion that the works of perfect and van der Waals gases cannot be compared simply based on some vague interpretations of intermolecular forces? Furthermore, I am not sure how to go about analyzing an irreversible process; some help here would be appreciated.

Comments upon the answers

The comments and answers seem to be talking about unrealistic pressure limits to infinity. To illustrate that the question is well within the realm of real laboratory/industry conditions, refer to the plot below for ideal and van der Waals $P$$V$ graphs for carbon dioxide.

pressure of van der Waals gas exceeding pressure of perfect gas under very achievable conditions

My Code

# -*- coding: utf-8 -*-
Created on Thu Apr 13 14:12:12 2023
van der Waals and perfect gas isothermal work
@author: ananta

n = 1 # 1 mol gas
R = 0.0821 # atm l / K mol
T = [i for i in range(500,2001,100)]
V = [i for i in range(10,201,10)]
C = [(4.225,0.0371),(14.66,0.1226),(3.64,0.04267),(0.0346,0.0238)] # van der Waals constants

from math import log
from statistics import mean, variance

for (a,b) in C:
    D = [] # difference of vdW and perfect gas isothermal work
    ca = 0
    cb = 0
    cc = 0
    cd = 0
    Wp = [] # work of perfect gas
    Wv = [] # work of van Der Waals gas
    V1 = [] # initial volume
    V2 = [] # final volume
    for t in T:
        for v1 in V:
            for v2 in V:
                wp = -n*R*t*log(v2/v1)
                wv = -n*R*t*log((v2-n*b)/(v1-n*b))-a*pow(n,2)*(1/v2 - 1/v1)

    print('(',a,b,'):', mean(D), variance(D))
  • $\begingroup$ I am not sure why you think that it is the correct thing to be approaching learning as a confrontational scheme between you and your prof. He is pretty much correct for most of the phase space. It just so happens that VdW gas includes a minimum volume occupied, so that you can prove him wrong in the limit as you compress the gas until it goes quantum. However, what is the point of such a victory? $\endgroup$ Apr 14, 2023 at 16:22
  • $\begingroup$ @naturallyInconsistent I worked with very real values of the gas properties, which are within macroscopic domains, there is nothing like quantum compression going on here. $\endgroup$
    – ananta
    Apr 14, 2023 at 16:32
  • $\begingroup$ If you really scrutinise real, you will understand that only quantum may claim to be real. But here I am only asserting that if you want to disprove him, you just have to consider when the gas is compressed until it is very small, i.e. when assuming that it is a dilute gas is no longer acceptable. That is the limit where VdW does also NOT claim to be valid anyway. $\endgroup$ Apr 14, 2023 at 16:35
  • $\begingroup$ You are paraphrasing your professor, likely inaccurately. Please point out a reference that makes this claim, otherwise the question cannot be answered. $\endgroup$
    – Themis
    Apr 14, 2023 at 17:25
  • $\begingroup$ @Themis My prof follows, mainly, Chemical Thermodynamics by Irving M. Klotz, along with Atkins and Mcquarrie. $\endgroup$
    – ananta
    Apr 14, 2023 at 17:40

2 Answers 2


$$W_P-W_{vdw}=-nRT\ln{\left(\frac{v_2}{v_1}\right)}+nRT\ln{\left(\frac{v_2-nb}{v_1-nb}\right)}+an^2\left(\frac{1}{v_2}-\frac{1}{v_1}\right)$$$$=nRT\ln{\left(\frac{1-\frac{nb}{v_2}}{1-\frac{nb}{v_1}}\right)}+\frac{an^2}{v_2}\left(1-\frac{v_2}{v_1}\right)$$Since $v_2<v_1$,the numerator in the parenthesis of the first term is less than the denominator, and the first term is always negative. But, again, since $v_2<v_1$, the second term is always positive. This refutes your teacher's contention.

  • $\begingroup$ The signs are important, but the magnitudes are too. Unless we compare magnitudes of the two terms under different conditions, we won't be able to say for sure. $\endgroup$
    – ananta
    Apr 15, 2023 at 14:49
  • $\begingroup$ @ananta We can make the first term as large as we want or as small as we want relative to the second term by specifying very high or very low temperature. $\endgroup$ Apr 15, 2023 at 16:28

Since the isothermal work between $v_1$ and $v_2$ is the area under the isotherm, in order to compare the work we need to compare the isotherms of the van der Waals fluid and of the ideal gas. The calculation below is for CO$_2$ at four different temperatures, 200, 300, 500 and 2000 K. For those who want to replicate the calculation, the van der Waals pressure for CO$_2$ is $$ \tag{1} P_\text{vdw} = 10^{-5} \left( \frac{8.314 T}{v-0.0000430614}-\frac{0.230252}{v^2} \right) $$ with $P$ in bar, $T$ in K and $v$ in m$^3$/mol. isotherms for van der Waals and perfect gases at 200, 300, 500, and 2000 Kelvin

In the range 200 K–500 K the van der Waals isotherm lies well below the ideal gas. At 2000 K it edges slightly above. To see under what conditions the van der Waals isotherm is above or below the ideal gas isotherm we take a look at the ratio of the two pressures at the same $T$ and $v$: $$\tag{2} \frac{P^\text{vdw}}{P^\text{id}} = \frac{v}{v-b} - \frac{a}{RT v} $$ This is the compressibility factor of the van der Waals gas. At high $v$, which is equivalent to low $P$, the first term is essentially 1 (because $v-b\approx v$) and the ratio becomes $$\tag{3} \text{low $P$:}\qquad \frac{P^\text{vdw}}{P^\text{id}} \to 1 - \frac{a}{RT v} < 1 $$ At $v\to b$, which is equivalent to $P\to\infty$, the second term drops put because $v$ is in the denominator and we get $$ \tag{4} \text{high $P$:}\qquad \frac{P^\text{vdw}}{P^\text{id}} \to \frac{v}{v-b} > 1 $$ In this limit the van der Waals pressure is higher than the pressure of the ideal gas because $P^\text{vdw}$ goes to infinity at $v=b$ while the ideal gas goes to infinity a bit later, at $v=0$.

Effect of temperature From Eq. (3) we see that at low pressures the ratio $P^\text{vdw}/P^\text{id}$ is larger than 1, but with $T$ in the denominator this ratio gets closer to 1 as we increase temperature. Your calculations are at 1 bar and temperatures ranging from 500 K to 2000 K. Most gases, including CO$_2$, will be pretty close to ideal at such high temperatures so the difference in the isothermal work would be small. To see a bigger difference, do the calculation at lower temperatures, but if you go below the critical $T$ make sure that the end states of the process are both in the vapor phase or else you may get close to the limit in Eq (4).

In summary At high pressures (high $\frac{T}{V}$) the van der Waals isotherm lies above that of ideal gas, and the modulus of work to compress/expand a van der Waals fluid is less than that of ideal gas.

  • $\begingroup$ Unless these are calculations you performed, could you provide a reference for the image? $\endgroup$
    – ananta
    Apr 15, 2023 at 12:40
  • $\begingroup$ These are my own calculations in Mathematica. The vdw pressure for CO2 in bar is $ P = \frac{0.00008314 T}{v-0.0000428557} -\frac{3.6571069252093613\times 10^{-6}}{v^2} $ with $T$ in K and $v$ in m$^3$/mol. $\endgroup$
    – Themis
    Apr 15, 2023 at 12:47
  • $\begingroup$ Could you please share the plots for calculations around 2000 Kelvin. I have been trying to create the plots in Python but something isn't working for me right now. $\endgroup$
    – ananta
    Apr 15, 2023 at 14:47
  • $\begingroup$ Following previous comment, I have attached a graph for the plot at 2000 K. $\endgroup$
    – ananta
    Apr 15, 2023 at 15:46
  • $\begingroup$ Your new calculation is correct, but notice that you are going to very high pressures, as high as 160 atm. I revised my answer to include the calculation at 2000 K, which agrees with yours. $\endgroup$
    – Themis
    Apr 15, 2023 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.