# Density as a derivative of the Helmholtz energy

The equation of state for nitrogen has been formulated using the Helmholtz energy as the fundamental property with independent variables of density and temperature. The equation of state in dimensional form is given by $$a(\rho,T)=a^o(\rho,T)+a^r(\rho,T),$$ where a is the Helmholtz energy, $$a^o(\rho,T)$$ is the ideal gas contribution to the Helmholtz energy, and $$a^r(\rho,T)$$ is the residual Helmholtz energy which corresponds to the influence of intermolecular forces. All thermodynamic properties can be calculated as derivatives of the Helmholtz energy.

Source: J. Phys. Chem. Ref. Data, Vol. 29, No. 6, 2000, pg. 1374

Per Wikipedia, density is a thermodynamic property. If I know pressure and temperature, how can I use the $$P,T$$ information with the Helmholtz energy equation described above to calculate nitrogen density?

An example would be helpful -- Thermodynamics is tough. Per user Kyle Kanos, one would need to find the inverse of $$a$$ using a numerical technique such as the Newton-Raphson methdod. NIST shows the density of nitrogen at T=300 K and P=10,000 psia to be 17363 mol/m3. Using Kyle Kanos's methodology, can someone show how to get this result?

• It seems that $a$ is a function of density, so you'd probably have to find the inverse of $a$ (likely not analytic, so you'll have to use numerical techniques). Oct 9 '14 at 14:36
• @KyleKanos this link: coolprop.sourceforge.net/EOS.html talks about obtaining density from an interation, please view the last paragraph of the "Thermodynamic properties of Fluid" section and the "Saturation State" section. Maybe you can make sense of it. Oct 9 '14 at 15:00
• What that link says is pretty much what I said, you have to use numerical techniques (e.g., Newton-Raphson method) to invert the function. Oct 9 '14 at 15:11

Since the Helmholtz EOS is a function of density, you need to invert the function: $$\rho=a^{-1}(a(\rho,T))$$ For this particular, EOS, there is no analytic form for this, you must use iterative methods (e.g., Newton's method).

Since you know the pressure and temperature, you can use the fact that $$p=\rho RT\left[1+\delta\left(\frac{\partial a}{\partial\delta}\right)_\tau\right]$$ where $\delta=\rho/\rho_c$, $\rho_c$ is the critical density, $\tau=T_c/T$ and $T_c$ the critical temperature; all other terms take their normal meaning. So the method of solving is something like

  0: guess density
1: find p using known T and rho
2: compare calculated p & known p
- if sufficiently close (e.g., |p-p'|<1e-5) exit
3: increase or decrease value of rho depending on 2
4: goto 1


Depending on how much you increase or decrease $\rho$, the solver might take a while to work its way towards the solution (it is also assumed that there is a unique solution).

• I had just edited my post, and then I saw your answer. You answer is very helpful and I will give it a try. Thank you for your time and help! Oct 9 '14 at 15:27
• @jakemcgregor: I realized right after my latest comment to your post that you actually were wanting the method by which it could be done. I didn't realize that with the first comment. Oct 9 '14 at 15:29
• Yes, I really appreciate your help. I'm going to sit and chew on your answer and see if I can make it work for me. I have to admit, at this time I do not understand how the first equation works and how to use the second equation in the newton-raphson routine. Oct 9 '14 at 15:59
• @jakemcgregor: Forget about the Newton-Raphson method for now. Just go with numbers 0 through 4 in this. If you're using that CoolProp code, 1 is simply calling the function Props to get 'P'. Oct 9 '14 at 16:01
• I am not using that CoolProp code. I am just using excel. I can write a VBA macro if necessary. I am wanting to learn this to help me complete my problem of solving for nitrogen viscosity: physics.stackexchange.com/questions/139347/… Oct 9 '14 at 16:04