## Two-Phase Fluid Domain

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

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

Abbreviated two-phase fluid domain declaration is shown below, with intermediate lookup table values omitted for readability.

```domain two_phase_fluid % Two-Phase Fluid Domain % Copyright 2013-2015 The MathWorks, Inc. parameters p_min = { 0.01, 'MPa' }; % Minimum valid pressure p_max = { 10, 'MPa' }; % Maximum valid pressure u_min = { 83, 'kJ/kg' }; % Minimum valid specific internal energy u_max = { 3000, 'kJ/kg' }; % Maximum valid specific internal energy p_atm = { 1, 'atm' }; % Atmospheric pressure G_min = { 1e-4, 'kg/s' }; % Minimum thermal conductance coefficient (in terms of specific internal energy) end parameters (Size = variable) % Default lookup tables as a function of pressure and normalized % specific internal energy. Default values are given for water. unorm_TLU = {[ -1 -0.965517241379310 ... 1.965517241379310 2] , '1' }; % Normalized specific internal energy vector p_TLU = {[ 0.0100000000000000 0.0110069417125221 ... 9.08517575651687 10 ]', 'MPa' }; % Pressure vector v_TLU = {[ 0.00100179322007424 0.00100179275967088 ... 0.0346304234950199 0.0314287403997878 ], 'm^3/kg' }; % Specific volume table T_TLU = {[ 292.932206861359 292.932221312314 ... 745.161185789778 749.863646934846 ], 'K' }; % Temperature table nu_TLU = {[ 1.00879736586632 1.00879622386086 ... 1.84426245592388 1.86263886789473 ], 'J/(g*K)' }; % Specific heat at constant volume table k_TLU = {[ 0.597572631285823 0.597573251441156 ... 0.0722108618593745 0.0737522416007857 ], 'W/(m*K)' }; % Thermal conductivity table Pr_TLU = {[ 7.05143974468479 7.05142233958132 ... 0.996712568607034 1.00323505646151 ], '1' }; % Prandtl number table u_liq = {[ 191.795842042090 199.694279536627 ... 1354.80955706624 1393.53799592228]', 'kJ/kg' }; % Saturated liquid specific internal energy vector u_vap = {[ 2437.15737300173 2439.67287156956 ... 2557.44803624027 2545.19234394635]', 'kJ/kg' }; % Saturated vapor specific internal energy vector end variables p = { 0.101325, 'MPa' }; % Pressure u = { 83.905793864039, 'kJ/kg' }; % Specific internal energy end variables(Balancing = true) mdot = { 0, 'kg/s' }; % Mass flow rate Phi = { 0, 'kW' }; % Heat 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 u (specific internal energy), in kJ/kg

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

• Parameter p_min, defining the minimum allowable pressure

• Parameter p_max, defining the maximum allowable pressure

• Parameter u_min, defining the minimum allowable specific internal energy

• Parameter u_max, defining the maximum allowable specific internal energy

• Parameter p_atm, defining the atmospheric pressure

• Parameter G_min, defining the minimum thermal conductance coefficient, in terms of specific internal energy

It also contains lookup table data, declared as variable-sized domain parameters, for the following fluid properties:

• Normalized specific internal energy vector

• Pressure vector

• Specific volume table

• Temperature table

• Specific heat at constant volume table

• Thermal conductivity table

• Prandtl number table

• Saturated liquid specific internal energy vector

• Saturated vapor specific internal energy vector

These variable-sized parameter declarations propagate to the components connected to the Two-Phase Fluid domain, and therefore you can use them in the `tablelookup` function in the component equations. In particular, the two-phase fluid blocks in the Foundation library use these lookup tables for interpolation purposes.

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

`foundation.two_phase_fluid.two_phase_fluid `