Room Heating

This application example will explore room heat distribution as a combined SystemModel and partial differential equation (PDE) model. The coupling will be unidirectional, as the system modeler model will be used to drive the PDE analysis. In a first step, the System Modelers "Thermal College Virtual Lab" is used to explore a virtual model of a room. In a second step, a PDE model is created that will compute the actual heat distribution in the room.

The System Modeler part of this application example being based on a virtual lab offers the benefit of a well-documented system model. If this is a first exposure to system modeler models, going through the "Thermal College Virtual Lab" is advised to gain an understanding of how the System Modeler works.

Lumped Room Model

In this section, the room model that was created with System Modeler is brought into the Wolfram language. In a next step, different setting are applied to understand how they affect the room energy dynamics.

Import Lumped System Model

As a first step the system model library "CollegeThermalFEM.mo" is imported. When this is done, then there is no need to open the System Modeler application separately. The model library provides several premade models.

Import the all College Thermal library:

To use a specific model, in this case the "RoomModelRome", is selected from the model library. The model can be opened by checking its children.

Inspect the models provided by the model library:
Drill deeper into the model:
Open the room heating model and visualize a diagram of it:

Now, that the model is loaded it can be simulated. This is done using SystemModelSimulate.

Run the simulation:

The result is a SystemModelSimulationData that contains all simulation results of interest.

Visualize default System Modeler plots with the SystemModelPlot function:

Other variables can also be plotted by specifying the correct variable name.

Plot the room temperature:

Varying Outside Temperature

The room behavior is analyzed with time-dependent temperature data. The model has some predefined temperature data as a function of time in seconds.

Visualize the temperature data used in the model:

The idea is now to test the model for the varying spring temperature.

Since during spring the outside temperature is around the reference temperature of 20 °C, the radiator is mostly in the OFF state. It is switched ON during the evening when the temperature goes below the reference temperature.

For effective testing of the various scenarios, parameters with sliders are created in the following interactive plot.

PDE Room Model

In this section, a 2D model of our room is build. The mode is then used to study how temperature changes across the room by using values for the boundary conditions that come from the System Modeler model.

The idea is to find the heat distribution in the room that ensures an average temperature of 20 degrees in the room. For this a parametric partial differential equation is set up where a parameter models the heat generated by the heater. For a given heater value a temperature distribution in the room can then be found. The integration over this temperature distribution will give an average temperature in the room for a given value of the heater. This will allow to find the value of the heater such that the average temperature in the room is 20 degrees.

Load the FEM package:

Heat Transfer Model Setup

One possibility to model the heat distribution in the room is to use a heat transfer equation and use a partial differential equation model to describe the room. The room will be a simple rectangular geometry.

The heat transfer PDE is given as:

The dependent variable in the heat equation is the temperature , which varies with time and position . The partial differential equation (PDE) model describes how thermal energy is transported over time in a medium with density and specific heat capacity . The specific heat capacity is a material property that specifies the amount of heat energy that is needed to raise the temperature of a substance with unit mass by one degree Kelvin.

Besides the time derivative part the PDE is made up of several components. First and foremost, there is a diffusive term: with a thermal conductivity .

More information about modeling with the heat transfer equation can be found in the HeatTransfer monograph.

Model Parameter Setup

Our goal is to find a steady-state temperature distribution of the room. This means that the temperature dependent terms can be dropped, arriving at:

Set up the PDE model variables:

Set up a rectangular domain with a width of 4 [m] and a length of 4 [m] to model the room and a radiator is positioned close to the wall.

Create the room model geometry in meters:

Next, create a mesh of the room. Note that the radiator is to be a part of the mesh. The region of the radiator is used as the position for the energy source .

Create a mesh:
Inspect the mesh:

To make use of specific material parameters in the equation the relevant data is extracted from the ThermodynamicData.

In this model, the focus is on the temperature distribution within the room, with air assumed as the medium. The thermal conductivity of air is required for the heat transfer PDE model. The value of the room medium's thermal conductivity, however, was not required for the System Modeler model. There the thermal conductivity of the walls was utilized in its computation. This means that the thermal conductivity of the room's medium air was not set in the system model and it is set here.

Get a value thermal conductivity value for air:
Set up the PDE model parameters:

Now comes the crucial step where a parametric heat source, the radiator, is defined. For all spatial coordinates that are within the sub domain of the radiator, a heat source of is active. Outside of the radiator there is 0 heat generated.

Set up the heat source :

Next, specify the boundary conditions for the four walls. Because the system model is a transient model a specific time at which to extract the data needs to be chosen. In this case the time of the system modeler simulation time was chosen arbitrarily.

Set a system modeler time at which the system model simulation data is extracted:
Extract the wall temperature from the model at time systemModelTime:
Set up the temperature at the walls with the value from system modeler:
Set up the PDE:

Now have all components are available to set up the parametric function.

Set up the parametric function:

To get a better understanding of how the model behaves the model s probed with a somewhat random value for the heat source.

Evaluate the mode with a value:
Visualize the steady-state temperature distribution:

The average value of the room temperature for a specific value is what is of interest. For this a helper function average is written.

A helper function to compute the average room temperature for a given value:
Compute the average room temperature for :

As a last step the value of , that gives an average room temperature of 20 degrees is sought.

Find the for an average temperature:
Re-insert the value into the model and obtain a temperature distribution for that value.
Visualize the temperature distribution for an average room temperature of 20 degrees.

Going from a lumped model to a PDE can be tricky since the lumped model makes assumptions that can not be recovered later but are needed for the PDE model. For example, the temperature of the radiator, the room and the interior walls are all the same in lumped scenario which does not reflect reality.