# Yet again about (real) gas compression

• I
• FranzS
In summary: The pressure and temperature increase during compression numerically. The pressure and temperature increase during compression isentropically. The pressure and temperature increase during compression isentropically and with loss of work.

#### FranzS

With a real inert gas (i.e. nitrogen N2) being compressed in a piston-like configuration, I'd like to estimate the peak pressure and peak temperature at the instant the gas is brought to full compression.
Initial pressure and initial temperature (in the uncompressed state) are known: typically, ##P_{in}=200## bar and ##T_{in}=20##°C (room temperature).
I assume there is no heat exchange between the gas and the walls of the piston/cylinder (I guess it is reasonable in case of a "fast compression").
Compression ratio (volumetric) is typically ##2##, and gas compression is typically carried out in a few tenths of a second.

***Question no. 1: With those assumptions, I guess the process can be considered as isentropic. Is it true? In case of a real inert gas, how fast is too fast in order to consider the compression as a sequence of quasi-equilibrium states? (more about that to follow...)***

I'm interested in the real gas behaviour.
Hence, I'm considering the compressibility factor ##Z(P,T)## and the "real gas law":
$$PV=Z(P,T)nRT$$
Additionally, I'm considering the real specific heat capacity ##c_v(P,T)##.
For both, I'm using accurate values from the NIST database. I have already verified with practical experiments that the use of such values of the ##Z##-factor works great with "static"/isothermal compressions.

Now, in an isentropic process we have (please do not consider the signs, as I'm only interested in the absolute values of the quantities):
$$dU=dW=PdV$$
$$dU=nc_vdT$$
Hence:
$$dT=\frac{PdV}{nc_v}$$
Now, I'm calculating the pressure and temperature increase during compression numerically.
I divide my compression stroke length in many "small stroke intervals" (each corresponding to a certain volume ##V##, so that the difference between each is a small ##dV##).
For each interval I assume constant ##P## and constant ##T## and:
• I solve the "real gas law" (with the use of the proper ##Z##-factor according to the specific pressure and temperature resulting from the previous interval) in order to find the pressure ##P## for the current interval
• I calculate the small temperature increase ##dT## which I will add (to the temperature used for the current interval) for the calculations for the next interval (again, I'm using the proper real value for ##c_v## according to the specific pressure and temperature being considered)
This is done iteratively till the end of the compression stroke. That is nothing special, just simple numerical approximation (discretization).

***Question no. 2: Also with reference to question no.1 and to the next questions, is this a valid approximation of what happens in reality? Please remember I'm considering an inert gas.***

***Question no. 3:
I expect some work ##dW## is lost during compression because of internal turbulence/friction between the gas molecules (or between the gas molecules and the piston-cylinder system walls) but – as for my purposes – could the missing increase in temperature due to the loss of work be compensated by the increase in temperature due to the turbulence/friction (hence leading more or less to the same final result)?***

***Question no. 4:
As per my assumptions, the gas temperature when the gas is brought back to the uncompressed state (following a compression cycle) should be the same as the initial temperature before the first compression cycle. In the real world situation – but always assuming no exchange of heat from the gas – would the temperature, after many compression+decompression cycles, progressively build up because of the friction between the gas molecules (or between the gas molecules and the piston-cylinder system walls)?***

Regarding question 4: You are adding mechanical energy to the same volume of gas over time, as the expansion work < compresion work due to friction and internal other losses.
If that volume is perfectly insulated, no heat can flow out of the volume, other than by conductivity via piston or diaphragm, and crank or shaft.

Your approach in question 1 is incorrect. dU is not equal to nCvdT for a real gas. It is given by $$dU=nC_vdT-\left[P-T\left(\frac{\partial P}{\partial T}\right)_V\right]dV$$Also, your other equation for dU is incorrect. dU is not equal to PdV. $$dU=-PdV$$So you should have $$nC_vdT=-T\left(\frac{\partial P}{\partial T}\right)_VdV$$This is a condition for constant entropy.

Another version of this that may be more useful to you is $$dH=nC_pdT+\left[V-T\left(\frac{\partial V}{\partial T}\right)_P\right]dP=TdS+VdP$$For constant entropy, this reduces to: $$nC_pdT=T\left(\frac{\partial V}{\partial T}\right)_PdP$$An even more useful form of this might be: $$dS=n\frac{C_p}{T}dT-\left(\frac{\partial V}{\partial T}\right)_PdP$$or$$\frac{1}{n}dS=\frac{C_p}{T}dT-R\left(\frac{\partial (zT)}{\partial T}\right)_P\frac{dP}{P}$$or$$\frac{dS}{n}=\frac{C_p}{T}dT-R\frac{dP}{P}-R\left(\frac{\partial ((z-1)T)}{\partial T}\right)_P\frac{dP}{P}\tag{1}$$
In this case, there is a way of doing it where you don't even need to know ##C_p(P,T)##. All you need to know is Cp in the ideal gas limit where Cp is a function only of temperature (i.e., ##C_p^{IG}(T)##). Can you figure out how to implement this?

Last edited:
Continuing the analysis of the previous section, the value of the entropy change for an arbitrary process experienced by a real gas in going from an initial temperature and pressure ##T_i## and ##P_i## to a final temperature and pressure ##T_f## and ##P_f## can be obtained by applying Hess' Law to the following 3-step change sequence:

1. ##(T_i, P_i)## -----> ##(T_i,P^*)##
2. ##(T_i, P^*)## -----> ##(T_f,P^*)##
3. ##(T_f, P^*)## -----> ##(T_f,P_f)##

where ##P^*## is a low enough pressure for the gas to fall within the ideal gas region (##P^*<0.01P_c##). For a real gas, the residual entropy relative to an ideal gas state is defined as $$\frac{S^R(T,P)}{n}=-\int_0^P{R\left(\frac{\partial ((z-1)T)}{\partial T}\right)_P\frac{dP'}{P'}}$$. For change #1, in the above sequence, we thus find that $$\frac{\Delta S_1}{n}=-R\ln{(P^*/P_i)}-\frac{S^R(T_i,P_i)}{n}+\frac{S^R(T_i,P^*)}{n}$$But, since P* is in the ideal gas region, the residual entropy of this state is zero: $$\frac{S^R(T_i,P^*)}{n}=0$$Therefore, $$\frac{\Delta S_1}{n}=-R\ln{(P^*/P_i)}-\frac{S^R(T_i,P_i)}{n}$$Similarly for step #3, $$\frac{\Delta S_3}{n}=-R\ln{(P_f/P^*)}+\frac{S^R(T_f,P_f)}{n}$$Step #2 describes the change in entropy due to a temperature change at constant pressure in the ideal gas regions, and the change in entropy for this step is therefore given by $$\frac{\Delta S_2}{n}=C_p^{IG}\ln{(T_f/T_i)}$$So, the overall entropy change from the initial state to the final state using Hess' Law is given by: $$\frac{\Delta S}{n}=C_p^{IG}\ln{(T_f/T_i)}-R\ln{(P_f/P_i)}+\frac{S^R(T_f,P_f)}{n}-\frac{S^R(T_i,P_i)}{n}\tag{2}$$

Based on the law of corresponding states, Smith and Van Ness, Introduction to Chemical Engineering Thermodynamics, have provided graphs of ##S^R/nR## as a function of reduced temperature, reduced pressure, and ascentric factor (Figs. 6-10 to 6-13) that can be used in conjunction with Eqn. 2 to carry out calculations for adiabatic reversible compression or expansion of real gases. (See also Eqn. 6-63 of Smith and Van Ness). Assuming that the initial and final pressures are known as well as the initial temperature, one can set the entropy change to zero and use Eqn. 2 to solve for the final temperature.

Last edited:
sophiecentaur and 2milehi
@Chestermiller I'd like to get the closest possible result to what happens in the real world, but I'd prefer to overestimate the resulting pressure at full compression rather than underestimate it (hence the assumption the gas does not exchange heat).
This formula should be the one for me (and for me it's the one that's easiest to implement):
$$n c_v(P,T) dT = -T \left( \frac{\partial P}{\partial T} \right)_V dV \Rightarrow dT = - \frac{T}{n c_v(P,T)} \left( \frac{\partial P}{\partial T} \right)_V dV$$
... where:
$$P V = Z(P,T) n R T \Rightarrow P = \frac{n R T}{V} Z(P,T) \Rightarrow \frac{\partial P}{\partial T}=\frac{n R}{V}Z(P,T)+\frac{n R T}{V}\frac{\partial Z(P,T)}{\partial T}$$
By the way, for both the compressibility factor ##Z(P,T)## and the specific heat capacity ##c_v(P,T)## I'm using a function of the form:
$$\sum_{j=0}^4 P^j \left( \sum_{k=0}^4 \tau_{jk} T^{-k} \right)$$
... where coefficients ##\tau_{jk}## were determined by polynomial (multilinear) regression.

I'm also kindly asking an advice for a book/website/etc. which explains an introduction to the real gas behaviour in simple words.

Thanks a lot.

FranzS said:
@Chestermiller I'd like to get the closest possible result to what happens in the real world, but I'd prefer to overestimate the resulting pressure at full compression rather than underestimate it (hence the assumption the gas does not exchange heat).
This formula should be the one for me (and for me it's the one that's easiest to implement):
$$n c_v(P,T) dT = -T \left( \frac{\partial P}{\partial T} \right)_V dV \Rightarrow dT = - \frac{T}{n c_v(P,T)} \left( \frac{\partial P}{\partial T} \right)_V dV$$
... where:
$$P V = Z(P,T) n R T \Rightarrow P = \frac{n R T}{V} Z(P,T) \Rightarrow \frac{\partial P}{\partial T}=\frac{n R}{V}Z(P,T)+\frac{n R T}{V}\frac{\partial Z(P,T)}{\partial T}$$
By the way, for both the compressibility factor ##Z(P,T)## and the specific heat capacity ##c_v(P,T)## I'm using a function of the form:
$$\sum_{j=0}^4 P^j \left( \sum_{k=0}^4 \tau_{jk} T^{-k} \right)$$
... where coefficients ##\tau_{jk}## were determined by polynomial (multilinear) regression.

I'm also kindly asking an advice for a book/website/etc. which explains an introduction to the real gas behaviour in simple words.

Thanks a lot.
As I said, this calculation can be made without even knowing the effect of pressure on the heat capacity, using only knowledge of the temperature dependence of the heat capacity in the ideal gas region. Secondly, I don't like your expressing the equation for zero entropy change in terms of the volume, rather than the pressure, because, in your initial posting, you implied that the final pressure is known, not the final volume. Working in terms of pressure, rather than volume, as I have done in the analysis I presented is preferred. All you need to do is evaluate the residual entropies for the initial and final conditions to solve this, using Eqn. 2 of my post #4. You can do the integrations using your own parameterization of the Z factor, of course requiring the expression to automatically satisfy Z ---> 1 at P ----> 0 for all temperatures. But, Smith and Van Ness have already done the integration for you. For an introduction to real gas behavior, I suggest you consult Smith and Van Ness, Chapters 5 & 6. At the very least, if you do the integration of my Eqn.2 yourself, using your own parameterization of Z, I strongly recommend comparing your results with what would be obtained using the graphs in Smith and Van Ness.

vanhees71
Chestermiller said:
As I said, this calculation can be made without even knowing the effect of pressure on the heat capacity, using only knowledge of the temperature dependence of the heat capacity in the ideal gas region. Secondly, I don't like your expressing the equation for zero entropy change in terms of the volume, rather than the pressure, because, in your initial posting, you implied that the final pressure is known, not the final volume. Working in terms of pressure, rather than volume, as I have done in the analysis I presented is preferred. All you need to do is evaluate the residual entropies for the initial and final conditions to solve this, using Eqn. 2 of my post #4. You can do the integrations using your own parameterization of the Z factor, of course requiring the expression to automatically satisfy Z ---> 1 at P ----> 0 for all temperatures. But, Smith and Van Ness have already done the integration for you. For an introduction to real gas behavior, I suggest you consult Smith and Van Ness, Chapters 5 & 6. At the very least, if you do the integration of my Eqn.2 yourself, using your own parameterization of Z, I strongly recommend comparing your results with what would be obtained using the graphs in Smith and Van Ness.
I think there is a misunderstanding (I apologise but English is not my native language, maybe it's due to that).
Initial pressure, initial temperature, as well as all possibile volumes (initial, final, any possibile intermediate ones) are known. Not known are final pressure and final temperature, which are the aim of my investigation. That's the reason I thought about the formula at constant volume (my numerical calculations are based on dividing the compression stroke length into many small intervals, and ##V## is exactly known for each of them, resulting in many small and equal intervals ##dV##).
In any case, thanks for your insights and suggestions. I will check how my calculations compare with Smith and Van Ness graphs but I'm afraid of one thing: when I first approached the real gas behaviour and carried out some practical tests, I found out that generalised graphs do not work that well. Specifically, I'm talking about the famous generalised graph for the Z factor which is based on the corresponding states principle (using reduced pressure, etc.).
The "real" data available from the NIST database are instead extremely accurate and I verified them with static tests (isothermal compressions), which for me are quote easy to carry out.
That's why I interpolated those data with an analytic function. By the way, "my" expression for the Z factor has a maximum relative error of around 0.1 % (for the range of pressure and temperatures I'm interested in) and of course satisfy the ideal gas condition ##Z \rightarrow 1## when ##P \rightarrow 0##.

FranzS said:
I think there is a misunderstanding (I apologise but English is not my native language, maybe it's due to that).
Initial pressure, initial temperature, as well as all possibile volumes (initial, final, any possibile intermediate ones) are known. Not known are final pressure and final temperature, which are the aim of my investigation. That's the reason I thought about the formula at constant volume (my numerical calculations are based on dividing the compression stroke length into many small intervals, and ##V## is exactly known for each of them, resulting in many small and equal intervals ##dV##).
In any case, thanks for your insights and suggestions. I will check how my calculations compare with Smith and Van Ness graphs but I'm afraid of one thing: when I first approached the real gas behaviour and carried out some practical tests, I found out that generalised graphs do not work that well. Specifically, I'm talking about the famous generalised graph for the Z factor which is based on the corresponding states principle (using reduced pressure, etc.).
Did these calculations involving corresponding states include the effect of the ascentric factor for the specific gas?

One other thing: Since you are expressing Z as a function of T and P, you should be integrating with respect to pressure rather than molar volume. All I can say is that I would never be approaching the problem the way that you are approaching it

Last edited:
Chestermiller said:
Thanks, I'll get to read it.
In any case, I abandoned my polynomial approximations for the Z-factor as I needed an extended validity range, so I'm now directly using the equation of state for nitrogen which the NIST database is using as a reference. I guess it's the most recent attempt at a definitive EOS for nitrogen and it's taken as a sort of "international standard" since then. Here's the article:
A Reference Equation of State for the Thermodynamic Properties of Nitrogen for Temperatures from 63.151 to 1000 K and Pressures to 2200 MPa
This EOS for nitrogen is expressed as Helmholtz's free energy, with density and temperature as the explicit (independent) perameters.
Are you perhaps already familiar with it? In that case, would you use such formulation in a more effective way in order to approximate a real-world nitrogen gas compression?

You
FranzS said:
Thanks, I'll get to read it.
In any case, I abandoned my polynomial approximations for the Z-factor as I needed an extended validity range, so I'm now directly using the equation of state for nitrogen which the NIST database is using as a reference. I guess it's the most recent attempt at a definitive EOS for nitrogen and it's taken as a sort of "international standard" since then. Here's the article:
A Reference Equation of State for the Thermodynamic Properties of Nitrogen for Temperatures from 63.151 to 1000 K and Pressures to 2200 MPa
This EOS for nitrogen is expressed as Helmholtz's free energy, with density and temperature as the explicit (independent) perameters.
Are you perhaps already familiar with it? In that case, would you use such formulation in a more effective way in order to approximate a real-world nitrogen gas compression?
I don't have access to the PDF because I'm unwilling to cough up the $35 to buy it. What would be your approach for solving for the final state of the gas using A as a function of temperature and density. Is the relationship expressed analytically in the PDF, or is it in tabular form? Chestermiller said: You I don't have access to the PDF because I'm unwilling to cough up the$35 to buy it. What would be your approach for solving for the final state of the gas using A as a function of temperature and density. Is the relationship expressed analytically in the PDF, or is it in tabular form?
I'm currently using the same method as before, until I find out more about your suggestions.
The relationship is expressed analytically but the PDE I'd need to solve has no exact/closed-form solution (at least I think so). So, as said, I'm currently using the same numerical solution approach, re-evaluating all quantities (i.e. pressure/density and temperature) for every volume during compression (assuming no change in entropy).
https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=907386

FranzS said:
I'm currently using the same method as before, until I find out more about your suggestions.
The relationship is expressed analytically but the PDE I'd need to solve has no exact/closed-form solution (at least I think so). So, as said, I'm currently using the same numerical solution approach, re-evaluating all quantities (i.e. pressure/density and temperature) for every volume during compression (assuming no change in entropy).
https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=907386
I am only able to get the abstracts.

Please answer my question from my previous post: How are you able to use ##A(T,\rho)## to arrive at the P-V-T equation of state or to determine ##S(T,\rho)##? I don't see the connection between your method and the representation of ##A(T,\rho)##.

My understanding is that, if you know ##A(T,\rho)## analytically, then you can differentiate analytically to get ##S(T,\rho)##: $$S(T,\rho)=-\left(\frac{\partial A}{\partial T}\right)_{\rho}$$Then $$\left(\frac{\partial S}{\partial T}\right)_{rho}=-\frac{\partial ^2 A}{\partial T^2}$$and$$\left(\frac{\partial S}{\partial \rho}\right)_{T}=-\frac{\partial ^2 A}{\partial T\partial \rho}$$So at constant entropy, $$\left( \frac{\partial T}{\partial \rho}\right)_S=\frac{(\partial^2 A/\partial T\partial \rho)}{(\partial^2 A/\partial T^2)}$$

Chestermiller said:
I am only able to get the abstracts.

Please answer my question from my previous post: How are you able to use ##A(T,\rho)## to arrive at the P-V-T equation of state or to determine ##S(T,\rho)##? I don't see the connection between your method and the representation of ##A(T,\rho)##.

Chestermiller said:
My understanding is that, if you know ##A(T,\rho)## analytically, then you can differentiate analytically to get ##S(T,\rho)##: $$S(T,\rho)=-\left(\frac{\partial A}{\partial T}\right)_{\rho}$$Then $$\left(\frac{\partial S}{\partial T}\right)_{rho}=-\frac{\partial ^2 A}{\partial T^2}$$and$$\left(\frac{\partial S}{\partial \rho}\right)_{T}=-\frac{\partial ^2 A}{\partial T\partial \rho}$$So at constant entropy, $$\left( \frac{\partial T}{\partial \rho}\right)_S=\frac{(\partial^2 A/\partial T\partial \rho)}{(\partial^2 A/\partial T^2)}$$

The explicit parameters are ##\rho## and ##T## and explicit functions for pressure ##P(\rho,T)##, compressibility factor ##Z(\rho,T)##, internal energy ##U(\rho,T)##, enthalpy ##H(\rho,T)##, entropy ##S(\rho,T)##, Gibbs free energy ##G(\rho,T)##, specific heat at constant volume ##c_v(\rho,T)## and specific heat at constant pressure ##c_p(\rho,T)## are also given.
Pardon me, but I still do not understand what you are suggesting me to do. I only know initial pressure and initial temperature (uncompressed state) and I know exactly how the volume changes during compression (even as a function of time, if needed), so that it came natural to me to numerically integrate at disctretized volume intervals.
My aim, as said, is to estimate pressure and temperature at full compression.

Chestermiller said:
I am only able to get the abstracts.
That's strange. From the second link I gave you (not the first one), I can see the full article. Maybe there are restrictions in the US, I don't know (I'm from Italy).

FranzS said:
The explicit parameters are ##\rho## and ##T## and explicit functions for pressure ##P(\rho,T)##, compressibility factor ##Z(\rho,T)##, internal energy ##U(\rho,T)##, enthalpy ##H(\rho,T)##, entropy ##S(\rho,T)##, Gibbs free energy ##G(\rho,T)##, specific heat at constant volume ##c_v(\rho,T)## and specific heat at constant pressure ##c_p(\rho,T)## are also given.
Pardon me, but I still do not understand what you are suggesting me to do. I only know initial pressure and initial temperature (uncompressed state) and I know exactly how the volume changes during compression (even as a function of time, if needed), so that it came natural to me to numerically integrate at disctretized volume intervals.
My aim, as said, is to estimate pressure and temperature at full compression.
My suggestion applies if you are given (analytically) only Helmholtz free energy A as a function of molar density and temperature. If you are given entropy S analytically as a faction of molar density and temperature, then you just solve for T vs rho along a path where S is constant.

Chestermiller said:
My suggestion applies if you are given (analytically) only Helmholtz free energy A as a function of molar density and temperature. If you are given entropy S analytically as a faction of molar density and temperature, then you just solve for T vs rho along a path where S is constant.

Thanks, maybe I'm starting to understand. However, I don't get how I could find a solution without the step-by-step numerical integration.

I know the initial pressure ##P_i## and the initial temperature ##T_i## (uncompressed state) and all possible volumes during compression (at all instants).
An accurate, explicit analytic expression for ##A(\rho,T)## is given. An explicit formula for the pressure ##P(\rho,T)## is also given.

##A(\rho,T)## is an intricate mixture of polynomial and exponential functions, so is ##P(\rho,T)## as a consequence, hence no exact solution for ##\rho(P,T)## exist.
Thus, I use Newton-Raphson method to get an arbitrarily good approximation of the actual solution of the equation ##P(\rho,T)-P_i=0##. As a result, I get the initial density ##\rho_i##.
I know the initial volume ##V_i## (uncompressed state) and the final volume ##V_f## (fully compressed state), hence I can calculate the final density ##\rho_f##.

Now, as you stated, a condition for constant entropy is:
$$\left( \frac{\partial T}{\partial \rho}\right)_S=\frac{(\partial^2 A/\partial T\partial \rho)}{(\partial^2 A/\partial T^2)}$$
As said, I can use an accurate, explicit analytic expression for ##A(\rho,T)## and I can "easily" differentiate it.
Thus, I can get an accurate, explicit analytic function for ##(\partial^2 A/\partial T\partial \rho)/(\partial^2 A/\partial T^2)##, let's call it ##\alpha_S(\rho,T)##.

And now I'm stuck again...
In order to find the final temperature ##T_f## I would still need to integrate ##\alpha_S(\rho,T)## numerically, at discrete intervals from ##\rho_i## to ##\rho_f##.
After calculating ##T_f## that way, I use it together with ##\rho_f## in the explicit expression ##P(\rho,T)## to get ##P_f##.

Did I miss anything (pretty sure I did, as this method is pretty much the same as the original one I had in my mind)? Any suggestions to avoid the numerical step-by-step integration?
Thanks a lot.

SEE NEXT POST

Last edited:
Wait, perhaps I've been blind since the beginning.
I amend my previous post as follows...

I know the initial pressure ##P_i## and the initial temperature ##T_i## (uncompressed state) and all possible volumes during compression (at all instants).

An accurate, explicit analytic expression for ##A(\rho,T)## is given.
An explicit formula for the pressure ##P(\rho,T)## is also given.
An explicit formula for the entropy ##S(\rho,T)## is also given.

##A(\rho,T)## is an intricate mixture of polynomial and exponential functions, so is ##P(\rho,T)## as a consequence, hence no exact solution for the "inverse function" ##\rho_i=\rho(P_i,T_i)## exists.

Thus, I use Newton-Raphson method to get an arbitrarily good approximation of the actual solution of the equation ##P(\rho,T_i)-P_i=0##.
As a result, I get the initial density ##\rho_i##.

I know the initial volume ##V_i## (uncompressed state) and the final volume ##V_f## (fully compressed state), hence I can calculate the final density ##\rho_f## (since I just got ##\rho_i##, and the number of moles ##n## is constant).

As for entropy, i can calculate it in the initial state, i.e. ##S(\rho_i,T_i)##.
Condition for constant entropy: ##S(\rho_i,T_i)=S(\rho_f,T_f)##.
Again, no exact solution for the "inverse function" ##T_f=T(\rho_f,S)## exists.
Once again I use Newton-Raphson method to get an arbitrarily good approximation of the actual solution of the equation ##S(\rho_f,T)-S(\rho_i,T_i)=0##.
As a result, I get the final temperature ##T_f##.
Last step will be plugging ##\rho_f## and ##T_f## into the explicit known formula ##P(\rho,T)## to get the final pressure ##P_f##.

Do you notice any problem in doing so? Would you suggest any simpler approach?

FranzS said:
Wait, perhaps I've been blind since the beginning.
I amend my previous post as follows...

I know the initial pressure ##P_i## and the initial temperature ##T_i## (uncompressed state) and all possible volumes during compression (at all instants).

An accurate, explicit analytic expression for ##A(\rho,T)## is given.
An explicit formula for the pressure ##P(\rho,T)## is also given.
An explicit formula for the entropy ##S(\rho,T)## is also given.

##A(\rho,T)## is an intricate mixture of polynomial and exponential functions, so is ##P(\rho,T)## as a consequence, hence no exact solution for the "inverse function" ##\rho_i=\rho(P_i,T_i)## exists.

Thus, I use Newton-Raphson method to get an arbitrarily good approximation of the actual solution of the equation ##P(\rho,T_i)-P_i=0##.
As a result, I get the initial density ##\rho_i##.

I know the initial volume ##V_i## (uncompressed state) and the final volume ##V_f## (fully compressed state), hence I can calculate the final density ##\rho_f## (since I just got ##\rho_i##, and the number of moles ##n## is constant).

As for entropy, i can calculate it in the initial state, i.e. ##S(\rho_i,T_i)##.
Condition for constant entropy: ##S(\rho_i,T_i)=S(\rho_f,T_f)##.
Again, no exact solution for the "inverse function" ##T_f=T(\rho_f,S)## exists.
Once again I use Newton-Raphson method to get an arbitrarily good approximation of the actual solution of the equation ##S(\rho_f,T)-S(\rho_i,T_i)=0##.
As a result, I get the final temperature ##T_f##.
Last step will be plugging ##\rho_f## and ##T_f## into the explicit known formula ##P(\rho,T)## to get the final pressure ##P_f##.

Do you notice any problem in doing so? Would you suggest any simpler approach?
No. This is excellent. I like your style as an analyst.

Chestermiller said:
No. This is excellent. I like your style as an analyst.
Thanks for your kind words and for taking your time to help me, I owe you.