# Equations for Simscape component Pipe (2P)

10 views (last 30 days)
Lukas Mårtensson on 31 Mar 2022
Commented: Lukas Mårtensson on 18 Jul 2022
Currently, I'm using the Simscape component Pipe (2P) as part of a larger system, and I want to understand the equations governing the behaviour of the pipe. There are however a few equations that confuse me, for example the calculation of the Nusselt number. The documentation says But after studying the code, I can't see any so called "blending" of the Nusselt numbers in laminar and turbulent flow. Instead, it seems as if the Nusselt number in subcooled or superheated fluid is calculated as , where is the Nusselt number in turbulent flow, and is the Nusselt number in laminar flow. Likewise, in the two-phase region, with a mixture of gas and liquid, the Nusselt number is given by , where is the Nusselt number in the two phase region in the turbulent flow regime. As far as I can see when looking through the code, there is no blending here. Am I missing something, or is there a discrepancy between the documentation and the actual code?

Yifeng Tang on 15 Jul 2022
The blending happens in lines 324-327 (R2022a):
% Smooth transition for heat transfer coefficient between liquid, mixture, and vapor
heat_transfer_coeff = simscape.function.blend( ...
simscape.function.blend(Nu_I*k_I/Dh, Nu_mix_I*k_sat_liq_I/Dh, 0, A.transition_range, alpha_I), ...
Nu_I*k_I/Dh, (1 - A.transition_range), 1, unorm_I);
The simscape.function.blend applies a 3rd order polynomial inside. You can select it and right click to open its code (or Ctrl+D).
function y = blend(y1,y2,x1,x2,x)
% y = blend(y1,y2,x1,x2,x)
% Blend between two values y1 and y2 as x varies between x1 and x2. The
% blending function ensures y is continuous and differentiable in the
% range x1 <= x <= x2.
% Copyright 2017-2018 The MathWorks, Inc.
definitions
u = (x-x1)/(x2-x1);
transition = 3*u^2 - 2*u^3;
y = if le(x,x1)
y1;
elseif ge(x,x2)
y2
else
(1-transition)*y1 + transition*y2;
end
end
end
##### 1 CommentShowHide None
Lukas Mårtensson on 18 Jul 2022
First of all, thanks for the answer! However, I'm not quite sure this answers my question. What I'm confused about is the calculation of the variables Nu_I and Nu_mix_I, as it is stated in the documentation that these are calculated via interpolation (with blend) in the transitional region between laminar and turbulent flow. I could not find where this interpolation/blending is performed in the code, however. Lines 324-327 that you are referring to seem to only blend the Nusselt number in the region between subcooled, mixed and superheated fluid, not turbulent vs laminar flow.

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!