-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PartialSimpleIdealGasMedium uses different offsets in BaseProperties and in specificInternalEnergy #1530
Comments
Comment by hubertus on 27 Jun 2014 21:43 UTC |
Comment by hubertus on 27 Jun 2014 21:52 UTC |
Changelog modified by hubertus on 27 Jun 2014 21:52 UTC |
Comment by hnaderan on 5 Dec 2014 14:56 UTC
which for ideal gas becomes:
anonymousor if calculating internal energy from enthalpy:
So the previous equation in BaseProperties was correct and the one in specificInternalEnergyshould have been changed to:
This will set the internal energy and enthalpy references correctly. In its current form, both internal energy and enthalpy are zero at T0 which is wrong. Also for temperatures less than T0 the internal energy will become greater than enthalpy which is also wrong in thermodynamics. |
Comment by hubertus on 5 Dec 2014 15:09 UTC
This is consistent with how the much more complex NASA ideal gas is implemented, where the reference temperature can be set to either 0 K or 25 Deg Celsius. What the commenter writes may however be true for a "Perfect Gas", I'd have to check that, and typically a "Perfect Gas" has a constant cp. This is however not consistent in the literature and a model with a constant cp is also referred to as an "ideal gas". |
Comment by hnaderan on 6 Dec 2014 18:50 UTC
This holds true for every substance, ideal gas, perfect gas or whatever else. Since p and v are both always positive, at any thermodynamic state h is always greater than u regardless of the material model or the reference state. I mentioned this as an obvious indication for the incorrect formula used in the specificInternalEnergy function. Actually, I stumbled on this bug in a more complex model which I was getting nonphysical results and by creating a simple benchmark test case, I became confident that internal energy calculation was wrong. Indeed reading the code revealed the incorrect formula. If you like, I can send the test case to you. Further reading down the code, the formula for calculation of specificHelholtzEnergy function is also incorrect. It says:
which the first term on the right hand side is inconsistent with the enthalpy reference taken at T0. I have changed my version of this function to:
This way, the fix to the specificInternalEnergy does not have to be duplicated here. H.Naderan Assistant professor Mechanical Engineering Department Amirkabir University of Technology |
Comment by otter on 6 Jan 2015 18:56 UTC
In SingleGasNasa the following equations are present:
I did not find the place where the reference temperature is set. But independently of the reference point (assuming that the same "data" is used), then it follows from the above equations:
Therefore, also for the NASA medium the equation h = u + p*v holds, as it should be. My conclusion: The medium should be fixed as proposed in the ticket. |
Modified by mwetter on 9 Jan 2015 16:57 UTC |
Modified by beutlich on 4 Mar 2015 21:40 UTC |
Comment by hubertus on 22 Jun 2015 14:27 UTC |
Comment by hubertus on 22 Jun 2015 15:00 UTC |
Reported by otter on 27 Jun 2014 15:53 UTC
When simulating the test model ModelicaTest.Media.TestAllProperties.SimpleAir an error occurs. The reason are different offsets in the medium model.
In PartialSimpleIdealGasMedium.BaseProperties:
In PartialSimpleIdealGasMedium.specificInternalEnergy:
Therefore in the first case the offset is
cp_const*T0
and in the second case it is
(cp_const - R)*T0
Migrated-From: https://trac.modelica.org/Modelica/ticket/1530
The text was updated successfully, but these errors were encountered: