You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Via a conversation with Jacob, some diffuser problems lead to a desire to handle h&s. For example, for a known inlet velocity, pressure and temperature, and an outlet condition of zero velocity, the outlet state can be computed from the first law (yielding h) and the isentropic assumption for an ideal diffuser.
This is probably possible for any substances via some type of iteration. But for ideal gases it's nearly trivial, due to the dependence of h/e on T only.
Looking at program flow in argparse (e.g. for ig.py: 234), every time you're given h or e, T is always directly calculated by iteration and doesn't depend on any of the other basic properties:
T=np.full_like(y, 0.5*(self.data['Tlim'][0] +self.data['Tlim'][-1]))
I=np.ones_like(y,dtype=bool)
...
self._iter1(invfn, 'T', y, T, I, self.data['Tlim'][0], self.data['Tlim'][-1])
So I propose we insert this code in the initial argument setup of _argparse, similarly to how we deal with v. If h or e are in the args, replace them with T by iterating immediately and then continue with the algorithm (this is what you're actually doing anyway, you're just blocking that case). I changed the tests to allow for h&s and e&s, and then made an implementation that passes all those tests, which I will link in a comment.
The text was updated successfully, but these errors were encountered:
Ok, branch issue83 has the methods and all ig tests pass. The big changes are as follows:
Change the inverse_args check to only error on the h&e combo.
Immediately error if T & h/e are specified in the initial arg unit conversion
Replace h/e with T in the unit conversion similarly to how v is handled.
cleanup the inverse_args codes, because the only remaining inverse_arg possible is entropy.
Still needs doing:
5) Improve comments on the algorithm, now that the rules for inverse_args are changed.
6) Consider a more elegant way to do this. For example, we could call T, h and e calorific args and only allow one of those to be passed in. FWIW I like this a lot and would implement if you like, because it cleans up the way that 1,2 & 3 are handled to be more straightforward.
Thoughts appreciated. Since this was done in a branch, we can easily pull request when we're ready to consider whether it belongs in the main branch.
I agree. This is worth implementing. It would still be nice to see this problem solved well for multi-phase substances, but you make the point well - it's easy for gases, so let's do it. Give me some time to work through it all, and I'll fold it in to the master branch with the next release.
Do you want me to take a crack at update 6) to clean up my proposal or give you a chance to dig into it and rework it your own way? Either way is fine by me.
Via a conversation with Jacob, some diffuser problems lead to a desire to handle h&s. For example, for a known inlet velocity, pressure and temperature, and an outlet condition of zero velocity, the outlet state can be computed from the first law (yielding h) and the isentropic assumption for an ideal diffuser.
This is probably possible for any substances via some type of iteration. But for ideal gases it's nearly trivial, due to the dependence of h/e on T only.
Looking at program flow in argparse (e.g. for ig.py: 234), every time you're given h or e, T is always directly calculated by iteration and doesn't depend on any of the other basic properties:
So I propose we insert this code in the initial argument setup of _argparse, similarly to how we deal with
v
. Ifh
ore
are in the args, replace them with T by iterating immediately and then continue with the algorithm (this is what you're actually doing anyway, you're just blocking that case). I changed the tests to allow for h&s and e&s, and then made an implementation that passes all those tests, which I will link in a comment.The text was updated successfully, but these errors were encountered: