# System-Level Heat Exchanger (2P-2P)

Heat exchanger between two two-phase fluid networks, with model based on performance data

**Library:**Simscape / Fluids / Fluid Network Interfaces / Heat Exchangers

## Description

The System-Level Heat Exchanger (2P-2P) block models a heat exchanger between two distinct two-phase fluid networks. Each network has its own set of fluid properties.

The block model is based on performance data from the heat exchanger datasheet, rather than on the detailed geometry of the exchanger, and therefore you can use this block when geometry data is unavailable. Either or both sides of the heat exchanger can condense or vaporize fluid as a result of the heat exchange. You can also use this block as an internal heat exchanger in a refrigeration system. An internal heat exchanger improves refrigeration system efficiency by providing additional heat exchange between the outlet of the condenser and the outlet of the evaporator.

You parameterize the block by the nominal operating condition. The heat exchanger is sized to match the specified performance at the nominal operating condition at steady state.

Each side of the heat exchanger approximates the liquid zone, mixture zone, and vapor zone based on the change in enthalpy along the flow path.

### Heat Transfer

The two-phase fluid 1 flow and the two-phase fluid 2 flow are each divided into three segments of equal size. Heat transfer between the fluids is calculated in each segment. For simplicity, the equation for one segment is shown here.

If the wall thermal mass is off, then the heat balance in the heat exchanger is

$${Q}_{seg,2P1}+{Q}_{seg,2P2}=0,$$

where:

*Q*_{seg,2P1}is the heat flow rate from the wall (that is, the heat transfer surface) to the two-phase fluid 1 in the segment.*Q*_{seg,2P2}is the heat flow rate from the wall to the two-phase fluid 2 in the segment.

If the wall thermal mass is on, then the heat balance in the heat exchanger is

$${Q}_{seg,2P1}+{Q}_{seg,2P2}=-\frac{{M}_{wall}{c}_{{p}_{wall}}}{N}\frac{d{T}_{seg,wall}}{dt},$$

where:

*M*_{wall}is the mass of the wall.*c*_{pwall}is the specific heat of the wall.*N*= 3 is the number of segments.*T*_{seg,wall}is the average wall temperature in the segment.*t*is time.

The heat flow rate from the wall to the two-phase fluid 1 in the segment is

$${Q}_{seg,2P1}=U{A}_{seg,2P1}\left({T}_{seg,wall}-{T}_{seg,2P1}\right),$$

where:

*UA*_{seg,2P1}is the weighted-average heat transfer conductance for the two-phase fluid 1 in the segment.*T*_{seg,2P1}is the weighted-average fluid temperature for the two-phase fluid 1 in the segment.

The heat flow rate from the wall to the two-phase fluid 2 in the segment is

$${Q}_{seg,2P2}=U{A}_{seg,2P2}\left({T}_{seg,wall}-{T}_{seg,2P2}\right),$$

where:

*UA*_{seg,2P2}is the weighted-average heat transfer conductance for the two-phase fluid 2 in the segment.*T*_{seg,2P2}is the weighted-average fluid temperature for the two-phase fluid 2 in the segment.

### Two-Phase Fluid 1 Heat Transfer Correlation

If the segment is subcooled liquid, then the heat transfer conductance is

$$U{A}_{seg,L,2P1}={a}_{L,2P1}{\left({\mathrm{Re}}_{seg,L,2P1}\right)}^{{b}_{2P1}}{\left({\mathrm{Pr}}_{seg,L,2P1}\right)}^{{c}_{2P1}}{k}_{seg,L,2P1}\frac{{G}_{2P1}}{N},$$

where:

*a*_{L,2P1},*b*_{2P1}, and*c*_{2P1}are the coefficients of the Nusselt number correlation. These coefficients appear as block parameters in the**Correlation Coefficients**section.*Re*_{seg,L,2P1}is the average liquid Reynolds number for the segment.*Pr*_{seg,L,2P1}is the average liquid Prandtl number for the segment.*k*_{seg,L,2P1}is the average liquid thermal conductivity for the segment.*G*_{2P1}is the geometry scale factor for the two-phase fluid 1 side of the heat exchanger. The block calculates the geometry scale factor so that the total heat transfer over all segments matches the specified performance at the nominal operating conditions.

The average liquid Reynolds number is

$${\mathrm{Re}}_{seg,L,2P1}=\frac{{\dot{m}}_{seg,2P1}{D}_{ref,2P1}}{{\mu}_{seg,L,2P1}{S}_{ref,2P1}},$$

where:

$${\dot{m}}_{seg,2P1}$$ is the mass flow rate through the segment.

*μ*_{seg,L,2P1}is the average liquid dynamic viscosity for the segment.*D*_{ref,2P1}is an arbitrary reference diameter.*S*_{ref,2P1}is an arbitrary reference flow area.

**Note**

The *D*_{ref,2P1} and
*S*_{ref,2P1} terms are included in this equation
for unit calculation purposes only, to make
*Re*_{seg,L,2P1} nondimensional. The values of
*D*_{ref,2P1} and
*S*_{ref,2P1} are arbitrary because the
*G*_{2P1} calculation overrides these values.

Similarly, if the segment is superheated vapor, then the heat transfer conductance is

$$U{A}_{seg,V,2P1}={a}_{V,2P1}{\left({\mathrm{Re}}_{seg,V,2P1}\right)}^{{b}_{2P1}}{\left({\mathrm{Pr}}_{seg,V,2P1}\right)}^{{c}_{2P1}}{k}_{seg,V,2P1}\frac{{G}_{2P1}}{N},$$

where:

*a*_{V,2P1},*b*_{2P1}, and*c*_{2P1}are the coefficients of the Nusselt number correlation. These coefficients appear as block parameters in the**Correlation Coefficients**section.*Re*_{seg,V,2P1}is the average vapor Reynolds number for the segment.*Pr*_{seg,V,2P1}is the average vapor Prandtl number for the segment.*k*_{seg,V,2P1}is the average vapor thermal conductivity for the segment.

The average vapor Reynolds number is

$${\mathrm{Re}}_{seg,V,2P1}=\frac{{\dot{m}}_{seg,2P1}{D}_{ref,2P1}}{{\mu}_{seg,V,2P1}{S}_{ref,2P1}},$$

where *μ*_{seg,V,2P1} is the average vapor dynamic
viscosity for the segment.

If the segment is liquid-vapor mixture, then the heat transfer conductance is

$$U{A}_{seg,M,2P1}={a}_{M,2P1}{\left({\mathrm{Re}}_{seg,SL,2P1}\right)}^{{b}_{2P1}}CZ{\left({\mathrm{Pr}}_{seg,SL,2P1}\right)}^{{c}_{2P1}}{k}_{seg,SL,2P1}\frac{{G}_{2P1}}{N},$$

where:

*a*_{M,2P1},*b*_{2P1}, and*c*_{2P1}are the coefficients of the Nusselt number correlation. These coefficients appear as block parameters in the**Correlation Coefficients**section.*Re*_{seg,SL,2P1}is the saturated liquid Reynolds number for the segment.*Pr*_{seg,SL,2P1}is the saturated liquid Prandtl number for the segment.*k*_{seg,SL,2P1}is the saturated liquid thermal conductivity for the segment.*CZ*is the Cavallini and Zecchin term.

The saturated liquid Reynolds number is

$${\mathrm{Re}}_{seg,SL,2P1}=\frac{{\dot{m}}_{seg,2P1}{D}_{ref,2P1}}{{\mu}_{seg,SL,2P1}{S}_{ref,2P1}},$$

where *μ*_{seg,SL,2P1} is the saturated liquid
dynamic viscosity for the segment.

The Cavallini and Zecchin term is

$$CZ=\frac{{\left(\left(\sqrt{\frac{{\nu}_{seg,SV,2P1}}{{\nu}_{seg,SL,2P1}}}-1\right)\left({x}_{seg,out,2P1}+1\right)\right)}^{1+{b}_{2P1}}-{\left(\left(\sqrt{\frac{{\nu}_{seg,SV,2P1}}{{\nu}_{seg,SL,2P1}}}-1\right)\left({x}_{seg,in,2P1}+1\right)\right)}^{1+{b}_{2P1}}}{\left(1+{b}_{2P1}\right)\left(\sqrt{\frac{{\nu}_{seg,SV,2P1}}{{\nu}_{seg,SL,2P1}}}-1\right)\left({x}_{seg,out,2P1}-{x}_{seg,in,2P1}\right)},$$

where:

*ν*_{seg,SL,2P1}is the saturated liquid specific volume for the segment.*ν*_{seg,SV,2P1}is the saturated vapor specific volume for the segment.*x*_{seg,in,2P1}is the vapor quality at the segment inlet.*x*_{seg,out,2P1}is the vapor quality at the segment outlet.

The expression is based on the work of Cavallini and Zecchin [5], which derives a heat
transfer coefficient correlation at a local vapor quality *x*. Equations
for the liquid-vapor mixture are obtained by averaging Cavallini and Zecchin’s correlation
over the segment from *x*_{seg,in,2P1} to
*x*_{seg,out,2P1}.

### Two-Phase Fluid 1 Weighted Average

The two-phase fluid flow through a segment may not be entirely represented as either
subcooled liquid, superheated vapor, or liquid-vapor mixture. Instead, each segment may
consist of a combination of these. The block approximates this condition by computing
weighting factors (*w*_{L},
*w*_{V}, and
*w*_{M}) based on the change in specific enthalpy
across the segment and the saturated liquid and vapor specific enthalpies. The block assumes
that the specific enthalpy across the segment varies piecewise linearly from inlet to
outlet, with the breakpoints corresponding to the saturation boundaries for liquid and
vapor. The zone with a larger heat transfer coefficient has a steeper slope than the zone
with a lower heat transfer coefficient.

$$\begin{array}{l}{w}_{L}=\frac{{\Delta}_{L}}{{\Delta}_{L}+{\Delta}_{M}+{\Delta}_{V}}\\ {w}_{V}=\frac{{\Delta}_{V}}{{\Delta}_{L}+{\Delta}_{M}+{\Delta}_{V}}\\ {w}_{M}=1-{w}_{L}-{w}_{V}\end{array}$$

$$\begin{array}{l}{\Delta}_{L}=\left|\mathrm{min}\left({h}_{seg,out,2P1},{h}_{seg,SL,2P1}\right)-\mathrm{min}\left({h}_{seg,in,2P1},{h}_{seg,SL,2P1}\right)\right|\cdot U{A}_{seg,M,2P1}\cdot U{A}_{seg,V,2P1}\\ {\Delta}_{M}=\left|\mathrm{min}\left(\mathrm{max}\left({h}_{seg,out,2P1},{h}_{seg,SL,2P1}\right),{h}_{seg,SV,2P1}\right)-\mathrm{min}\left(\mathrm{max}\left({h}_{seg,in,2P1},{h}_{seg,SL,2P1}\right),{h}_{seg,SV,2P1}\right)\right|\cdot U{A}_{seg,L,2P1}\cdot U{A}_{seg,V,2P1}\\ {\Delta}_{V}=\left|\mathrm{max}\left({h}_{seg,out,2P1},{h}_{seg,SV,2P1}\right)-\mathrm{max}\left({h}_{seg,in,2P1},{h}_{seg,SV,2P1}\right)\right|\cdot U{A}_{seg,L,2P1}\cdot U{A}_{seg,M,2P1}\end{array}$$

where:

*h*_{seg,in,2P1}is the specific enthalpy at the segment inlet.*h*_{seg,out,2P1}is the specific enthalpy at the segment outlet.*h*_{seg,SL,2P1}is the saturated liquid specific enthalpy for the segment.*h*_{seg,SV,2P1}is the saturated vapor specific enthalpy for the segment.

The weighted-average two-phase fluid 1 heat transfer conductance for the segment is therefore

$$U{A}_{seg,2P1}={w}_{L}\left(U{A}_{seg,L,2P1}\right)+{w}_{V}\left(U{A}_{seg,V,2P1}\right)+{w}_{M}\left(U{A}_{seg,M,2P1}\right).$$

The weighted-average fluid 1 temperature for the segment is

$${T}_{seg,2P1}=\frac{{w}_{L}\left(U{A}_{seg,L,2P1}\right){T}_{seg,L,2P1}+{w}_{V}\left(U{A}_{seg,V,2P1}\right){T}_{seg,V,2P1}+{w}_{M}\left(U{A}_{seg,M,2P1}\right){T}_{seg,M,2P1}}{U{A}_{seg,2P1}},$$

where:

*T*_{seg,L,2P1}is the average liquid temperature for the segment.*T*_{seg,V,2P1}is the average vapor temperature for the segment.*T*_{seg,M,2P1}is the average mixture temperature for the segment, which is the saturated liquid temperature.

### Two-Phase Fluid 2 Heat Transfer Correlation

If the segment is subcooled liquid, then the heat transfer conductance is

$$U{A}_{seg,L,2P2}={a}_{L,2P2}{\left({\mathrm{Re}}_{seg,L,2P2}\right)}^{{b}_{2P2}}{\left({\mathrm{Pr}}_{seg,L,2P2}\right)}^{{c}_{2P2}}{k}_{seg,L,2P2}\frac{{G}_{2P2}}{N},$$

where:

*a*_{L,2P2},*b*_{L,2P2}, and*c*_{L,2P2}are the coefficients of the Nusselt number correlation. These coefficients appear as block parameters in the**Correlation Coefficients**section.*Re*_{seg,L,2P2}is the average liquid Reynolds number for the segment.*Pr*_{seg,L,2P2}is the average liquid Prandtl number for the segment.*k*_{seg,L,2P2}is the average liquid thermal conductivity for the segment.*G*_{2P2}is the geometry scale factor for the two-phase fluid 2 side of the heat exchanger. The block calculates the geometry scale factor so that the total heat transfer over all segments matches the specified performance at the nominal operating conditions.

The average liquid Reynolds number is

$${\mathrm{Re}}_{seg,L,2P2}=\frac{{\dot{m}}_{seg,2P2}{D}_{ref,2P2}}{{\mu}_{seg,L,2P2}{S}_{ref,2P2}},$$

where:

$${\dot{m}}_{seg,2P2}$$ is the mass flow rate through the segment.

*μ*_{seg,L,2P2}is the average liquid dynamic viscosity for the segment.*D*_{ref,2P2}is an arbitrary reference diameter.*S*_{ref,2P2}is an arbitrary reference flow area.

**Note**

The *D*_{ref,2P2} and
*S*_{ref,2P2} terms are included in this equation
for unit calculation purposes only, to make
*Re*_{seg,L,2P2} nondimensional. The values of
*D*_{ref,2P} and
*S*_{ref,2P2} are arbitrary because the
*G*_{2P2} calculation overrides these values.

Similarly, if the segment is superheated vapor, then the heat transfer conductance is

$$U{A}_{seg,V,2P2}={a}_{V,2P2}{\left({\mathrm{Re}}_{seg,V,2P2}\right)}^{{b}_{2P2}}{\left({\mathrm{Pr}}_{seg,V,2P2}\right)}^{{c}_{2P2}}{k}_{seg,V,2P2}\frac{{G}_{2P2}}{N},$$

where:

*a*_{V,2P2},*b*_{V,2P2}, and*c*_{V,2P2}are the coefficients of the Nusselt number correlation. These coefficients appear as block parameters in the**Correlation Coefficients**section.*Re*_{seg,V,2P2}is the average vapor Reynolds number for the segment.*Pr*_{seg,V,2P2}is the average vapor Prandtl number for the segment.*k*_{seg,V,2P2}is the average vapor thermal conductivity for the segment.

The average vapor Reynolds number is

$${\mathrm{Re}}_{seg,V,2P2}=\frac{{\dot{m}}_{seg,2P2}{D}_{ref,2P2}}{{\mu}_{seg,V,2P2}{S}_{ref,2P2}},$$

where *μ*_{seg,V,2P2} is the average vapor dynamic
viscosity for the segment.

If the segment is liquid-vapor mixture, then the heat transfer conductance is

$$U{A}_{seg,M,2P2}={a}_{M,2P2}{\left({\mathrm{Re}}_{seg,SL,2P2}\right)}^{{b}_{2P2}}CZ{\left({\mathrm{Pr}}_{seg,SL,2P2}\right)}^{{c}_{2P2}}{k}_{seg,SL,2P2}\frac{{G}_{2P2}}{N},$$

where:

*a*_{M,2P2},*b*_{L,2P2}, and*c*_{L,2P2}are the coefficients of the Nusselt number correlation. These coefficients appear as block parameters in the**Correlation Coefficients**section.*Re*_{seg,SL,2P2}is the saturated liquid Reynolds number for the segment.*Pr*_{seg,SL,2P2}is the saturated liquid Prandtl number for the segment.*k*_{seg,SL,2P2}is the saturated liquid thermal conductivity for the segment.*CZ*is the Cavallini and Zecchin term.

The saturated liquid Reynolds number is

$${\mathrm{Re}}_{seg,SL,2P2}=\frac{{\dot{m}}_{seg,2P2}{D}_{ref,2P2}}{{\mu}_{seg,SL,2P2}{S}_{ref,2P2}},$$

where *μ*_{seg,SL,2P2} is the saturated liquid
dynamic viscosity for the segment.

The Cavallini and Zecchin term is

$$CZ=\frac{{\left(\left(\sqrt{\frac{{\nu}_{seg,SV,2P2}}{{\nu}_{seg,SL,2P2}}}-1\right)\left({x}_{seg,out,2P2}+1\right)\right)}^{1+{b}_{2P2}}-{\left(\left(\sqrt{\frac{{\nu}_{seg,SV,2P2}}{{\nu}_{seg,SL,2P2}}}-1\right)\left({x}_{seg,in,2P2}+1\right)\right)}^{1+{b}_{2P2}}}{\left(1+{b}_{2P2}\right)\left(\sqrt{\frac{{\nu}_{seg,SV,2P2}}{{\nu}_{seg,SL,2P2}}}-1\right)\left({x}_{seg,out,2P2}-{x}_{seg,in,2P2}\right)},$$

where:

*ν*_{seg,SL,2P2}is the saturated liquid specific volume for the segment.*ν*_{seg,SV,2P2}is the saturated vapor specific volume for the segment.*x*_{seg,in,2P2}is the vapor quality at the segment inlet.*x*_{seg,out,2P2}is the vapor quality at the segment outlet.

The expression is based on the work of Cavallini and Zecchin [5], which derives a heat
transfer coefficient correlation at a local vapor quality *x*. Equations
for the liquid-vapor mixture are obtained by averaging Cavallini and Zecchin’s correlation
over the segment from *x*_{seg,in,2P2} to
*x*_{seg,out,2P2}.

### Two-Phase Fluid 2 Weighted Average

The two-phase fluid flow through a segment may not be entirely represented as either
subcooled liquid, superheated vapor, or liquid-vapor mixture. Instead, each segment may
consist of a combination of these. The block approximates this condition by computing
weighting factors (*w*_{L},
*w*_{V}, and
*w*_{M}) based on the change in specific enthalpy
across the segment and the saturated liquid and vapor specific enthalpies. The block assumes
that the specific enthalpy across the segment varies piecewise linearly from inlet to
outlet, with the breakpoints corresponding to the saturation boundaries for liquid and
vapor. The zone with a larger heat transfer coefficient has a steeper slope than the zone
with a lower heat transfer coefficient.

$$\begin{array}{l}{w}_{L}=\frac{{\Delta}_{L}}{{\Delta}_{L}+{\Delta}_{M}+{\Delta}_{V}}\\ {w}_{V}=\frac{{\Delta}_{V}}{{\Delta}_{L}+{\Delta}_{M}+{\Delta}_{V}}\\ {w}_{M}=1-{w}_{L}-{w}_{V}\end{array}$$

$$\begin{array}{l}{\Delta}_{L}=\left|\mathrm{min}\left({h}_{seg,out,2P2},{h}_{seg,SL,2P2}\right)-\mathrm{min}\left({h}_{seg,in,2P2},{h}_{seg,SL,2P2}\right)\right|\cdot U{A}_{seg,M,2P2}\cdot U{A}_{seg,V,2P2}\\ {\Delta}_{M}=\left|\mathrm{min}\left(\mathrm{max}\left({h}_{seg,out,2P2},{h}_{seg,SL,2P2}\right),{h}_{seg,SV,2P2}\right)-\mathrm{min}\left(\mathrm{max}\left({h}_{seg,in,2P2},{h}_{seg,SL,2P2}\right),{h}_{seg,SV,2P2}\right)\right|\cdot U{A}_{seg,L,2P2}\cdot U{A}_{seg,V,2P2}\\ {\Delta}_{V}=\left|\mathrm{max}\left({h}_{seg,out,2P2},{h}_{seg,SV,2P2}\right)-\mathrm{max}\left({h}_{seg,in,2P2},{h}_{seg,SV,2P2}\right)\right|\cdot U{A}_{seg,L,2P2}\cdot U{A}_{seg,M,2P2}\end{array}$$

where:

*h*_{seg,in,2P2}is the specific enthalpy at the segment inlet.*h*_{seg,out,2P2}is the specific enthalpy at the segment outlet.*h*_{seg,SL,2P2}is the saturated liquid specific enthalpy for the segment.*h*_{seg,SV,2P2}is the saturated vapor specific enthalpy for the segment.

The weighted-average two-phase fluid 2 heat transfer conductance for the segment is therefore

$$U{A}_{seg,2P2}={w}_{L}\left(U{A}_{seg,L,2P2}\right)+{w}_{V}\left(U{A}_{seg,V,2P2}\right)+{w}_{M}\left(U{A}_{seg,M,2P2}\right).$$

The weighted-average fluid 2 temperature for the segment is

$${T}_{seg,2P2}=\frac{{w}_{L}\left(U{A}_{seg,L,2P2}\right){T}_{seg,L,2P2}+{w}_{V}\left(U{A}_{seg,V,2P2}\right){T}_{seg,V,2P2}+{w}_{M}\left(U{A}_{seg,M,2P2}\right){T}_{seg,M,2P2}}{U{A}_{seg,2P2}},$$

where:

*T*_{seg,L,2P2}is the average liquid temperature for the segment.*T*_{seg,V,2P2}is the average vapor temperature for the segment.*T*_{seg,M,2P2}is the average mixture temperature for the segment, which is the saturated liquid temperature.

### Pressure Loss

The pressure losses on the two-phase fluid 1 side are

$$\begin{array}{l}{p}_{A,2P1}-{p}_{2P1}=\frac{{K}_{2P1}}{2}\frac{{\dot{m}}_{A,2P1}\sqrt{{\dot{m}}^{2}{}_{A,2P1}+{\dot{m}}^{2}{}_{thres,2P1}}}{2{\rho}_{avg,2P1}}\\ {p}_{B,2P1}-{p}_{2P1}=\frac{{K}_{2P1}}{2}\frac{{\dot{m}}_{B,2P1}\sqrt{{\dot{m}}^{2}{}_{B,2P1}+{\dot{m}}^{2}{}_{thres,2P1}}}{2{\rho}_{avg,2P1}}\end{array}$$

where:

*p*_{A,2P1}and*p*_{B,2P1}are the pressures at ports**A1**and**B1**, respectively.*p*_{2P1}is internal two-phase fluid 1 pressure at which the heat transfer is calculated.$${\dot{m}}_{A,2P1}$$ and $${\dot{m}}_{B,2P1}$$ are the mass flow rates into ports

**A1**and**B1**, respectively.*ρ*_{avg,2P1}is the average two-phase fluid 1 density over all segments.$${\dot{m}}_{thres,2P1}$$ is the laminar threshold for pressure loss, approximated as 1e-4 of the nominal mass flow rate. The block calculates the pressure loss coefficient,

*K*_{2P1}, so that*p*_{A,2P1}–*p*_{B,2P1}matches the nominal pressure loss at the nominal mass flow rate.

The pressure losses on the two-phase fluid 2 side are

$$\begin{array}{l}{p}_{A,2P2}-{p}_{2P2}=\frac{{K}_{2P2}}{2}\frac{{\dot{m}}_{A,2P2}\sqrt{{\dot{m}}^{2}{}_{A,2P2}+{\dot{m}}^{2}{}_{thres,2P2}}}{2{\rho}_{avg,2P2}}\\ {p}_{B,2P2}-{p}_{2P2}=\frac{{K}_{2P2}}{2}\frac{{\dot{m}}_{B,2P2}\sqrt{{\dot{m}}^{2}{}_{B,2P2}+{\dot{m}}^{2}{}_{thres,2P2}}}{2{\rho}_{avg,2P2}}\end{array}$$

where:

*p*_{A,2P2}and*p*_{B,2P2}are the pressures at ports**A2**and**B2**, respectively.*p*_{2P2}is internal two-phase fluid 2 pressure at which the heat transfer is calculated.$${\dot{m}}_{A,2P2}$$ and $${\dot{m}}_{B,2P2}$$ are the mass flow rates into ports

**A2**and**B2**, respectively.*ρ*_{avg,2P2}is the average two-phase fluid 2 density over all segments.$${\dot{m}}_{thres,2P2}$$ is the laminar threshold for pressure loss, approximated as 1e-4 of the nominal mass flow rate. The block calculates the pressure loss coefficient,

*K*_{2P2}, so that*p*_{A,2P2}–*p*_{B,2P2}matches the nominal pressure loss at the nominal mass flow rate.

### Two-Phase Fluid 1 Mass and Energy Conservation

The mass conservation equation for the overall two-phase fluid 1 flow is

$$\left(\frac{d{p}_{2P1}}{dt}{\displaystyle \sum _{segments}\left(\frac{\partial {\rho}_{seg,2P1}}{\partial p}\right)}+{\displaystyle \sum _{segments}\left(\frac{d{u}_{seg,2P1}}{dt}\frac{\partial {\rho}_{seg,2P1}}{\partial u}\right)}\right)\frac{{V}_{2P1}}{N}={\dot{m}}_{A,2P1}+{\dot{m}}_{B,2P1},$$

where:

$$\frac{\partial {\rho}_{seg,2P1}}{\partial p}$$ is the partial derivative of density with respect to pressure for the segment.

$$\frac{\partial {\rho}_{seg,2P1}}{\partial u}$$ is the partial derivative of density with respect to specific internal energy for the segment.

*u*_{seg,2P1}is the specific internal energy for the segment.*V*_{2P1}is the total two-phase fluid 1 volume.

The summation is over all segments.

**Note**

Although the two-phase fluid 1 flow is divided into *N*=3 segments
for heat transfer calculations, all segments are assumed to be at the same internal
pressure, *p*_{2P1}. That is why
*p*_{2P1} is outside of the summation.

The energy conservation equation for each segment is

$$\frac{d{u}_{seg,2P1}}{dt}\frac{{M}_{2P1}}{N}+{u}_{seg,2P1}\left({\dot{m}}_{seg,in,2P1}-{\dot{m}}_{seg,out,2P1}\right)={\Phi}_{seg,in,2P1}-{\Phi}_{seg,out,2P1}+{Q}_{seg,2P1},$$

where:

*M*_{2P1}is the total two-phase fluid 1 mass.$${\dot{m}}_{seg,in,2P1}$$ and $${\dot{m}}_{seg,out,2P1}$$ are the mass flow rates into and out of the segment.

*Φ*_{seg,in,2p1}and*Φ*_{seg,out,2p1}are the energy flow rates into and out of the segment.

The mass flow rates between segments are assumed to be linearly distributed between the values of$${\dot{m}}_{A,2P1}$$ and $${\dot{m}}_{B,2P1}$$.

### Two-Phase Fluid 2 Mass and Energy Conservation

The mass conservation equation for the overall two-phase fluid 2 flow is

$$\left(\frac{d{p}_{2P2}}{dt}{\displaystyle \sum _{segments}\left(\frac{\partial {\rho}_{seg,2P2}}{\partial p}\right)}+{\displaystyle \sum _{segments}\left(\frac{d{u}_{seg,2P2}}{dt}\frac{\partial {\rho}_{seg,2P2}}{\partial u}\right)}\right)\frac{{V}_{2P2}}{N}={\dot{m}}_{A,2P2}+{\dot{m}}_{B,2P2},$$

where:

$$\frac{\partial {\rho}_{seg,2P2}}{\partial p}$$ is the partial derivative of density with respect to pressure for the segment.

$$\frac{\partial {\rho}_{seg,2P2}}{\partial u}$$ is the partial derivative of density with respect to specific internal energy for the segment.

*u*_{seg,2P2}is the specific internal energy for the segment.*V*_{2P2}is the total two-phase fluid 2 volume.

The summation is over all segments.

**Note**

Although the two-phase fluid 2 flow is divided into *N*=3 segments
for heat transfer calculations, all segments are assumed to be at the same internal
pressure, *p*_{2P2}. That is why
*p*_{2P2} is outside of the summation.

The energy conservation equation for each segment is

$$\frac{d{u}_{seg,2P2}}{dt}\frac{{M}_{2P2}}{N}+{u}_{seg,2P2}\left({\dot{m}}_{seg,in,2P2}-{\dot{m}}_{seg,out,2P2}\right)={\Phi}_{seg,in,2P2}-{\Phi}_{seg,out,2P2}+{Q}_{seg,2P2},$$

where:

*M*_{2P2}is the total two-phase fluid 2 mass.$${\dot{m}}_{seg,in,2P2}$$ and $${\dot{m}}_{seg,out,2P2}$$ are the mass flow rates into and out of the segment.

*Φ*_{seg,in,2p2}and*Φ*_{seg,out,2p2}are the energy flow rates into and out of the segment.

The mass flow rates between segments are assumed to be linearly distributed between the values of$${\dot{m}}_{A,2P2}$$ and $${\dot{m}}_{B,2P2}$$.

## Ports

### Output

### Conserving

## Parameters

## Extended Capabilities

## Version History

**Introduced in R2021b**