Solver Lab
Four small models, computed right in your browser. They show how a simulation program advances in time steps and why time step, grid and method decide on stability and accuracy.
VICUS Buildings and VICUS Districts solve large systems of coupled differential equations for room air, wall layers, pipe sections and heat exchangers. The principles behind them can be shown with models that have only a few unknowns. Each experiment runs step by step or as an animation; time step, grid and method can be adjusted. The background is explained in the articles How the VICUS Solver works and How the VICUS Solver simulates a heat network.
1Explicit and implicit: a room cooling down
An unheated room loses heat to the outdoor air. With the time constant , the ratio of heat storage capacity to heat loss coefficient, its balance reads:
The explicit Euler method evaluates the right-hand side at the known state of the old time level, the implicit method at the still unknown new one:
In the explicit method the distance to the outdoor temperature is multiplied by in every step. If this factor is negative, the solution oscillates; if its magnitude exceeds 1, it grows. In the implicit method the factor is , which lies between 0 and 1 for any time step.
Try it: Set the time step to 4 h, then to 7 h. At 7 h, switch to “Implicit”.
A room cools down
- Time
- –
- Steps
- –
- numerical
- –
- exact
- –
- –
Explicit with : stable. The solution approaches the outdoor temperature monotonically; the error shrinks with the time step.
Explicit with : still stable, but the solution overshoots the outdoor temperature and settles only slowly.
Explicit with : unstable. Every step increases the deviation.
Implicit: stable for any time step. Large steps make the solution less accurate, but never unstable.
Unheated room with time constant , initial temperature 22 °C, outdoor air 5 °C. Dashed: the exact solution ; dots: result after each time step.
2Stability limit on a grid: heat conduction through a wall
For the simulation a wall is divided into layers, each layer being one unknown. The explicit method (FTCS) computes grid point from its neighbours in the previous time step:
It is stable only for . Because the grid spacing enters squared, the limit tightens quickly: with 1 cm layers and no more than 100 s per step are allowed, with thin layers of highly conductive materials fractions of a second.
The implicit method uses the neighbour values at the new time level. All grid points then depend on each other, and a system of equations has to be solved in every time step; for a single wall it is tridiagonal and can be solved in operations. There is no stability limit any more.
Try it: With “Explicit” and 10 grid points, raise the time step from 5 to 10 min. Then, at 5 min, raise the number of grid points to 20.
Heat conduction through a wall
- Time
- –
- Steps
- –
- Grid spacing
- –
- –
- Heat flux inside
- –
Explicit with : stable. Each grid point is computed directly from its neighbours in the previous step.
Explicit with : unstable. Because grows with , halving the grid spacing requires a time step four times smaller.
Implicit: stable for any . In return, a tridiagonal system with unknowns is solved in every time step.
24 cm masonry with and , initially 5 °C throughout. From the inside is held at 22 °C, the outside stays at 5 °C. Dashed: the final steady-state profile with ; the strip below shows the wall in section.
3A heat exchanger in the time domain
For sizing, the steady-state ε-NTU method is usually sufficient. A dynamic simulation instead represents the exchanger as two flow channels exchanging heat through the separating wall and divides both into cells. For cell of the hot side, with the heat capacity of the fluid in the cell:
The cold side is built the same way, in counterflow with the opposite flow direction. Once the start-up has settled, the simulation matches the effectiveness of the ε-NTU formula up to the discretisation error, which decreases with the number of cells.
Try it: Set NTU to 6 and switch between counterflow and parallel flow. In parallel flow the cold side can never become warmer than the hot-side outlet.
Heat exchanger in the time domain
- Time
- –
- Hot outlet
- –
- Cold outlet
- –
- Simulation
- –
- Formula
- –
Start-up: both channels are initially filled with water at 15 °C and are flushed from their inlets.
Steady state. Deviation from the ε-NTU formula: percentage points, caused by the coarse division into 24 cells.
The hot side enters at 70 °C, the cold side at 15 °C; each channel is divided into 24 cells with a residence time of 60 s. The simulated effectiveness is evaluated on the cold side: .
4A temperature front in a pipe
In a heat network a temperature change travels with the flow through the pipes and loses heat to the ground at temperature :
In the upwind scheme each cell is fed by its upstream neighbour. The explicit variant is stable as long as the Courant number does not exceed 1. Regardless of that, it smears a sharp front, because the heat spreads over a whole cell in every step. In network simulation this affects transport delays: the coarser the pipe is divided, the less sharply the arrival of a temperature change at the consumer is reproduced.
Try it: Set the time step to 2 s (CFL = 1): the front stays sharp. Then try 3 s, and the same with “Implicit”.
Temperature front in a pipe
- Time
- –
- Steps
- –
- –
- Outlet
- –
- exact
- –
Explicit with : stable. The front still smears over several cells (numerical diffusion of the upwind scheme); only at does it stay sharp.
Explicit with : unstable. The water would travel more than one cell per step, which the scheme cannot represent.
Implicit: stable for any CFL number. The larger the time step, the more the front is smeared.
100 m pipe in 50 cells (), initially 10 °C. From water at 70 °C flows in and loses heat to the 10 °C ground via . Dashed: the exact solution (plug flow); the strip below shows the pipe.
Further reading
- How the VICUS Solver works – State vector, time integration with CVODE, Newton iteration and linear solvers
- How the VICUS Solver simulates a heat network – Hydraulics and thermal behaviour of the network, pipe models and coupling