function [ug]=ug(T) 
  %vapor specific internal energy [kJ/kg] at T [celsius] 
 
 Tsat=[0:10:370,374.15];
  %saturation temperature in celsius
  
  hvap=[2501,2519,2538,2556,2574,2592,2609,2626,2643,2660,2676,2691,2706,2720,2734,2747,2758,2769,2778,2786,2793,2798,2802,2803,2803,2801,2796,2790,2780,2766,2749,2727,2700,2666,2623,2565,2481,2331,2095];
  vvap=[206.146,106.422,57.836,32.929,19.546,12.045,7.6776,5.0453,3.4083,2.3609,1.6730,1.2101,0.89171,0.66832,.50866,.39257,.30685,.24262,.19385,.15635,.12719,.104265,.086062,.071472,.059674,.05056,.042149,.035599,.030133,.025537,.021643,.018316,.015451,.012967,.010779,.008805,.006943,.00493,.00317];%
  Psat=[0.006112,0.012271,0.023368,0.042418,0.073750,0.12335,0.19919,0.31161,0.47358,0.70109,1.01325,1.4327,1.9854,2.7011,3.6136,4.7597,6.1804,7.9202,10.027,12.553,15.550,19.080,23.202,27.979,33.480,39.776,46.941,55.052,64.191,74.449,85.917,98.694,112.89,128.64,146.08,165.37,186.74,210.53,221.2];
  uvap=hvap-(1e5*Psat.*vvap)/1e3;
 %vapor saturation internal energy in kJ/kg

ug=interp1(Tsat,uvap,T);
