Main Content

Modeling Thermal Liquid Systems

When to Use Thermal Liquid Blocks

The Thermal Liquid library expands the fluid modeling capability of Simscape™. With this library, you can account for thermal effects in a fluid system. For example, you can model the warming effect of viscous dissipation in a pipe. You can also account for the temperature dependence of fluid properties, e.g., density and viscosity.

To decide whether Thermal Liquid blocks fit your modeling needs, consider the fluid system you are trying to represent. Other Simscape blocks, such as Hydraulic or Two-Phase Fluid, may better suit your application. Assess the following:

  • Number of phases

    Is the fluid medium single phase or multiphase?

  • Relevant phases

    Is the fluid medium a gas, a liquid, or a multiphase mixture?

  • Thermal effects

    Does temperature change significantly in the time scale of the simulation? Are thermal effects important for analysis? Are the temperature dependences of the liquid properties important?

As a rule, use Thermal Liquid blocks for fluid systems in which a single-phase liquid experiences significant temperature changes.

Modeling Workflow

The suggested workflow for Thermal Liquid models includes four steps:

  1. Establish model requirements — Define the purpose and scope of the model. Then, identify the relevant components and interactions in the model. Use this information as a guide when building the model.

  2. Model physical components — Determine the appropriate blocks for modeling the relevant components and interactions. Then, add the blocks to the model canvas and connect them according to the Simscape connection rules. Specify the block parameters.

  3. Prepare model for analysis — Add sensors to the model. Alternatively, configure the model for Simscape data logging. Check the physical units of each sensed variable.

  4. Run simulation — Configure the solver settings. Then, run the simulation. If necessary, refine the model until you achieve the desired fidelity level.

Establish Model Requirements

The foundation of a good model is a clear understanding of its purpose and requirements. What are you trying to accomplish with the model? What are the relevant components, processes, and states? Determine what is essential and what is not. Start simple, using a rough approximation of the physical system as a guide. Then, iteratively add detail to reach the appropriate model fidelity for your application.

An insulated oil pipeline buried underground provides an example. As oil flows through the pipeline, it experiences conductive heat losses due to the cooler pipeline surroundings. Heat flows across three material layers—pipe wall, insulant, and soil—causing oil temperature to drop. However, only conduction across soil and insulant layers matter. A typical pipe wall is thin and conductive, and its effect on conductive heat loss is minimal at best. Omitting this process simplifies the model and speeds up simulation.

You also must determine the dimensions and properties of each component. During modeling, you specify these parameters in the Simscape blocks for the components. Obtain the physical properties of the liquid medium. Manufacturer data sheets typically provide this data. You can also use analytical expressions to define the physical property lookup tables.

When modeling pipes, consider the impact that dynamic compressibility and flow inertia have on the transient system behavior. If the time scale of an effect exceeds the simulation run time, the impact is usually negligible. During modeling, turn off negligible effects to improve simulation speed. Characteristic time scales for dynamic compressibility and flow inertia are approximately L/c and L/v, respectively, where:

  • L is the length of the pipe.

  • v is the mean flow velocity through the pipe.

  • c is the speed of sound in the liquid medium.

If you are unsure whether an effect is relevant to your model, simulate the model with and without that effect. Then, compare the two simulation results. If the difference is substantial, leave that effect in place. The result is greater model fidelity at small time scales, e.g., during transients associated with flow reversal in a pipe.

Model Physical Components

Start by adding a Thermal Liquid Settings (TL) block to the model canvas. Use this block to provide the physical properties of the liquid medium. Double-click the block and enter the physical property lookup tables that you acquired during the planning stage.

Identify the appropriate blocks for representing the physical components and their interactions. Components can be simple, requiring a single block, or complex, requiring multiple blocks, typically within a Simulink® Subsystem block. Add the blocks to the model canvas and connect them according to the Simscape connection rules.

The ssc_tl_hydraulic_fluid_warming example shows simple and complex components. The Mass Flow Rate Source (TL) represents an ideal power source. It is a simple component. The Double-Acting Cylinder subsystem block represents the mechanical part of a hydraulic actuator. It contains two Translational Mechanical Converter (TL) blocks and is a complex component.

Once you have connected the blocks, specify the relevant parameters. These include dimensions, physical states, empirical correlation coefficients, and initial conditions. In Pipe (TL), Rotational Mechanical Converter (TL), and Translational Mechanical Converter (TL) blocks, select the appropriate setting for effects such as dynamic compressibility and flow inertia.


For accurate simulation results, always replace the default parameter values with data appropriate for your model.

Prepare Model for Analysis

To analyze a model, you must set up that model for data collection. The simplest approach is to add sensor blocks to the model. The Thermal Liquid library provides two sensor block types: one for Through variables (mass and energy flow rates), the other for Across variables (pressure and temperature). By using the PS-Simulink Converter block, you can specify the physical units of the sensed variable.

An alternative approach is to use Simscape data logging. This approach, which uses MATLAB® commands instead of blocks, provides access to a broader range of model variables and parameters. One example is the kinematic viscosity of the liquid medium inside a pipeline segment. You can analyze this parameter using Simscape data logging but not sensor blocks.

For an overview of Simscape data logging, see About Simulation Data Logging. For an example of how to plot logged data, see Log and Plot Simulation Data.

Run Simulation

The final step in the modeling workflow is to simulate the model. Before running simulation, check that the numerical solver is appropriate for your model. To do this, use the Configuration Parameters dialog box.

For physical models, variable-step solvers such as daessc, ode23t, and ode15s typically perform best. Reduce step sizes and tolerances for greater simulation accuracy. Increase them instead for faster simulation.

Run the simulation. Plot simulation data from sensors and Simscape data logging, or process it for further analysis. If necessary, refine the model. For example, correct simulation issues or to improve model fidelity.

Related Examples

More About