import numpy as np import matplotlib.pyplot as plt # Subcooling temperature where high subcooling diamter is reached Tsub1 = 13.5 # Reference diameter for high subcooling temperature d1 = 0.00015 # Subcooling temperature where low subcooling diamter is reached Tsub2 = 0 # Reference diameter for low subcooling temperature d2 = 0.0015 # Liquid temperature array Tl = np.arange(80, 115, 0.5) # Saturation temperature Tsat = 100 # Subcooling temperature Tsub = Tl - Tsat # Create and array to hold diamter values d = np.zeros(len(Tsub)) # Calculate actual diameter for particular subcooling for index, value in enumerate(Tsub): d[index] = max(d1, min(d2, (d1*(value - Tsub2) + d2*(value - Tsub1))/(Tsub2 - Tsub1))) # Plot actual diameter as a function of subcooling plt.plot(Tsub, d) plt.xlabel("Tsub [K]") plt.ylabel("d [m]") plt.show()