Unexpected behavior in two-phase pipe model : outlet temperature increases while heat flow is out of the fluid
Show older comments
Hi,
I am currently doing a research internship at I2M (Talence, France) on numerical modeling of energy systems for undergraduate and postgraduate teaching using Simscape. I am a junior mechanical/aerospace engineering student.
We are trying to model a simple case: water vapor flowing in a pipe exposed to an isothermal environment, with possible condensation. Perhaps, we have some very weird behaviors of our Simscape model. What we expected is that at the pipe inlet, we have water vapor at 150°C, 1 atm. The pipe exchanges heat with an ambient environment at T_\infty through the thermal port H (convection + conduction network). If heat transfer is sufficient, we expect:
- Superheated vapor cools down to T_{sat}=100°C (isobaric at 1 atm),
- During phase change, temperature remains at 100°C while vapor quality decreases from 1 to 0,
- Once fully liquid, temperature decreases further toward T_\infty (depending on heat transfer magnitude and pipe length).
This behavior is reproduced with a simple MATLAB 1D model (attached to this ticket).
Our Simscape model setup is :
- Pipe (2P) block
- Inlet side connected to Reservoir (2P) set to 1 atm and T_{in}=150°C
- Outlet side connected to Reservoir (2P) set to 1 atm and T_{out}=T_{in}=150°C (we also tested Controlled Reservoir (2P) and Constant Volume Chamber (2P))
- Flow driven by a Mass Flow Rate Source (2P) (imposed \dot{m})
- Thermal interaction: the pipe thermal port H is connected to an external thermal network representing ambient temperature T_\infty (Convection and conduction are all ready modeled with the Pipe (2P) block)
When plotting outlet temperature and vapor quality versus time, we observe non-physical results. For example:
- The fluid temperature at the outlet sometimes increases, even though the measured heat flow from the pipe to the environment is negative (i.e., heat leaving the fluid/pipe toward the ambient).
- Changing the outlet boundary block (Reservoir vs Controlled Reservoir vs Constant Volume Chamber) changes the behavior, but the results remain very weird.
- Using a Reservoir (2P) at the outlet requires specifying a temperature, which is confusing for this application since the outlet temperature should be determined by the model. Moreover, changing this outlet reservoir temperature leads to very different and sometimes non-physical results.
Our questions are :
- What is the recommended boundary condition setup for a two-phase pipe open to atmosphere when the outlet temperature should be computed, not imposed?
- Is Reservoir (2P) an appropriate outlet boundary for this type of problem, or should we use another block (e.g., constant volume, controlled reservoir, etc.)?
- Have we correctly understood how to modelise the heat transfer between the pipe and the environment to ensure consistent energy balance and physically correct condensation behavior?
PS : Please run the MATLAB file first. Both files share the same workspace.
Thank you for your help.
Best regards,
Enzo COMBAUD--NIETO
I2M – Talence, France
Accepted Answer
More Answers (1)
Erin McGarrity
on 2 Feb 2026
0 votes
Hi Enzo,
Try extending the simulation time for your model to 3600 s. I believe this will produce the expected result (outlet temp asymptotes to slightly above T_infty -- see plot below.). As a debugging tool, I suggest you turn on the Simscape Results Explorer. This tool will let you examine the states inside the pipe.
Another thing I noticed is that your Flow Rate Source (2P) is set to Isentropic, which means it will raise the fluid temperature isentropcally. You may want to set that to "None".
HTH,
Erin

1 Comment
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!