%-------------------------------------------------------------------------%
%Filename:  NusseltCalc.m
%Authors:   Sam Wilding & Oliver Johnson
%Date:      March 2010
%
%This file will calculate Nusselt numbers from user input using appropriate
%Nusselt number correlations as given in "Fundamentals of Heat and Mass
%Transfer" by Incropera/DeWitt/Bergman/Lavine
%-------------------------------------------------------------------------%

function [] = NusseltCalc()

clear all
close all
clc

% Initialize Nu vector for all Nu that are applicable
Nu = cell(31,2);
for i = 1:31
    Nu{i,2} = 'Correlation Does Not Apply';
end

% Initialize shortpipe condition to false
shortpipe = 0;

% Available fluids
FluidMenu = {'Air (air)',...                    %1
    'Ammonia (nh3)',...                         %2
    'Carbon dioxide (co2)',...                  %3
    'Carbon monoxide (co)',...                  %4
    'Helium (he)',...                           %5
    'Hydrogen (h2)',...                         %6
    'Nitrogen (n2)',...                         %7
    'Oxygen (o2)',...                           %8
    'Water Vapor (steam)',...                   %9
    'Unused Engine Oil (oil)',...               %10
    'Ethylene Glycol (eth_gly)',...             %11
    'Glycerin (glyc)',...                       %12
    'Refrigerant-132a (r132a)',...              %13
    'Refrigerant-22 (r22)',...                  %14
    'Mercury (hg)',...                          %15
    'Saturated Liquid Water (h20_satliq)',...   %16
    'Saturaged Water Vapor (h20_satvap)',...    %17
    'Liquid/Vapor Water Mixture (h20_mix)'};    %18

FluidList = {'air',...  %1
    'nh3',...           %2
    'co2',...           %3
    'co',...            %4
    'he',...            %5
    'h2',...            %6
    'n2',...            %7
    'o2',...            %8
    'steam',...         %9
    'oil',...           %10
    'eth_gly',...       %11
    'glyc',...          %12
    'r132a',...         %13
    'r22',...           %14
    'hg',...            %15
    'h20_satliq',...    %16
    'h20_satvap',...    %17
    'h20_mix'};         %18

% Prompt user to choose fluid
[fluidNum,ok] = listdlg('PromptString','Select a fluid:',...
    'SelectionMode','single',...
    'ListString',FluidMenu);

fluid = FluidList{fluidNum};

if isequal(fluid,'h20_mix')
    prompt = {'Mixture Quality:'};
    dlg_title = 'Saturated Liquid/Vapor Water Mixture Quality';
    num_lines = 1;
    qualitySTR = inputdlg(prompt,dlg_title,num_lines);
    quality = str2double(qualitySTR);
else
    quality = NaN;
end

% Prompt user to input the type of problem: Internal/External Flow
choice1 = questdlg('Please choose a forced convection problem:', ...
    'Convection Configuration', ...
    'Internal Flow','External Flow','Cancel','Cancel');
switch choice1
    case 'Internal Flow'
        config = 1;
    case 'External Flow'
        config = 2;
    case 'Cancel'
        disp('Program terminated by user.')
        config = 0;
        return
end

% Internal Flow Case
if config == 1;
    % User input for the type of geometry
    choice2 = questdlg('Please choose your geometry:', ...
        'Problem Geometry', ...
        'Circular Pipe','Non-Circular Pipe','Cancel','Cancel');
    switch choice2
        case 'Circular Pipe'
            geometry = 1;
        case 'Non-Circular Pipe'
            geometry = 2;
        case 'Cancel'
            disp('Program terminated by user.')
            config = 0;
            return
    end
    
    % Prompt user for important parameters
    if geometry == 1    % Circular Pipe Case
        prompt = {'Fluid Velocity (m/s):',...
            'Mass Flow Rate (kg/s):',...
            'Tmi (K):',...
            'Tmo (K):',...
            'Ts (K):',...
            'q"s (W/m^2):',...
            'Diameter (m):',...
            'Pipe Length (m):',...
            'f:'};
        dlg_title = 'Model Parameters';
        num_lines = 1;
        paramsSTR = inputdlg(prompt,dlg_title,num_lines);
        params = str2double(paramsSTR);
        
        %extract parameter values
        v = params(1);      % velocity in m/s
        mdot = params(2);   % mass flow rate in kg/s
        Tmi = params(3);    % inlet temperature in K
        Tmo = params(4);    % outlet temperature in K
        Ts = params(5);     % surface temperature in K
        qs = params(6);     % surface heat flux in W/m^2
        D = params(7);      % characteristic diameter in m
        L = params(8);      % pipe length in m
        f = params(9);      % friction factor
        
        if isnan(Ts)
            prompt = {'Ts (K):'};
        dlg_title = 'Surface Temperature Guess';
        num_lines = 1;
        TsSTR = inputdlg(prompt,dlg_title,num_lines);
        Ts = str2double(TsSTR);
        end
        
    elseif geometry == 2    %Non-Circular Pipe Case
        prompt = {'Fluid Velocity (m/s):',...
            'Mass Flow Rate (kg/s):',...
            'Tmi (K):',...
            'Tmo (K):',...
            'Ts (K):',...
            'q"s (W/m^2):',...
            'Length (m):',...
            'f:',...
            'P (m):',...
            'Ac (m^2):'};
        dlg_title = 'Model Parameters';
        num_lines = 1;
        paramsSTR = inputdlg(prompt,dlg_title,num_lines);
        params = str2double(paramsSTR);
        
        %extract parameter values
        v = params(1);
        mdot = params(2);
        Tmi = params(3);
        Tmo = params(4);
        Ts = params(5);
        qs = params(6);
        L = params(7);
        f = params(8);
        P = params(9);
        Ac = params(10);
        
        if isnan(Ts)
            prompt = {'Ts (K):'};
            dlg_title = 'Surface Temperature Guess';
            num_lines = 1;
            TsSTR = inputdlg(prompt,dlg_title,num_lines);
            Ts = str2double(TsSTR);
        end
        
    else
        disp('Error: incorrect user input.')
        return
    end
    
    % External Flow Case
elseif config ==2
    % User input for the type of geometry
    choice2 = questdlg('Please choose your geometry:', ...
        'Problem Geometry', ...
        'Flat Plate','Cylinder in Cross-flow','Sphere','Flat Plate');
    switch choice2
        case 'Flat Plate'
            geometry = 3;
        case 'Cylinder in Cross-flow'
            geometry = 4;
        case 'Sphere'
            geometry = 5;
    end
    
    if geometry == 3    %Flat Plate Case
        prompt = {'Fluid Velocity (m/s):',...
            'Tinf (K):',...
            'Ts (K):',...
            'q"s (W/m^2):',...
            'Length (m):',...
            'Unheated Starting Length (m):'};
        dlg_title = 'Model Parameters';
        num_lines = 1;
        paramsSTR = inputdlg(prompt,dlg_title,num_lines);
        params = str2double(paramsSTR);
        
        %extract parameter values
        v = params(1);
        Tinf = params(2);
        Ts = params(3);
        qs = params(4);
        D = params(5);
        Xi = params(6);
        
        if isnan(Ts)
            prompt = {'Ts (K):'};
            dlg_title = 'Surface Temperature Guess';
            num_lines = 1;
            TsSTR = inputdlg(prompt,dlg_title,num_lines);
            Ts = str2double(TsSTR);
        end
        
    elseif geometry == 4    %Cylinder in Cross-flow Case
        prompt = {'Fluid Velocity (m/s):',...
            'Tinf (K):',...
            'Ts (K):',...
            'q"s (W/m^2):',...
            'Diameter (m):'};
        dlg_title = 'Model Parameters';
        num_lines = 1;
        paramsSTR = inputdlg(prompt,dlg_title,num_lines);
        params = str2double(paramsSTR);
        
        %extract parameter values
        v = params(1);
        Tinf = params(2);
        Ts = params(3);
        qs = params(4);
        D = params(5);
  
        if isnan(Ts)
            prompt = {'Ts (K):'};
            dlg_title = 'Surface Temperature Guess';
            num_lines = 1;
            TsSTR = inputdlg(prompt,dlg_title,num_lines);
            Ts = str2double(TsSTR);
        end
        
    elseif geometry == 5    %Sphere Case
        prompt = {'Fluid Velocity (m/s):',...
            'Tinf (K):',...
            'Ts (K):',...
            'q"s (W/m^2):',...
            'Diameter (m):'};
        dlg_title = 'Model Parameters';
        num_lines = 1;
        paramsSTR = inputdlg(prompt,dlg_title,num_lines);
        params = str2double(paramsSTR);
        
        %extract parameter values
        v = params(1);
        Tinf = params(2);
        Ts = params(3);
        qs = params(4);
        D = params(5);
 
        if isnan(Ts)
            prompt = {'Ts (K):'};
            dlg_title = 'Surface Temperature Guess';
            num_lines = 1;
            TsSTR = inputdlg(prompt,dlg_title,num_lines);
            Ts = str2double(TsSTR);
        end
        
        choice3 = questdlg('Freely Falling Liquid Drops?:', ...
            'Optional Configuration', ...
            'Yes','No','Cancel','Cancel');
        % Handle response
        switch choice3
            case 'Yes'
                ffld = 1;
            case 'No'
                ffld = 0;
            case 'Cancel'
                disp('Program terminated by user.')
                return
        end
        
    else
        disp('Error: incorrect user input.')
        return
    end
    
else
    disp('Error: incorrect user input.')
    return
end

% Calculate Nusselt Numbers
if config == 2; % External Flow
    % Find fluid properties at film temperature
    Tf = (Tinf+Ts)/2;
    [rho,mu,nu,Pr] = props(fluid,Tf,quality);
    
    % Fixed Surface Temperature
    if geometry == 3; % Flat Plate, Parallel Flow
        Re = v*D/nu;
        xcritical = 5e5*nu/v;
        if isnan(qs) && isnan(Xi);
            if D <= 1.05*xcritical % Laminar
                if Pr >= 0.6
                    Nu{1,1} = 0.332*Re^(1/2)*Pr^(1/3);  %Eq. 7.23
                    Nu{1,2} = 'Eq. 7.23';
                    if Re < 5.3e5
                        Nu{2,1} = 0.664*Re^(1/2)*Pr^(1/3);    %Eq. 7.30
                        Nu{2,2} = 'Eq. 7.30';
                    end
                end
                
                % Liquid Metals
                if isequal('hg',fluid) && Pr <= 0.05 && Pr*Re >= 100
                    Nu{3,1} = 0.565*(Re*Pr)^(1/2);   %Eq. 7.32
                    Nu{3,2} = 'Eq. 7.32';
                end
                
                % Churchill-Ozoe
                if Pr*Re >= 100
                    Nu{4,1} = 0.3387*Re^(1/2)*Pr^(1/3)/(1+(0.0468/Pr)^(2/3))^(1/4);  %Eq. 7.33
                    Nu{4,2} = 'Eq. 7.33 (Churchill-Ozoe)';
                    if Re < 5.3e5
                        Nu{5,1} = 2*Nu;
                        Nu{5,2} = 'Nu_ave ';
                    end
                end
                
                
            elseif D > 1.05*xcritical && D < 20*xcritical % Mixed Laminar/Turbulent
                if Pr > 0.6 && Pr < 60
                    Nu{6,1} = (0.037*Re^(4/5)-871)*Pr^(1/3);  %Eq. 7.38
                    Nu{6,2} = 'Eq. 7.38';
                end
                
                
            elseif D >= 20*xcritical % Fully Turbulent
                if Pr > 0.6 && Pr < 60
                    Nu{7,1} = 0.0296*Re^(4/5)*Pr^(1/3);  %Eq. 7.36
                    Nu{7,2} = 'Eq. 7.36';
                end
                if Re > 10^8
                    Nu{8,1} = 0.037*Re^(4/5)*Pr^(1/3);    %Eq. 7.38
                    Nu{8,2} = 'Eq. 7.38';
                end
            end
            
            
            % Unheated Starting Length
        elseif isnan(qs) && ~isnan(Xi)
            if Re < 5e5     %Laminar
                Nu{9,1} = 0.332*Re^(1/2)*Pr^(1/3)/(1-(Xi/D)^(3/4))^(1/3);    %Eq. 7.42
                Nu{9,2} = 'Eq. 7.42';
            else            %Turbulent
                Nu{10,1} = 0.0296*Re^(1/2)*Pr^(1/3)/(1-(Xi/D)^(3/4))^(1/3);   %Eq. 7.43
                Nu{10,2} = 'Eq. 7.43';
            end
            
            
            % Fixed Heat Flux
        elseif isnan(Ts) && isnan(Xi)
            if Re < 5e5 && Pr >= 0.6
                Nu{11,1} = 0.453*Re^(1/2)*Pr^(1/3);   %Eq. 7.45
                Nu{11,2} = 'Eq. 7.45';
            elseif Re > 5e5 && Pr > 0.6 && Pr < 60
                Nu{12,1} = 0.0308*Re^(4/5)*Pr^(1/3);    %Eq. 7.46
                Nu{12,2} = 'Eq. 7.46';
            end
        end
        
        
        
        
    elseif geometry == 4; % Cylinder
        Re = v*D/nu;
        
        % Hilpert
        if Re > 0.4 && Re < 4e5 && Pr >= 0.6
            if Re >= 0.4 && Re < 4
                C = 0.989;
                m = 0.330;
            elseif Re >= 4 && Re < 40
                C = 0.911;
                m = 0.385;
            elseif Re >= 40 && Re < 4000
                C = 0.683;
                m = 0.466;
            elseif Re >= 4000 && Re < 40000
                C = 0.193;
                m = 0.618;
            elseif Re >=40000 && Re <= 400000
                C = 0.027;
                m = 0.805;
            end
            Nu{13,1} = C*Re^m*Pr^(1/3); %Eq. 7.52
            Nu{13,2} = 'Eq. 7.52 (Hilpert)';
        end
        
        % Churchill
        if Re*Pr >= 0.2
            Nu{14,1} = 0.3+0.62*Re^(1/2)*Pr^(1/3)*(1+(Re/282000)^(5/8))^(4/5)/(1+(0.4/Pr)^(2/3))^(1/4);  %Eq. 7.54
            Nu{14,2} = 'Eq. 7.54 (Churchill)';
        end
        
        % Zhukauskas
        [rhoinf,muinf,nuinf,Prinf] = props(fluid,Tinf,quality);
        [rhos,mus,nus,Prs] = props(fluid,Ts,quality);
        Reinf = v*D/nuinf;
        
        if Prinf > 0.7 && Prinf < 500 && Reinf > 1 && Reinf < 10^6
            if Reinf >= 1 && Reinf < 40
                C = 0.75;
                m = 0.4;
            elseif Reinf >= 40 && Reinf < 1000
                C = 0.51;
                m = 0.5;
            elseif Reinf >= 10^3 && Reinf < 2e5
                C = 0.26;
                m = 0.6;
            elseif Reinf >= 2e5 && Reinf < 1e6
                C = 0.076;
                m = 0.7;
            end
            
            if Prinf <= 10
                n = 0.37;
            else
                n = 0.36;
            end
            
            Nu{15,1} = C*Reinf^m*Prinf^n*(Prinf/Prs)^(1/4);  %Eq. 7.53
            Nu{15,2} = 'Eq. 7.53 (Zhukauskas)';
        end
        
        % Sphere
    elseif geometry == 5;
        
        % Whitaker
        [rhoinf,muinf,nuinf,Prinf] = props(fluid,Tinf,quality);
        [rhos,mus,nus,Prs] = props(fluid,Ts,quality);
        Reinf = v*D/nuinf;
        muratio = muinf/mus;
        if ffld == 0;
            if Prinf > 0.71 && Prinf < 380 && Reinf > 3.5 && Reinf < 7.6e4 && muratio > 1 && muratio < 3.2
                Nu{16,1} = 2+(0.4*Reinf^(1/2)+0.06*Reinf^(2/3))*Prinf^(0.4)*(muratio)^(1/4);   %Eq. 7.56
                Nu{16,2} = 'Eq. 7.56 (Whitaker)';
            end
            
            % Ranz and Marshall for freely falling liquid drops
        elseif ffld == 1;
            Nu{17,1} = 2+0.6*Reinf^(1/2)*Pr^(1/3);    %Eq. 7.57
            Nu{17,2} = 'Eq. 7.57 (Ranz and Marshall)';
        end
        
    end
    
    
elseif config == 1; % Internal Flow
    
    if geometry == 1; % Circular Pipe
        
        Tmave = (Tmi+Tmo)/2;
        [rho,mu,nu,Pr] = props(fluid,Tmave,quality);
        [rhos,mus,nus,Prs] = props(fluid,Ts,quality);
        
        if isnan(mdot);
            Re = rho*v*D/mu;
        elseif isnan(v);
            Re = 4*mdot/(pi*mu*D);
        end
        muratio=mu/mus;
        
        if Re < 2300 % Laminar
            xhydro = D*0.05*Re;
            xthermal = xhydro*Pr;
            xratio = xthermal/xhydro;
            S = (Re*Pr/(L/D))^(1/3)*(muratio)^0.14;
            if S >= 2
                if xratio >= 0.5 && xratio <= 1.5 && Pr > 0.48 && Pr < 16700 && muratio > 0.0044 && muratio < 9.75
                    Nu{18,1} = 1.86*S; %Eq. 8.57
                    Nu{18,2} = 'Eq. 8.57';
                elseif xratio > 1.5
                    Nu{19,1} = 3.66 + (0.0668*(D/L)*Re*Pr)/(1+0.04*((D/L)*Re*Pr)^(2/3));   %Eq. 8.56
                    Nu{19,2} = 'Eq. 8.56';
                end
            elseif S < 2
                if ~isnan(qs)
                    Nu{20,1} = 4.36;  %Eq. 8.53
                    Nu{20,2} = 'Eq. 8.53';
                    Nu{21,1} = Nu{20,1};
                    Nu{21,2} = 'Nu_ave';
                elseif ~isnan(Ts)
                    Nu{22,1} = 3.66;  %Eq. 8.55
                    Nu{22,2} = 'Eq. 8.55';
                    Nu{23,1} = Nu{22,1};
                    Nu{23,2} = 'Nu_ave';
                else
                    disp('Error: Cannot have Ts == const and qs == const simultaneously.')
                    return
                end
            end
            
        elseif Re  > 2300 % Turbulent
            
            if L < 60*D % Short Pipe
                L = 60*D*1.01; % This is here to calculate a fully developed Nu needed to find the Nu for a short pipe. 1.01 is 101% of fully developed length
                shortpipe = 1;
            end
            
            if ~isequal('hg',fluid)
                if isnan(qs) && isnan(f)
                    
                    % Dittus
                    if Pr > 0.7 && Pr < 160 && Re > 10000 && L > 60*D
                        if Ts > Tmave
                            n = 0.4;
                        elseif Ts < Tmave
                            n = 0.3;
                        end
                        Nu{24,1} = 0.023*Re^(4/5)*Pr^n;    %Eq. 8.60
                        Nu{24,2} = 'Eq. 8.60';
                        Nuave = Nu{24,1};
                    end
                    
                    
                elseif ~isnan(qs) || ~isnan(Ts)
                    if isnan(f)
                        % Sieder
                        if Pr > 0.7 && Pr < 16700 && Re > 10000 && L > 60*D
                            Nu{25,1} = 0.027*Re^(4/5)*Pr^(1/3)*(muratio)^0.14; %Eq. 8.61
                            Nu{25,2} = 'Eq. 8.61 (Sieder)';
                            Nuave = Nu{25,1};
                        end
                        
                        
                    elseif ~isnan(qs) || ~isnan(Ts) && ~isnan(f)
                        % Gnielinski
                        if Pr > 0.5 && Pr < 2000 && Re > 3000 && Re < 5e6 && L > 60*D
                            Nu{26,1} = (f/8)*(Re-1000)*Pr/(1+12.7*(f/8)^(1/2)*(Pr^(2/3)-1));   %Eq. 8.62
                            Nu{26,2} = 'Eq. 8.62 (Gnielinski)';
                            Nuave = Nu{26,1};
                        end
                    end
                end
                
            elseif isequal('hg',fluid)
                % Liquid Metals
                Pe = Pr*Re;
                if isnan(Ts) && ~isnan(qs)
                    if Pe > 100 && Pe < 10000 && Re > 3.63e3 && Re < 9.05e6
                        Nu{27,1} = 4.82+0.0185*(Pe)^0.287; %Eq. 8.64
                        Nu{27,2} = 'Eq. 8.64';
                        Nuave = Nu{27,1};
                    end
                elseif isnan(qs) && ~isnan(Ts)
                    if Pe >= 100
                        Nu{28,1} = 5+0.025*Pe^0.8; %Eq. 8.65
                        Nu{28,2} = 'Eq. 8.65';
                        Nuave = Nu{28,1};
                    end
                end
            end
        end
        
        if shortpipe == 1;
            C = 2.4254;
            m = 0.676;            
            Nu{29,1} = Nuave*(1+C/(L/D)^m); %Eq. 8.63
            Nu{29,2} = 'Eq. 8.63 (Short Tubes)';
        end
        
        
    elseif geometry == 2; % Non-Circular Cross Section
        Tmave = (Tmi+Tmo)/2;
        [rho,mu,nu,Pr] = props(fluid,Tmave,quality);
        [rhos,mus,nus,Prs] = props(fluid,Ts,quality);
        muratio=mu/mus;
        
        Dh = 4*Ac/P;
        if isnan(mdot);
            Reh = rho*v*Dh/mu;
        elseif isnan(v);
            Reh = 4*mdot/(pi*mu*Dh);
        end
        if Reh < 2300
            Nu{30,1} = 'See Table 8.1';
            Nu{30,2} = '';
        elseif Reh > 2300
            %     Sieder
            if Pr > 0.7 && Pr < 16700 && Reh > 10000
                if L > 60*Dh
                    Nu{31,1} = 0.027*Reh^(4/5)*Pr^(1/3)*(muratio)^0.14; %Eq. 8.61
                    Nu{31,2} = 'Eq. 8.61 (Sieder - Non-Circular Cross Section)';
                elseif L <= 60*Dh % Short Pipe
                    L = 60*Dh*1.01; % This is here to calculate a fully developed Nu needed to find the Nu for a short pipe. 1.01 is 101% of fully developed length
                    Nuave = 0.027*Reh^(4/5)*Pr^(1/3)*(muratio)^0.14; %Eq. 8.61
                    C = 2.4254;
                    m = 0.676;
                    Nu{29,1} = Nuave*(1+C/(L/Dh)^m); %Eq. 8.63
                    Nu{29,2} = 'Eq. 8.63 (Short Tubes)';        
                end
            end
        end
    end
end

results{1} = '    Nu               Correlation';
results{2} = '--------------      ------------------------';
counter = 3;
for i = 1:size(Nu,1)
    if ~isequal(Nu{i,1},[])
    results{counter} = [num2str(Nu{i,1}),'   ',Nu{i,2}];
    counter = counter+1;
    end
end
msgbox(results,'Results')

%-------------------------------------------------------------------------%
%Filename:  props.m
%Author:    Oliver Johnson
%Date:      3/30/2010
%
%This function interpolates from a table of fluid properties. This function
%assumes that all properties are at atmospheric pressure.  'fluid' is a
%user input string from the list below. T is a numeric temperature in
%Kelvin.
%
%Table values are from "Fundamentals of Heat and Mass Transfer" by
%Incropera/DeWitt/Bergman/Lavine.  Our thanks to Tom Ames for his work
%originally converting the tables into digital format.
%-------------------------------------------------------------------------%

function [rho,mu,nu,Pr] = props(fluid,T,quality)

% Available fluids
% FluidMenu = {'Air (air)',...
%     'Ammonia (nh3)',...
%     'Carbon dioxide (co2)',...
%     'Carbon monoxide (co)',...
%     'Helium (he)',...
%     'Hydrogen (h2)',...
%     'Nitrogen (n2)',...
%     'Oxygen (o2)',...
%     'Water Vapor (steam)',...
%     'Unused Engine Oil (oil)',...
%     'Ethylene Glycol (eth_gly)',...
%     'Glycerin (glyc)',...
%     'Refrigerant-132a (r132a)',...
%     'Refrigerant-22 (r22)',...
%     'Mercury (hg)',...
%     'Water (h20)'};

if(isequal('air',fluid))
    Tt      = [100:50:1000,1100:100:2500,3000]';
    rhot    = [3.556E+00	2.336E+00	1.746E+00	1.395E+00	1.161E+00	9.950E-01	8.711E-01	7.740E-01	6.964E-01	6.329E-01	5.804E-01	5.356E-01	4.975E-01	4.643E-01	4.354E-01	4.097E-01	3.868E-01	3.666E-01	3.482E-01	3.166E-01	2.902E-01	2.679E-01	2.488E-01	2.322E-01	2.177E-01	2.049E-01	1.935E-01	1.833E-01	1.741E-01	1.658E-01	1.582E-01	1.513E-01	1.448E-01	1.389E-01	1.135E-01]';
    mut     = [7.110E-06	1.034E-05	1.325E-05	1.596E-05	1.846E-05	2.082E-05	2.301E-05	2.507E-05	2.701E-05	2.884E-05	3.058E-05	3.225E-05	3.388E-05	3.546E-05	3.698E-05	3.843E-05	3.981E-05	4.113E-05	4.244E-05	4.490E-05	4.730E-05	4.960E-05	5.300E-05	5.570E-05	5.840E-05	6.110E-05	6.370E-05	6.630E-05	6.890E-05	7.150E-05	7.400E-05	7.660E-05	7.920E-05	8.180E-05	9.550E-05]';
    nut     = [2.000E-06	4.426E-06	7.590E-06	1.144E-05	1.589E-05	2.092E-05	2.641E-05	3.239E-05	3.879E-05	4.557E-05	5.269E-05	6.021E-05	6.810E-05	7.637E-05	8.493E-05	9.380E-05	1.029E-04	1.122E-04	1.219E-04	1.418E-04	1.629E-04	1.851E-04	2.130E-04	2.400E-04	2.680E-04	2.980E-04	3.290E-04	3.620E-04	3.960E-04	4.310E-04	4.680E-04	5.060E-04	5.470E-04	5.890E-04	8.410E-04]';
    Prt     = [7.860E-01	7.580E-01	7.370E-01	7.200E-01	7.070E-01	7.000E-01	6.900E-01	6.860E-01	6.840E-01	6.830E-01	6.850E-01	6.900E-01	6.950E-01	7.020E-01	7.090E-01	7.160E-01	7.200E-01	7.230E-01	7.260E-01	7.280E-01	7.280E-01	7.190E-01	7.030E-01	6.850E-01	6.880E-01	6.850E-01	6.830E-01	6.770E-01	6.720E-01	6.670E-01	6.550E-01	6.470E-01	6.300E-01	6.130E-01	5.360E-01]';
elseif(isequal('nh3',fluid))
    Tt      = [3.0000E+02	3.2000E+02	3.4000E+02	3.6000E+02	3.8000E+02	4.0000E+02	4.2000E+02	4.4000E+02	4.6000E+02	4.8000E+02	5.0000E+02	5.2000E+02	5.4000E+02	5.6000E+02	5.8000E+02]';
    rhot    = [6.8940E-01	6.4480E-01	6.0590E-01	5.7160E-01	5.4100E-01	5.1360E-01	4.8880E-01	4.6640E-01	4.4600E-01	4.2730E-01	4.1010E-01	3.9420E-01	3.7950E-01	3.7080E-01	3.5330E-01]';
    mut     = [1.0150E-05	1.0900E-05	1.1650E-05	1.2400E-05	1.3100E-05	1.3800E-05	1.4500E-05	1.5250E-05	1.5900E-05	1.6650E-05	1.7300E-05	1.8000E-05	1.8650E-05	1.9300E-05	1.9950E-05]';
    nut     = [1.4700E-05	1.6900E-05	1.9200E-05	2.1700E-05	2.4200E-05	2.6900E-05	2.9700E-05	3.2700E-05	3.5700E-05	3.9000E-05	4.2200E-05	4.5700E-05	4.9100E-05	5.2000E-05	5.6500E-05]';
    Prt     = [8.8700E-01	8.7000E-01	8.7200E-01	8.7200E-01	8.6900E-01	8.5300E-01	8.3300E-01	8.2600E-01	8.2200E-01	8.2200E-01	8.1300E-01	8.2700E-01	8.2400E-01	8.2700E-01	8.1700E-01]';
elseif(isequal('co2',fluid))
    Tt      = [2.8000E+02	3.0000E+02	3.2000E+02	3.4000E+02	3.6000E+02	3.8000E+02	4.0000E+02	4.5000E+02	5.0000E+02	5.5000E+02	6.0000E+02	6.5000E+02	7.0000E+02	7.5000E+02	8.0000E+02]';
    rhot    = [1.9022E+00	1.7730E+00	1.6609E+00	1.5618E+00	1.4743E+00	1.3961E+00	1.3257E+00	1.1782E+00	1.0594E+00	9.6250E-01	8.8260E-01	8.1430E-01	7.5640E-01	7.0570E-01	6.6140E-01]';
    mut     = [1.4000E-05	1.4900E-05	1.5600E-05	1.6500E-05	1.7300E-05	1.7100E-05	1.9000E-05	2.1000E-05	2.3100E-05	2.5100E-05	2.7000E-05	2.8800E-05	3.0500E-05	3.2100E-05	3.3700E-05]';
    nut     = [7.3600E-06	8.4000E-06	9.3900E-06	1.0600E-05	1.1700E-05	1.3000E-05	1.4300E-05	1.7800E-05	2.1800E-05	2.6100E-05	3.0600E-05	3.5400E-05	4.0300E-05	4.5500E-05	5.1000E-05]';
    Prt     = [7.6500E-01	7.6600E-01	7.5400E-01	7.4600E-01	7.4100E-01	7.3700E-01	7.3700E-01	7.2800E-01	7.2500E-01	7.2100E-01	7.1700E-01	7.1200E-01	7.1700E-01	7.1400E-01	7.1600E-01]';
elseif(isequal('co',fluid))
    Tt      = [2.0000E+02	2.2000E+02	2.4000E+02	2.6000E+02	2.8000E+02	3.0000E+02	3.2000E+02	3.4000E+02	3.6000E+02	3.8000E+02	4.0000E+02	4.5000E+02	5.0000E+02	5.5000E+02	6.0000E+02	6.5000E+02	7.0000E+02	7.5000E+02	8.0000E+02]';
    rhot    = [1.6888E+00	1.5341E+00	1.4055E+00	1.2967E+00	1.2038E+00	1.1233E+00	1.0529E+00	9.9090E-01	9.3570E-01	8.8640E-01	8.4210E-01	7.4830E-01	6.7352E-01	6.1226E-01	5.6126E-01	5.1806E-01	4.8102E-01	4.4899E-01	4.2095E-01]';
    mut     = [1.2700E-05	1.3700E-05	1.4700E-05	1.5700E-05	1.6600E-05	1.7500E-05	1.8400E-05	1.9300E-05	2.0200E-05	2.1000E-05	2.1800E-05	2.3700E-05	2.5400E-05	2.7100E-05	2.8600E-05	3.0100E-05	3.1500E-05	3.2900E-05	3.4300E-05]';
    nut     = [7.5200E-06	8.9300E-06	1.0500E-05	1.2100E-05	1.3800E-05	1.5600E-05	1.7750E-05	1.9500E-05	2.1600E-05	2.3700E-05	2.5900E-05	3.1700E-05	3.7700E-05	4.4300E-05	5.1000E-05	5.8100E-05	6.5500E-05	7.3300E-05	8.1500E-05]';
    Prt     = [7.8100E-01	7.5300E-01	7.4400E-01	7.4100E-01	7.3300E-01	7.3000E-01	7.3000E-01	7.2500E-01	7.2500E-01	7.1900E-01	7.1900E-01	7.1400E-01	7.1000E-01	7.1000E-01	7.0700E-01	7.0500E-01	7.0200E-01	7.0200E-01	7.0500E-01]';
elseif(isequal('he',fluid))
    Tt      = [1.0000E+02	1.2000E+02	1.4000E+02	1.6000E+02	1.8000E+02	2.0000E+02	2.2000E+02	2.4000E+02	2.6000E+02	2.8000E+02	3.0000E+02	3.5000E+02	4.0000E+02	4.5000E+02	5.0000E+02	5.5000E+02	6.0000E+02	6.5000E+02	7.0000E+02	7.5000E+02	8.0000E+02	9.0000E+02	1.0000E+03]';
    rhot    = [4.8710E-01	4.0600E-01	3.4810E-01	3.0945E-01	2.7080E-01	2.4620E-01	2.2160E-01	2.0455E-01	1.8750E-01	1.7500E-01	1.6250E-01	1.4220E-01	1.2190E-01	1.0972E-01	9.7540E-02	9.0578E-02	8.3615E-02	7.6653E-02	6.9690E-02	6.6207E-02	6.2723E-02	5.5757E-02	4.8790E-02]';
    mut     = [9.6300E-06	1.0700E-05	1.1800E-05	1.2900E-05	1.3900E-05	1.5000E-05	1.6000E-05	1.7000E-05	1.8000E-05	1.9000E-05	1.9900E-05	2.2100E-05	2.4300E-05	2.6300E-05	2.8300E-05	3.0150E-05	3.2000E-05	3.3200E-05	3.5000E-05	3.6400E-05	3.8200E-05	4.1400E-05	4.4600E-05]';
    nut     = [1.9800E-05	2.6400E-05	3.3900E-05	4.2600E-05	5.1300E-05	6.1750E-05	7.2200E-05	8.4100E-05	9.6000E-05	1.0900E-04	1.2200E-04	1.6050E-04	1.9900E-04	2.4450E-04	2.9000E-04	3.4300E-04	3.9600E-04	4.4900E-04	5.0200E-04	5.7067E-04	6.3933E-04	7.7667E-04	9.1400E-04]';
    Prt     = [6.8600E-01	6.7900E-01	6.7600E-01	6.7450E-01	6.7300E-01	6.7400E-01	6.7500E-01	6.7850E-01	6.8200E-01	6.8100E-01	6.8000E-01	6.7750E-01	6.7500E-01	6.7150E-01	6.6800E-01	6.6450E-01	6.6100E-01	6.5750E-01	6.5400E-01	6.5400E-01	6.5400E-01	6.5400E-01	6.5400E-01]';
elseif(isequal('h2',fluid))
    Tt      = [1.0000E+02	1.5000E+02	2.0000E+02	2.5000E+02	3.0000E+02	3.5000E+02	4.0000E+02	4.5000E+02	5.0000E+02	5.5000E+02	6.0000E+02	7.0000E+02	8.0000E+02	9.0000E+02	1.0000E+03	1.1000E+03	1.2000E+03	1.3000E+03	1.4000E+03	1.5000E+03	1.6000E+03	1.7000E+03	1.8000E+03	1.9000E+03	2.0000E+03]';
    rhot    = [2.4255E-01	1.6156E-01	1.2115E-01	9.6930E-02	8.0780E-02	6.9240E-02	6.2590E-02	5.3860E-02	4.8480E-02	4.4070E-02	4.0400E-02	3.4630E-02	3.1300E-02	2.6940E-02	2.4240E-02	2.2040E-02	2.0200E-02	1.8650E-02	1.7320E-02	1.6160E-02	1.5200E-02	1.4300E-02	1.3500E-02	1.2800E-02	1.2100E-02]';
    mut     = [4.2100E-06	5.6000E-06	6.8100E-06	7.8900E-06	8.9600E-06	9.8800E-06	1.0820E-05	1.1720E-05	1.2640E-05	1.3430E-05	1.4240E-05	1.5780E-05	1.7240E-05	1.8650E-05	2.0130E-05	2.1300E-05	2.2620E-05	2.3850E-05	2.5070E-05	2.6270E-05	2.7370E-05	2.8490E-05	2.9610E-05	3.0720E-05	3.1820E-05]';
    nut     = [1.7400E-05	3.4700E-05	5.6200E-05	8.1400E-05	1.1100E-04	1.4300E-04	1.7900E-04	2.1800E-04	2.6100E-04	3.0500E-04	3.5200E-04	4.5600E-04	5.6900E-04	6.9220E-04	8.3000E-04	9.6600E-04	1.1200E-03	1.2790E-03	1.4470E-03	1.6260E-03	1.8010E-03	1.9920E-03	2.1930E-03	2.4000E-03	2.6300E-03]';
    Prt     = [7.0700E-01	6.9900E-01	7.0400E-01	7.0700E-01	7.0100E-01	7.0000E-01	6.9500E-01	6.8900E-01	6.9100E-01	6.8500E-01	6.7800E-01	6.7500E-01	6.7000E-01	6.7100E-01	6.7300E-01	6.6200E-01	6.5900E-01	6.5500E-01	6.5000E-01	6.4300E-01	6.3900E-01	6.3700E-01	6.3900E-01	6.4300E-01	6.6100E-01]';
elseif(isequal('n2',fluid))
    Tt      = [1.0000E+02	1.5000E+02	2.0000E+02	2.5000E+02	3.0000E+02	3.5000E+02	4.0000E+02	4.5000E+02	5.0000E+02	5.5000E+02	6.0000E+02	7.0000E+02	8.0000E+02	9.0000E+02	1.0000E+03	1.1000E+03	1.2000E+03	1.3000E+03]';
    rhot    = [3.4388E+00	2.2594E+00	1.6883E+00	1.3488E+00	1.1233E+00	9.6250E-01	8.4250E-01	7.4850E-01	6.7390E-01	6.1240E-01	5.6150E-01	4.8120E-01	4.2110E-01	3.7430E-01	3.3680E-01	3.0620E-01	2.8070E-01	2.5910E-01]';
    mut     = [6.8800E-06	1.0060E-05	1.2920E-05	1.5490E-05	1.7820E-05	2.0000E-05	2.2040E-05	2.3960E-05	2.5770E-05	2.7470E-05	2.9080E-05	3.2100E-05	3.4910E-05	3.7530E-05	3.9990E-05	4.2320E-05	4.4530E-05	4.6620E-05]';
    nut     = [2.0000E-06	4.4500E-06	7.6500E-06	1.1480E-05	1.5860E-05	2.0780E-05	2.6160E-05	3.2010E-05	3.8240E-05	4.4860E-05	5.1790E-05	6.6710E-05	8.2900E-05	1.0030E-04	1.1870E-04	1.3820E-04	1.5860E-04	1.7990E-04]';
    Prt     = [7.6800E-01	7.5900E-01	7.3600E-01	7.3700E-01	7.1600E-01	7.1100E-01	7.0400E-01	7.0300E-01	7.0000E-01	7.0200E-01	7.0100E-01	7.0600E-01	7.1500E-01	7.2100E-01	7.2100E-01	7.1800E-01	7.0700E-01	7.0100E-01]';
elseif(isequal('o2',fluid))
    Tt      = [1.0000E+02	1.5000E+02	2.0000E+02	2.5000E+02	3.0000E+02	3.5000E+02	4.0000E+02	4.5000E+02	5.0000E+02	5.5000E+02	6.0000E+02	7.0000E+02	8.0000E+02	9.0000E+02	1.0000E+03	1.1000E+03	1.2000E+03	1.3000E+03]';
    rhot    = [3.9450E+00	2.5850E+00	1.9300E+00	1.5420E+00	1.2840E+00	1.1000E+00	9.6200E-01	8.5540E-01	7.6980E-01	6.9980E-01	6.4140E-01	5.4980E-01	4.8100E-01	4.2750E-01	3.8480E-01	3.4980E-01	3.2060E-01	2.9600E-01]';
    mut     = [7.6400E-06	1.1480E-05	1.4750E-05	1.7860E-05	2.0720E-05	2.3350E-05	2.5820E-05	2.8140E-05	3.0330E-05	3.2400E-05	3.4370E-05	3.8080E-05	4.1510E-05	4.4720E-05	4.7700E-05	5.0550E-05	5.3250E-05	5.8840E-05]';
    nut     = [1.9400E-06	4.4400E-06	7.6400E-06	1.1580E-05	1.6140E-05	2.1230E-05	2.6840E-05	3.2900E-05	3.9400E-05	4.6300E-05	5.3590E-05	6.9260E-05	8.6320E-05	1.0460E-04	1.2400E-04	1.4450E-04	1.6610E-04	1.8860E-04]';
    Prt     = [7.9600E-01	7.6600E-01	7.3700E-01	7.2300E-01	7.1100E-01	7.3300E-01	7.3700E-01	7.4100E-01	7.1600E-01	7.2600E-01	7.2900E-01	7.4400E-01	7.4300E-01	7.4000E-01	7.3300E-01	7.3600E-01	7.2500E-01	7.2100E-01]';
elseif(isequal('steam',fluid))
    Tt      = [380,400:50:850]';
    rhot    = [5.863E-01	5.542E-01	4.902E-01	4.405E-01	4.005E-01	3.652E-01	3.380E-01	3.140E-01	2.931E-01	2.739E-01	2.579E-01]';
    mut     = [1.271E-05	1.334E-05	1.525E-05	1.704E-05	1.884E-05	2.067E-05	2.247E-05	2.426E-05	2.604E-05	2.786E-05	2.969E-05]';
    nut     = [2.168E-05	2.425E-05	3.111E-05	3.868E-05	4.704E-05	5.660E-05	6.648E-05	7.726E-05	8.884E-05	1.017E-04	1.151E-04]';
    Prt     = [1.060E+00	1.040E+00	1.010E+00	9.980E-01	9.930E-01	9.930E-01	9.960E-01	1.000E+00	1.000E+00	1.010E+00	1.020E+00]';
elseif(isequal('oil',fluid))
    Tt      = [273,280:10:430];
    rhot    = [8.991E+02	8.953E+02	8.900E+02	8.841E+02	8.779E+02	8.718E+02	8.658E+02	8.599E+02	8.539E+02	8.478E+02	8.418E+02	8.360E+02	8.306E+02	8.251E+02	8.189E+02	8.121E+02	8.065E+02]';
    mut     = [3.850E+00	2.170E+00	9.990E-01	4.860E-01	2.530E-01	1.410E-01	8.360E-02	5.310E-02	3.560E-02	2.520E-02	1.860E-02	1.410E-02	1.100E-02	8.740E-03	6.980E-03	5.640E-03	4.700E-03]';
    nut     = [4.280E-03	2.430E-03	1.120E-03	5.500E-04	2.880E-04	1.610E-04	9.660E-05	6.170E-05	4.170E-05	2.970E-05	2.200E-05	1.690E-05	1.330E-05	1.060E-05	8.520E-06	6.940E-06	5.830E-06]';
    Prt     = [4.700E+04	2.750E+04	1.290E+04	6.400E+03	3.400E+03	1.965E+03	1.205E+03	7.930E+02	5.460E+02	3.950E+02	3.000E+02	2.330E+02	1.870E+02	1.520E+02	1.250E+02	1.030E+02	8.800E+01]';
elseif(isequal('eth_gly',fluid))
    Tt      = [273,280:10:370,373]';
    rhot    = [1.131E+03	1.126E+03	1.119E+03	1.114E+03	1.104E+03	1.096E+03	1.090E+03	1.084E+03	1.079E+03	1.074E+03	1.067E+03	1.059E+03]';
    mut     = [6.510E-02	4.200E-02	2.470E-02	1.570E-02	1.070E-02	7.570E-03	5.610E-03	4.310E-03	3.420E-03	2.780E-03	2.280E-03	2.150E-03]';
    nut     = [5.760E-05	3.730E-05	2.210E-05	1.410E-05	9.650E-06	6.910E-06	5.150E-06	3.980E-06	3.170E-06	2.590E-06	2.140E-06	2.030E-06]';
    Prt     = [6.170E+02	4.000E+02	2.360E+02	1.510E+02	1.030E+02	7.350E+01	5.500E+01	4.280E+01	3.460E+01	2.860E+01	2.370E+01	2.240E+01]';
elseif(isequal('glyc',fluid))
    Tt      = [273,280:10:320]';
    rhot    = [1.2760E+03	1.2719E+03	1.2658E+03	1.2599E+03	1.2539E+03	1.2472E+03]';
    mut     = [1.060E+01	5.340E+00	1.850E+00	7.990E-01	3.520E-01	2.100E-01]';
    nut     = [8.310E-03	4.200E-03	1.460E-03	6.340E-04	2.810E-04	1.680E-04]';
    Prt     = [8.500E+04	4.320E+04	1.530E+04	6.780E+03	3.060E+03	1.870E+03]';
elseif(isequal('r132a',fluid))
    Tt      = [2.3000E+02	2.4000E+02	2.5000E+02	2.6000E+02	2.7000E+02	2.8000E+02	2.9000E+02	3.0000E+02	3.1000E+02	3.2000E+02	3.3000E+02	3.4000E+02	3.5000E+02	3.6000E+02	3.7000E+02]';
    rhot    = [1.4268E+03	1.3977E+03	1.3679E+03	1.3371E+03	1.3051E+03	1.2718E+03	1.2368E+03	1.1997E+03	1.1599E+03	1.1168E+03	1.0691E+03	1.0150E+03	9.5130E+02	8.7010E+02	7.4030E+02]';
    mut     = [4.9120E-04	4.2020E-04	3.6330E-04	3.1660E-04	2.7750E-04	2.4430E-04	2.1560E-04	1.9050E-04	1.6800E-04	1.4780E-04	1.2920E-04	1.1180E-04	8.5100E-05	7.8100E-05	5.8000E-05]';
    nut     = [3.3430E-07	3.0060E-07	2.6560E-07	2.3680E-07	2.1270E-07	1.9210E-07	1.7440E-07	1.5880E-07	1.4490E-07	1.3230E-07	1.2090E-07	1.1020E-07	1.0000E-07	8.9800E-08	7.8300E-08]';
    Prt     = [5.5000E+00	5.0000E+00	4.6000E+00	4.2000E+00	4.0000E+00	3.7000E+00	3.5000E+00	3.4000E+00	3.3000E+00	3.2000E+00	3.1000E+00	3.1000E+00	3.2000E+00	3.5000E+00	5.7000E+00]';
elseif(isequal('r22',fluid))
    Tt      = [2.3000E+02	2.4000E+02	2.5000E+02	2.6000E+02	2.7000E+02	2.8000E+02	2.9000E+02	3.0000E+02	3.1000E+02	3.2000E+02	3.3000E+02	3.4000E+02	3.5000E+02	3.6000E+02]';
    rhot    = [1.4160E+03	1.3866E+03	1.3563E+03	1.3249E+03	1.2921E+03	1.2579E+03	1.2217E+03	1.1834E+03	1.1422E+03	1.0974E+03	1.0475E+03	9.9010E+02	9.2010E+02	8.2340E+02]';
    mut     = [3.5580E-04	3.1450E-04	2.7960E-04	2.4970E-04	2.2350E-04	2.0050E-04	1.7980E-04	1.6100E-04	1.4380E-04	1.2780E-04	1.1270E-04	9.8000E-05	8.3100E-05	6.6800E-05]';
    nut     = [2.5130E-07	2.2670E-07	2.0620E-07	1.8840E-07	1.7300E-07	1.5940E-07	1.4720E-07	1.3610E-07	1.2590E-07	1.1650E-07	1.0750E-07	9.8900E-08	9.0400E-08	8.1100E-08]';
    Prt     = [3.4000E+00	3.2000E+00	3.0000E+00	2.8000E+00	2.7000E+00	2.6000E+00	2.5000E+00	2.5000E+00	2.4000E+00	2.4000E+00	2.5000E+00	2.6000E+00	2.8000E+00	3.8000E+00]';
elseif(isequal('hg',fluid))
    Tt      = [273,300:50:600]';
    rhot    = [1.360E+04	1.353E+04	1.341E+04	1.329E+04	1.317E+04	1.305E+04	1.293E+04	1.281E+04]';
    mut     = [1.688E-03	1.523E-03	1.309E-03	1.171E-03	1.075E-03	1.007E-03	9.530E-04	9.110E-04]';
    nut     = [1.240E-07	1.125E-07	9.760E-08	8.820E-08	8.160E-08	7.710E-08	7.370E-08	7.110E-08]';
    Prt     = [2.900E-02	2.480E-02	1.960E-02	1.630E-02	1.400E-02	1.250E-02	1.120E-02	1.030E-02]';
elseif(isequal('h20_satliq',fluid))
    Tt      = [273.15,275:5:370,373.15,375:5:390,400:10:610,620:5:645,647.3];
    vf      = [1.000E-03	1.000E-03	1.000E-03	1.000E-03	1.001E-03	1.002E-03	1.003E-03	1.005E-03	1.007E-03	1.009E-03	1.011E-03	1.013E-03	1.016E-03	1.018E-03	1.021E-03	1.024E-03	1.027E-03	1.030E-03	1.034E-03	1.038E-03	1.041E-03	1.044E-03	1.045E-03	1.049E-03	1.053E-03	1.058E-03	1.067E-03	1.077E-03	1.088E-03	1.099E-03	1.110E-03	1.123E-03	1.137E-03	1.152E-03	1.167E-03	1.184E-03	1.203E-03	1.222E-03	1.244E-03	1.268E-03	1.294E-03	1.323E-03	1.355E-03	1.392E-03	1.433E-03	1.482E-03	1.541E-03	1.612E-03	1.705E-03	1.778E-03	1.856E-03	1.935E-03	2.075E-03   2.351E-03	3.170E-03]';
    rhof    = vf.^-1;
    rhot    = rhof;
    muf     = [1.750E-03	1.652E-03	1.422E-03	1.225E-03	1.080E-03	9.590E-04	8.550E-04	7.690E-04	6.950E-04	6.310E-04	5.770E-04	5.280E-04	4.890E-04	4.530E-04	4.200E-04	3.890E-04	3.650E-04	3.430E-04	3.240E-04	3.060E-04	2.890E-04	2.790E-04	2.740E-04	2.600E-04	2.480E-04	2.370E-04	2.170E-04	2.000E-04	1.850E-04	1.730E-04	1.620E-04	1.520E-04	1.430E-04	1.360E-04	1.290E-04	1.240E-04	1.180E-04	1.130E-04	1.080E-04	1.040E-04	1.010E-04	9.700E-05	9.400E-05	9.100E-05	8.800E-05	8.400E-05	8.100E-05	7.700E-05	7.200E-05	7.000E-05	6.700E-05	6.400E-05	5.900E-05   5.400E-05	4.500E-05]';
    mut     = muf;
    nut     = mut./rhot;
    Prf     = [1.299E+01	1.222E+01	1.026E+01	8.810E+00	7.560E+00	6.620E+00	5.830E+00	5.200E+00	4.620E+00	4.160E+00	3.770E+00	3.420E+00	3.150E+00	2.880E+00	2.660E+00	2.450E+00	2.290E+00	2.140E+00	2.020E+00	1.910E+00	1.800E+00	1.760E+00	1.700E+00	1.610E+00	1.530E+00	1.470E+00	1.340E+00	1.240E+00	1.160E+00	1.090E+00	1.040E+00	9.900E-01	9.500E-01	9.200E-01	8.900E-01	8.700E-01	8.600E-01	8.500E-01	8.400E-01	8.500E-01	8.600E-01	8.700E-01	9.000E-01	9.400E-01	9.900E-01	1.050E+00	1.140E+00	1.300E+00	1.520E+00	1.650E+00	2.000E+00	2.700E+00	4.200E+00   1.200E+01   Inf]';
    Prt     = Prf;
elseif(isequal('h20_satvap',fluid))
    Tt      = [273.15,275:5:370,373.15,375:5:390,400:10:610,620:5:645,647.3];
    vg      = [2.063E+02	1.817E+02	1.304E+02	9.940E+01	6.970E+01	5.194E+01	3.913E+01	2.974E+01	2.293E+01	1.782E+01	1.398E+01	1.106E+01	8.820E+00	7.090E+00	5.740E+00	4.683E+00	3.846E+00	3.180E+00	2.645E+00	2.212E+00	1.861E+00	1.679E+00	1.574E+00	1.337E+00	1.142E+00	9.800E-01	7.310E-01	5.530E-01	4.250E-01	3.310E-01	2.610E-01	2.080E-01	1.670E-01	1.360E-01	1.110E-01	9.220E-02	7.660E-02	6.310E-02	5.250E-02	4.450E-02	3.750E-02	3.170E-02	2.690E-02	2.280E-02	1.930E-02	1.630E-02	1.370E-02	1.150E-02	9.400E-03	8.500E-03	7.500E-03	6.600E-03	5.700E-03   4.500E-03	3.200E-03]';
    rhog    = vg.^-1;
    rhot    = rhog;
    mug     = [8.020E-06	8.090E-06	8.290E-06	8.490E-06	8.690E-06	8.890E-06	9.090E-06	9.290E-06	9.490E-06	9.690E-06	9.890E-06	1.009E-05	1.029E-05	1.049E-05	1.069E-05	1.089E-05	1.109E-05	1.129E-05	1.149E-05	1.169E-05	1.189E-05	1.202E-05	1.209E-05	1.229E-05	1.249E-05	1.269E-05	1.305E-05	1.342E-05	1.379E-05	1.414E-05	1.450E-05	1.485E-05	1.519E-05	1.554E-05	1.588E-05	1.623E-05	1.659E-05	1.695E-05	1.733E-05	1.772E-05	1.810E-05	1.860E-05	1.910E-05	1.970E-05	2.040E-05	2.150E-05	2.270E-05	2.410E-05	2.590E-05	2.700E-05	2.800E-05	3.000E-05	3.200E-05   3.700E-05	4.500E-05]';
    mut     = mug;
    nut     = mut./rhot;
    Prg     = [8.150E-01	8.170E-01	8.250E-01	8.330E-01	8.410E-01	8.490E-01	8.570E-01	8.650E-01	8.730E-01	8.830E-01	8.940E-01	9.010E-01	9.080E-01	9.160E-01	9.250E-01	9.330E-01	9.420E-01	9.510E-01	9.600E-01	9.690E-01	9.780E-01	9.840E-01	9.870E-01	9.990E-01	1.004E+00	1.013E+00	1.033E+00	1.054E+00	1.075E+00	1.100E+00	1.120E+00	1.140E+00	1.170E+00	1.200E+00	1.230E+00	1.250E+00	1.280E+00	1.310E+00	1.350E+00	1.390E+00	1.430E+00	1.470E+00	1.520E+00	1.590E+00	1.680E+00	1.840E+00	2.150E+00	2.600E+00	3.460E+00	4.200E+00	4.800E+00	6.000E+00	9.600E+00   2.600E+01   Inf]';
    Prt     = Prg;
elseif(isequal('h20_mix',fluid))
    Tt      = [273.15,275:5:370,373.15,375:5:390,400:10:610,620:5:645,647.3];
    vf      = [1.000E-03	1.000E-03	1.000E-03	1.000E-03	1.001E-03	1.002E-03	1.003E-03	1.005E-03	1.007E-03	1.009E-03	1.011E-03	1.013E-03	1.016E-03	1.018E-03	1.021E-03	1.024E-03	1.027E-03	1.030E-03	1.034E-03	1.038E-03	1.041E-03	1.044E-03	1.045E-03	1.049E-03	1.053E-03	1.058E-03	1.067E-03	1.077E-03	1.088E-03	1.099E-03	1.110E-03	1.123E-03	1.137E-03	1.152E-03	1.167E-03	1.184E-03	1.203E-03	1.222E-03	1.244E-03	1.268E-03	1.294E-03	1.323E-03	1.355E-03	1.392E-03	1.433E-03	1.482E-03	1.541E-03	1.612E-03	1.705E-03	1.778E-03	1.856E-03	1.935E-03	2.075E-03   2.351E-03	3.170E-03]';
    vg      = [2.063E+02	1.817E+02	1.304E+02	9.940E+01	6.970E+01	5.194E+01	3.913E+01	2.974E+01	2.293E+01	1.782E+01	1.398E+01	1.106E+01	8.820E+00	7.090E+00	5.740E+00	4.683E+00	3.846E+00	3.180E+00	2.645E+00	2.212E+00	1.861E+00	1.679E+00	1.574E+00	1.337E+00	1.142E+00	9.800E-01	7.310E-01	5.530E-01	4.250E-01	3.310E-01	2.610E-01	2.080E-01	1.670E-01	1.360E-01	1.110E-01	9.220E-02	7.660E-02	6.310E-02	5.250E-02	4.450E-02	3.750E-02	3.170E-02	2.690E-02	2.280E-02	1.930E-02	1.630E-02	1.370E-02	1.150E-02	9.400E-03	8.500E-03	7.500E-03	6.600E-03	5.700E-03   4.500E-03	3.200E-03]';
    rhof    = vf.^-1;
    rhog    = vg.^-1;
    rhot    = (1-quality)*rhof+quality*rhog;
    muf     = [1.750E-03	1.652E-03	1.422E-03	1.225E-03	1.080E-03	9.590E-04	8.550E-04	7.690E-04	6.950E-04	6.310E-04	5.770E-04	5.280E-04	4.890E-04	4.530E-04	4.200E-04	3.890E-04	3.650E-04	3.430E-04	3.240E-04	3.060E-04	2.890E-04	2.790E-04	2.740E-04	2.600E-04	2.480E-04	2.370E-04	2.170E-04	2.000E-04	1.850E-04	1.730E-04	1.620E-04	1.520E-04	1.430E-04	1.360E-04	1.290E-04	1.240E-04	1.180E-04	1.130E-04	1.080E-04	1.040E-04	1.010E-04	9.700E-05	9.400E-05	9.100E-05	8.800E-05	8.400E-05	8.100E-05	7.700E-05	7.200E-05	7.000E-05	6.700E-05	6.400E-05	5.900E-05   5.400E-05	4.500E-05]';
    mug     = [8.020E-06	8.090E-06	8.290E-06	8.490E-06	8.690E-06	8.890E-06	9.090E-06	9.290E-06	9.490E-06	9.690E-06	9.890E-06	1.009E-05	1.029E-05	1.049E-05	1.069E-05	1.089E-05	1.109E-05	1.129E-05	1.149E-05	1.169E-05	1.189E-05	1.202E-05	1.209E-05	1.229E-05	1.249E-05	1.269E-05	1.305E-05	1.342E-05	1.379E-05	1.414E-05	1.450E-05	1.485E-05	1.519E-05	1.554E-05	1.588E-05	1.623E-05	1.659E-05	1.695E-05	1.733E-05	1.772E-05	1.810E-05	1.860E-05	1.910E-05	1.970E-05	2.040E-05	2.150E-05	2.270E-05	2.410E-05	2.590E-05	2.700E-05	2.800E-05	3.000E-05	3.200E-05   3.700E-05	4.500E-05]';
    mut     = (1-quality)*muf+quality*mug;
    nut     = mut./rhot;
    Prf     = [1.299E+01	1.222E+01	1.026E+01	8.810E+00	7.560E+00	6.620E+00	5.830E+00	5.200E+00	4.620E+00	4.160E+00	3.770E+00	3.420E+00	3.150E+00	2.880E+00	2.660E+00	2.450E+00	2.290E+00	2.140E+00	2.020E+00	1.910E+00	1.800E+00	1.760E+00	1.700E+00	1.610E+00	1.530E+00	1.470E+00	1.340E+00	1.240E+00	1.160E+00	1.090E+00	1.040E+00	9.900E-01	9.500E-01	9.200E-01	8.900E-01	8.700E-01	8.600E-01	8.500E-01	8.400E-01	8.500E-01	8.600E-01	8.700E-01	9.000E-01	9.400E-01	9.900E-01	1.050E+00	1.140E+00	1.300E+00	1.520E+00	1.650E+00	2.000E+00	2.700E+00	4.200E+00   1.200E+01   Inf]';
    Prg     = [8.150E-01	8.170E-01	8.250E-01	8.330E-01	8.410E-01	8.490E-01	8.570E-01	8.650E-01	8.730E-01	8.830E-01	8.940E-01	9.010E-01	9.080E-01	9.160E-01	9.250E-01	9.330E-01	9.420E-01	9.510E-01	9.600E-01	9.690E-01	9.780E-01	9.840E-01	9.870E-01	9.990E-01	1.004E+00	1.013E+00	1.033E+00	1.054E+00	1.075E+00	1.100E+00	1.120E+00	1.140E+00	1.170E+00	1.200E+00	1.230E+00	1.250E+00	1.280E+00	1.310E+00	1.350E+00	1.390E+00	1.430E+00	1.470E+00	1.520E+00	1.590E+00	1.680E+00	1.840E+00	2.150E+00	2.600E+00	3.460E+00	4.200E+00	4.800E+00	6.000E+00	9.600E+00   2.600E+01   Inf]';
    Prt     = (1-quality)*Prf+quality*Prg;
else
    disp('Error: incorrect fluid selected.')
end

rho = interp1(Tt,rhot,T);
mu = interp1(Tt,mut,T);
nu = interp1(Tt,nut,T);
Pr = interp1(Tt,Prt,T);