chmarti1 / PYroMat

PYroMat thermodynamic properties in Python
http://pyromat.org
Other
73 stars 13 forks source link

Pressure inverse property routines for igmix #11

Closed danieljuschus closed 3 years ago

danieljuschus commented 3 years ago

Why doesn't the igmix class have the inverse methods p_s and p_d (which ig does have)? Wouldn't this work in the same way as _invT, or am I missing some details from thermodynamics?

chmarti1 commented 3 years ago

Good question! I'm actually working to re-design the ideal gas interface right now, and that's one of the shortcomings I'm planning to fix.

In the meantime, there's good news... you don't actually need special iterative routines to evaluate those quantities anyway. Yes, ideal gas theory gives us straightforward formulae.

To calculate pressure from density, you can simply use the ideal gas law. Just calculate R or mean molecular weight for the mixture and use that to calculate p.

p = d R T OR p mw = d Ru * T

where mw is the molecular weight and Ru is the molar (universal) ideal gas constant.

To calculate pressure from entropy, you can just use the ideal gas law for entropy:

s(T,p) = s(T,p0) - R ln(p / p0)

s(T,p0) is entropy as a function of temperature at a reference pressure. p0 is the reference pressure. R is the ideal gas constant. If you know s(T,p) and you know T, you can solve for p.

I am working on an alpha release now that will standardize the ideal gas interface so there is better inverse support across all of the different classes.

Regards,

Christopher R. Martin Ph.D.

Assistant Professor of Mechanical Engineering

Penn State University - Altoona College

(+1 814) 949-5227

https://sites.psu.edu/cmartin


From: Daniel Juschus notifications@github.com Sent: Wednesday, February 17, 2021 6:26 AM To: chmarti1/PYroMat PYroMat@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [chmarti1/PYroMat] Pressure inverse property routines for igmix (#11)

Why doesn't the igmix class have the inverse methods p_s and p_d (which ig does have)? Wouldn't this work in the same way as _invT, or am I missing some details from thermodynamics?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchmarti1%2FPYroMat%2Fissues%2F11&data=04%7C01%7Ccrm28%40psu.edu%7C57e218f6f0b943a84b0e08d8d336d29a%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637491579705104645%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=oexpxAL85Kvx80nSIAx07cr7%2FwvGcJwzXM2bAjOeD9Q%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEVXQ4SZKTJUYM2AHPIHGELS7ORU7ANCNFSM4XYFRLIQ&data=04%7C01%7Ccrm28%40psu.edu%7C57e218f6f0b943a84b0e08d8d336d29a%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637491579705114637%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=t3Nr103XUFJ6ctt03ba07YbIaOhHoKS6czcqF21D59Y%3D&reserved=0.

danieljuschus commented 3 years ago

Thanks for clearing that up, it seems like I got confused about my thermodynamics for a second. In the meantime I have implemented it myself in a very simple way using scipy.optimize:

def p_s(s, t):
    def func(p):
        return air.s(t, p) - s
    return optimize.newton(func, 1.)

So why did you implement the inverse temperature methods iterationally? Is it because of the temperature dependence of cp?

chmarti1 commented 3 years ago

Yes. Only perfect gases can use explicit inversion. The heat capacity is a complicated polynomial on temperature, and some models use non-polynomial terms as well. That established, there isn't a good explicit method to invert properties on temperature.

If you look at monoatomic species like argon, they behave much more like a perfect gas (constant cp). Why?

For a species that acts like a simple sphere, its only effective means for storing energy is by translation (flying around through space). Molecules with more complicated shapes have more complicated mechanisms for storing internal energy (they can vibrate and spin as well as fly around in a straight line). As temperature is increased, these more complicated modes "kick-in" and start increasing the apparent specific heat.

http://hyperphysics.phy-astr.gsu.edu/hbase/thermo/inteng.html#c4

For electrically conductive solids, there's a whole other conversation

http://hyperphysics.phy-astr.gsu.edu/hbase/thermo/Dulong.html#c1


From: Daniel Juschus notifications@github.com Sent: Wednesday, February 17, 2021 9:46 AM To: chmarti1/PYroMat PYroMat@noreply.github.com Cc: Martin, Christopher Reed crm28@psu.edu; Comment comment@noreply.github.com Subject: Re: [chmarti1/PYroMat] Pressure inverse property routines for igmix (#11)

Thanks for clearing that up, it seems like I got confused about my thermodynamics for a second. In the meantime I have implemented it myself in a very simple way using scipy.optimize:

def p_s(s, t): def func(p): return air.s(t, p) - s return optimize.newton(func, 1.)

So why did you implement the inverse temperature methods iterationally? Is it because of the temperature dependence of cp?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fchmarti1%2FPYroMat%2Fissues%2F11%23issuecomment-780605041&data=04%7C01%7Ccrm28%40psu.edu%7C270b006a7bd44b3a061808d8d352d352%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637491699970316264%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MRhLvtcMOnQZPtD4RKBXLUXVCXfU76YEskKgCgm7gLs%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEVXQ4QHGOSCJ6RJI55GTELS7PJEXANCNFSM4XYFRLIQ&data=04%7C01%7Ccrm28%40psu.edu%7C270b006a7bd44b3a061808d8d352d352%7C7cf48d453ddb4389a9c1c115526eb52e%7C0%7C0%7C637491699970326257%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MNJFAe7lQwlWduG8noBEXB6Qjz%2Br%2BP%2F9KF78aIn9eLM%3D&reserved=0.