Gas Domain

To view the complete domain source file, at the MATLAB® Command prompt, type:

open([matlabroot '/toolbox/physmod/simscape/library/m/+foundation/+gas/gas.ssc'])

Abbreviated gas domain declaration is shown below, with intermediate lookup table values omitted for readability.

domain gas
% Gas Domain

% Copyright 2016 The MathWorks, Inc.

parameters
    gas_spec = {1, '1'}; % Gas specification
    %                      1 - Perfect
    %                      2 - Semiperfect
    %                      3 - Real

    % Perfect gas properties

    R      = {0.287,             'kJ/(kg*K)'}; % Specific gas constant
    Z      = {1,                 '1'        }; % Compressibility factor
    T_ref  = {293.15,            'K'        }; % Reference temperature for gas properties
    h_ref  = {420,               'kJ/kg'    }; % Specific enthalpy at reference temperature
    cp_ref = {1,                 'kJ/(kg*K)'}; % Specific heat at constant pressure
    cv_ref = {0.713,             'kJ/(kg*K)'}; % Specific heat at constant volume
    mu_ref = {18,                'uPa*s'    }; % Dynamic viscosity
    k_ref  = {26,                'mW/(m*K)' }; % Thermal conductivity
    Pr_ref = {0.692307692307692, '1'        }; % Prandtl number

    % Semiperfect gas properties

    T_TLU1 = {[150:10:200, 250:50:1000, 1500, 2000]', 'K'}; % Temperature vector

    log_T_TLU1 = {[
        5.01063529409626
        5.07517381523383
        ...
        7.60090245954208
        ], '1'}; % Log temperature vector

    h_TLU1 = {[
        275.264783730547
        285.377054177734
        ...
        2377.14064127409
        ], 'kJ/kg'}; % Specific enthalpy vector

    cp_TLU1 = {[
        1.01211492398124
        1.01042105529234
        ...
        1.24628356718428
        ], 'kJ/(kg*K)'}; % Specific heat at constant pressure vector

    cv_TLU1 = {[
        0.725174216111164
        0.723480347422265
        ...
        0.959342859314206
        ], 'kJ/(kg*K)'}; % Specific heat at constant volume vector

    mu_TLU1 = {[
        10.3766056544352
        10.9908682444892
        ...
        68.0682900809450
        ], 'uPa*s'}; % Dynamic viscosity vector

    k_TLU1 = {[
        14.1517155766309
        15.0474512994325
        ...
        114.486299090693
        ], 'mW/(m*K)'}; % Thermal conductivity vector

    Pr_TLU1 = {[
        0.742123270231960
        0.738025627675206
        ...
        0.740982912785154
        ], '1'}; % Prandtl number vector

    a_TLU1 = {[
        245.095563145758
        253.217606015000
        ...
        863.440849227825
        ], 'm/s'}; % Speed of sound vector

    int_dh_T_TLU1 = {[
        0
        0.0652630980004620
        0.126478959779276
        ...
        2.79681971660776
        ], 'kJ/(kg*K)'}; % integral of dh/T vector

    % Real gas properties

    % Default gas property tables for dry air
    % Rows of the tables correspond to the temperature vector
    % Columns of the tables correspond to the pressure vector

    T_TLU2 = {[150:10:200, 250:50:1000, 1500, 2000]',              'K'  }; % Temperature vector
    p_TLU2 = {[0.01:0.01:0.1, 0.12, 0.15, 0.2, 0.5, 1, 2, 5, 10]', 'MPa'}; % Pressure vector

    log_T_TLU2 = {[
        5.01063529409626
        5.07517381523383
        ...
        7.60090245954208
        ], '1'}; % Log temperature vector

    log_p_TLU2 = {[
        9.21034037197618
        9.90348755253613
        ...
        16.1180956509583
        ], '1'}; % Log pressure vector

    log_rho_TLU2 = {[
        -1.45933859209149 -0.765580954956293 ... 2.84006136461620
        ], '1'}; % Log density table

    s_TLU2 = {[
        3.85666832168988 3.65733557342939 ... 4.66584072487367
        ], 'kJ/(kg*K)'}; % Specific entropy table

    h_TLU2 = {[
        276.007989595737 275.926922934925 ... 2386.79535914098
        ], 'kJ/kg'}; % Specific enthalpy table

    cp_TLU2 = {[
        1.00320557010184 1.00416915257750 ... 1.24767439351222
        ], 'kJ/(kg*K)'}; % Specific heat at constant pressure table

    cv_TLU2 = {[
        0.715425577953031 0.715655648411093	... 0.960303115685940
        ], 'kJ/(kg*K)'}; % Specific heat at constant volume table

    mu_TLU2 = {[
        10.3604759816291 10.3621937105615 ... 68.3249440282350
        ], 'uPa*s'}; % Dynamic viscosity table

    k_TLU2 = {[
        14.0896194596466 14.0962928994967 ... 114.905858092359
        ], 'mW/(m*K)'}; % Thermal conductivity table

    Pr_TLU2 = {[
        0.737684026417089 0.738165370950116 ... 0.741888050943969
        ], '1'}; % Prandtl number table

    a_TLU2 = {[
        245.567929192228 245.496359667264 ... 878.939999571000
        ], 'm/s'}; % Speed of sound table

    log_drho_dp_TLU2 = {[
        -10.6690690699104 -10.6678475863467 ... -13.2956456388403
        ], '1'}; % Log derivative of density with respect to pressure table

    log_drho_dT_TLU2 = {[
        -6.46809263806814 -5.77245144865022 ... -4.77782516923660
        ], '1'}; % Log derivative of density with respect to temperature table

    drhou_dp_TLU2 = {[
        5.41617782089664 5.42024592837099 ... 3.03095417965253
        ], '1'}; % Derivative of internal energy per unit volume with respect to pressure table

    drhou_dT_TLU2 = {[
        -0.195280173069178 -0.391714814336739 ... 1.27305147462835
        ], 'kJ/(m^3*K)'}; % Derivative of internal energy per unit volume with respect to temperature table

    pT_region_flag   = {1,            '1'}; % Valid pressure-temperature region parameterization
    %                                         1 - Range of gas property tables
    %                                         2 - Specified minimum and maximum values
    %                                         3 - Validity matrix
    pT_validity_TLU2 = {ones(24, 18), '1'}; % Pressure-temperature validity matrix

    T_min = {150,  'K'  }; % Minimum valid temperature
    T_max = {2000, 'K'  }; % Maximum valid temperature
    p_min = {0.01, 'MPa'}; % Minimum valid pressure
    p_max = {10,   'MPa'}; % Maximum valid pressure

    p_atm = {0.101325, 'MPa'}; % Atmospheric pressure

    T_unit       = {1, 'K'          }; % Unit for log temperature
    p_unit       = {1, 'Pa'         }; % Unit for log pressure
    rho_unit     = {1, 'kg/m^3'     }; % Unit for log density
    drho_dp_unit = {1, 'kg/(m^3*Pa)'}; % Unit for log derivative of density with respect to pressure
    drho_dT_unit = {1, 'kg/(m^3*K)' }; % Unit for log derivative of density with respect to temperature

    log_ZR = {5.65948221575962, '1'}; % Log of compressibility factor times specific gas constant

    k_cp = {26e-06, 'kg/(m*s)'}; % Ratio of thermal conductivity to specific heat at typical operating conditions

    max_aspect_ratio = {5, '1'}; % Maximum component aspect ratio (length/diameter) for thermal conduction
end

variables
    p = {0.1, 'MPa'}; % Pressure
    T = {300, 'K'  }; % Temperature
end

variables (Balancing=true)
    mdot = {0, 'kg/s'}; % Mass flow rate
    Phi  = {0, 'kW'  }; % Energy flow rate
end

end

The domain declaration contains the following variables and parameters:

  • Across variable p (absolute pressure), in MPa

  • Through variable mdot (mass flow rate), in kg/s

  • Across variable T (temperature), in K

  • Through variable Phi (energy flow rate), in kW

  • Parameter T_min, defining the minimum allowable temperature

  • Parameter T_max, defining the maximum allowable temperature

  • Parameter p_min, defining the minimum allowable pressure

  • Parameter p_max, defining the maximum allowable pressure

  • Parameter p_atm, defining the atmospheric pressure

Parameter gas_spec provides a choice of three gas models:

  • 1 — Perfect (default)

  • 2 — Semiperfect

  • 3 — Real

In the Foundation Gas library, the Gas Properties (G) block serves as the source for domain parameter values, including the selection of the gas model. For more information on propagation of domain parameters, see Working with Domain Parameters.

The domain declaration also contains sets of parameters that define gas properties for each gas model.

Properties for semiperfect and real gas are in the form of lookup table data. These parameter declarations propagate to the components connected to the Gas domain, and therefore you can use them in the tablelookup function in the component equations.

To refer to this domain in your custom component declarations, use the following syntax:

foundation.gas.gas