Skip to content
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

There is a problem with temperature-entalpy with air as ideal gas #77

Closed
DanielSarmiento04 opened this issue Nov 20, 2022 · 5 comments
Closed

Comments

@DanielSarmiento04
Copy link

I am testing the property values on different fluids. so far, i have seen an error with the values

Context => suppose I want to find the enthalpy of air in KJ/kg at 300K


import pyromat as pm

air = pm.get("ig.air")
T_1 = 300 #Kelvin
h_1 = air.h(T=T_1)

The result of this operation is -2.407 KJ/Kg

I made the same in the website

image

Compared to other guide tables as Yinus Cengel

image

@jranalli
Copy link
Collaborator

This issue actually just deals with reference state. The absolute value for enthalpy is arbitrary, and what really matters for problems in thermo is the difference between enthalpies at two temperatures.

That is, we never know exactly what the enthalpy is at any given temperature, we just assign it to have a zero value somewhere. But since any process for which we're interested in the enthalpy involves a change from one state to another, the exact location of that zero state isn't important as long as it's consistent. So for example, I generated the values from 300 through 330, setting the value at 300K to be 300.19, as in your textbook:

air = pm.get('ig.air')
T = np.array([300, 305, 310, 315, 320, 325, 330])
h = air.h(T=T) - air.h(T=T[0]) + 300.19

Results of that from Pyromat match your table relatively closely:

T   | h
300 | 300.19
305 | 305.2149
310 | 310.2413
315 | 315.2694
320 | 320.2992
325 | 325.3308
330 | 330.3643

The only time that we need to know more than a difference in enthalpy is when you have chemical reactions, which means the makeup of the substance itself changes. In that case, you do need to represent something like the absolute value (relative to chemical building blocks at least) that we call the enthalpy of formation. There's probably a table of those values in your textbook as well for dealing with chemical reactions.

In general, different tables or data sources may use different reference states and thus you may see different absolute values for the enthalpy when looking at those numbers in different places. That's particularly true when dealing with something like air, which isn't a pure substance, but rather a mixture of several gases. Depending on how you define the reference state for each of those component gases, and how you represent the mixture will lead to differences in what numbers you see in that table. But even comparing data sources, if you take the difference between the enthalpies at two different temperatures, your results should still be pretty close.

@DanielSarmiento04
Copy link
Author

DanielSarmiento04 commented Nov 22, 2022

Thank you Joe Ranalli, I managed to understand the explanation, I made the same process with another ideal gas as nitrogen

pm.config['unit_matter'] = 'kmol'
nitrogen = pm.get('ig.N2')
T = np.linspace(220,400,4,)
h = nitrogen.h(T=T) - nitrogen.h(T=T[0])+ 6391

Feedback and interesting functionalities
=>

  1. Good way implement Numpy library, comparing with other software as EES, the speed and logic is good.
  2. The documentation is good, although personally I would give more examples implementing it with cycles like Brayton

Required properties for fluids.

  1. Dynamica viscosity
  2. static viscosity

@chmarti1
Copy link
Owner

chmarti1 commented Nov 22, 2022

Thanks for raising the issue!

The question is also addressed in FAQ, and in substantial detail in the PYroMat User and Development Handbook section 6.1.7, page 80.

We have plans to expand them, but take a look at the How-To and FAQ page. We specifically give example code for solving Brayton and Rankine cycle analysis.

If you want more examples, users have generated some excellent videos giving more detailed examples. For example, see this Rankine cycle video.

Thanks for reaching out, and thanks for using PYroMat!

@DanielSarmiento04
Copy link
Author

I have been using the library for the past few months in parallel to a thermodynamics course
I like the piromat ecosystem

I made this repository when I used for solve Brayton, Rankine and combine Cicle, these example you can use for tutorials.

Another suggestion that I found is the next

  • Simply code
    Normally, for optimize time processed and debugger I use
    state_x = 'fluid'.state('propierties')

this return a dictionary and for mapping the information we have to use .get dictionary method
h_x = state_x.get('h')
something to improve is use the status type objects

  • Example
class State(object):
   h
   s
   T
   v
  # Some propierties

and then use h_x = state_x.h

@jranalli
Copy link
Collaborator

@DanielSarmiento04 I agree with Chris that your suggestion is interesting.

For now though, there are some simpler ways you could use state. For example, in Ejercicio 14/main.ipynb.

You could access like this:

trabajo_compresor = estado_2['h'] - estado_1['h']

Or if you want to have each variable:

h_1, s_1, T_1, v_1 = [estado_1[i][0] for i in ['h','s','T','v']]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants