-
Notifications
You must be signed in to change notification settings - Fork 13
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
Code from Live-Page of PYroMat #85
Comments
@jettrich thanks for your interest! It turns out that the code that draws that graph is pretty extensive, because there's a lot of fiddling that goes into figuring out exactly which lines will have decent spacing. It also depends a bit on how perfect you'd like it to look. For example, some of the phase transitions on enthalpy isolines in my plot do not show the exact intersection with the steam dome. So that said, I put together a demo file that will plot a similar diagram to the live page. You can see it here. There are several helper functions that only exist to quickly gather data for the steam dome and isolines, while the real plotting happens in this section. if __name__ == "__main__":
water = pm.get("mp.H2O")
sd_data = compute_steam_dome(water)
plt.figure()
plt.xlabel('s (kJ/kg-K)')
plt.ylabel('T (K)')
# Steam Dome
for line in ['liquid', 'vapor']:
plt.plot(sd_data[line]['s'], sd_data[line]['T'], 'k-')
# P isolines
for line in compute_iso_line(water, p=0, n=25, default=True):
plt.plot(line['s'], line['T'], 'r-')
# v isolines
for line in compute_iso_line(water, v=0, n=25, default=True):
plt.plot(line['s'], line['T'], 'b-')
# h isolines
for line in compute_iso_line(water, h=0, n=25, default=True):
plt.plot(line['s'], line['T'], 'g-')
plt.show() I'm not sure what your starting point is as far as python knowledge goes, but if this is too much of a mess to jump right into, please say so and I can try to make a simpler introduction. |
Dear chmarti1,
I'm highly interested in using PYroMat for creating state diagrams and illustrating thermodynamic processes and cycles for my students, and I'd love to see the source code used to draw the T,s-diagram on the live site of the PYroMat website. Please, could you provide me with the code, in order to ease my point of entry in using PYroMat?
Kind Regards
Jörg
The text was updated successfully, but these errors were encountered: