VICUS Solver: the Engine Behind Heat Network Simulation
How does a solver compute the thermo-hydraulic simulation of a district heating network? From the network graph via the coupling of hydraulics and thermal transport, CVODE and Newton iteration to the sparse linear system — clearly explained.
Table of Contents
Every thermo-hydraulic simulation stands or falls with its computational core, the piece of software that turns network topology, pipe data, load profiles and control logic into a physically reliable pressure, mass-flow and temperature history. In VICUS Districts this core is the VICUS Solver, a simulation solver matured over more than 20 years of research at TU Dresden — the same core that powers VICUS Buildings. This article lifts the hood for the district heating case: step by step it shows how the solver describes a network as a system of equations and integrates it through time.
You do not need a numerics degree for this. The central idea fits in a single sentence, and the interactive demos below can be „cranked through” yourself.
The core idea in one sentence
The solver describes the heat network as a graph of nodes and edges and solves two tightly coupled subproblems on it: the hydraulics — which pressures and mass flows establish themselves? — and the heat transport — how do the temperatures travel through the network? The heart of it is always the same question:
„How fast is the stored energy changing in every fluid volume of the network?”
Once you know this rate of change, you can take a small step into the future, compute the new temperatures and start over. In vector notation, exactly how the time integrator „sees” it, this reads:
Here is the state vector (a long list of all conserved quantities), their rate of change and the time.
The network as a graph
The basis of every calculation is the network topology as a graph: nodes are branching and connection points, edges are the network elements — pipes, pumps, valves, the heat exchangers of the transfer stations, producers. Every element brings two models: a hydraulic one (which pressure difference establishes itself at which mass flow?) and a thermal one (what happens to the temperature of the fluid passing through?).
This separation is not a side note but the central architectural decision of the solver — because the two subproblems live on fundamentally different time scales.
Two subproblems: fast hydraulics, sluggish thermal transport
The hydraulics: steady-state and algebraic
Pressure waves propagate through nearly incompressible water at the speed of sound. From the perspective of the slowly travelling temperatures, the flow field therefore establishes itself instantly. That is why the hydraulics are not integrated over time but solved as a steady-state, algebraic system of equations in every evaluation:
- Mass conservation at every node (Kirchhoff’s first law):
- Pressure loss per element, e.g. for pipes according to Colebrook-White — depending on mass flow and temperature, since the density and viscosity of the fluid change with it (see pressure loss calculation)
This nonlinear system is solved with the Newton-Raphson method. Bidirectional flows — the flow direction reverses, for instance with decentralised feed-in — are automatically included, because the pressure-loss equation is formulated sign-correctly.
The thermal transport: dynamic and time-dependent
Temperatures change comparatively slowly: the fluid stores energy, and a temperature wave takes minutes to hours to travel through the network, depending on flow velocity. Heat transport is therefore formulated as a system of ordinary differential equations — the energy balance of every fluid volume :
with the enthalpy flows and the heat loss to the ground .
Why not put everything into one single large system of equations? That is the route of generic solvers (e.g. in Modelica): one monolithic Jacobian with many direct dependencies. The VICUS Solver takes the considerably more performant second route: the hydraulic system is solved as a separate subproblem within the thermal calculation — two smaller, specialised systems of equations instead of one large one.
Energy instead of temperature: the conserved quantity
As in the building case, the solver does not balance temperature directly but the stored energy — because energy is a conserved quantity whose inflows and outflows can be summed unambiguously. Temperature is a quantity derived from it.
What is in the state vector y?
Part of the y vector | Meaning |
|---|---|
| Pipe segments | energy (mass × specific enthalpy) per finite-volume segment of a pipe |
| Components with fluid volume | heat exchangers, storage tanks, producer circuits |
| Ground | temperatures of the coupled ground model (for cold district heating) |
The dynamic pipe model splits every pipe into segments so that the propagation of temperature waves is captured correctly; each segment is a separate entry in y. The thermal capacity of the pipe wall is attributed to the fluid via a lumped model — the inertia is correct without an additional computational grid for the pipe wall. For large networks this quickly amounts to thousands of unknowns.
Where does ydot come from? The balance, not a guess
The recipe is the same as for every conservation law:
- Choose the conserved quantity
y(energy, mass, …), not the temperature. - Write the balance: d(stored)/dt = Σ inflows − Σ outflows.
- Express each flux through the state (physical laws).
- Solve for
dy/dt; that isydot.
Example: a pipe segment
A segment with fluid mass and heat capacity is passed by the mass flow and loses heat to the ground:
On the left the change in storage, on the right advection (the warm fluid from the previous segment) minus loss. Solved for , this is the ydot for this segment — derived from energy conservation plus flux laws, not invented. Chaining many segments together produces exactly the model that runs in the live demo below: a temperature front travelling along a pipe split into 50 segments.
The runtime evaluation — hydraulics included
There is no closed ydot formula sheet in the network case either. The integrator hands over a y and asks for the rate of change; internally the familiar three-stage pipeline runs:
| Stage | in the heat network |
|---|---|
| Head | energy → temperatures of all segments |
| Middle | solve the hydraulic subproblem (Newton-Raphson → mass flows), then enthalpy flows, heat losses, heat exchangers, control |
| Tail | close the balance per fluid volume → ydot |
The middle stage is remarkable: every single ydot evaluation contains a complete hydraulic network calculation, because without current mass flows there are no enthalpy flows. A dependency graph automatically sorts the sub-models into the correct order — controllers that react to quantities they influence themselves are grouped together and solved iteratively.
The schema, interactively
The visualisation below shows the functional schema of the VICUS Solver with its three nested loops — in the network case it is the same as in the building case, because it is the same computational core. The live demo underneath shows the building block of every network model: a cold pipe, split into segments, into which hot supply water flows from . You can watch the temperature front travel along the pipe at the flow velocity while heat losses damp it on the way — and see where the stability limit of explicit methods lies.
How the VICUS Solver computes
How to read this visualisation — first the overview, then the network building block as a live demo: How to read this visualisation — first the overview, then an example to try yourself:
📖 Each term in one sentence (look up any time)
State → temperature
„unpack“ energy y
- pipe segments
- components
- ground
Compute fluxes
physics at known T
- hydraulics: ṁ, p (Newton-Raphson)
- heat losses to the ground
- heat exchangers, control
Σ fluxes → ẏ
close the balance
- pipe segments
- components
- ground
Step by step: a room cools down
The smallest conceivable simulation model: one zone, one equation. A warm room (22 °C) loses heat to the cold outdoor air (5 °C): $\dfrac{dT}{dt} = -\dfrac{T - T_\text{out}}{\tau}$. Press Step and watch the integrator work its way through time — and turn dt to find the stability limit.
dt the solution overshoots T_out and explodes. Implicit stays stable — at the cost of Newton + LSE. For this linear example the implicit step even resolves directly (without Newton). If the solver takes time steps that are too large, the simple method „overshoots" and computes nonsense. The stable method stays calm — but costs more effort per step. Tip: drag dt past 6 h, then toggle between explicit/implicit. Try it: push dt past 6 h (= 2τ) and step with Explicit Euler — the solution starts to oscillate and explodes, even though physically the room only cools gently. Switch to Implicit Euler: the same large step size stays stable. That is exactly why the VICUS Solver computes stiff building models implicitly (CVODE).
Second example: heat conduction through a wall
Now a partial differential equation — the heat equation $\dfrac{\partial T}{\partial t} = \alpha\,\dfrac{\partial^2 T}{\partial x^2}$. A wall (warm inside, cold outside) is split into N cells; each cell balances only with its neighbours. This turns one PDE into a system of N coupled ODEs — exactly the VICUS Solver’s finite-volume wall, each layer one entry in y. Turn N and see why fine grids bring the explicit method to its knees.
$\dfrac{dT_i}{dt} = \dfrac{\alpha}{\Delta x^2}\,\bigl(T_{i-1} - 2T_i + T_{i+1}\bigr)$
// only the direct neighbours → tridiagonal
The stiffness effect: push N up (finer grid, more accurate!) — for explicit, r = α·dt/Δx² grows quadratically, quickly bursts the limit ½, and the profile jitters and explodes. To stay stable you would have to shrink dt drastically. Implicit solves a tridiagonal system (the LSE!) every step and stays stable for any N and dt. That is exactly why the VICUS Solver discretises walls into many cells and computes implicitly.
Third example: counter-flow heat exchanger
Two fluid streams exchange heat across a wall — hot and cold flow against each other. Split along the length into N segments, each segment has a hot and a cold fluid temperature → 2N coupled ODEs (flow + heat transfer). This is exactly how the VICUS Solver discretises pipes and heat exchangers in thermal networks. Compare counter-flow ↔ parallel-flow and see the effectiveness ε.
$M_h\dfrac{dT_{h,j}}{dt} = \dot C_h\,(T_{h,\text{in}}-T_{h,j}) \;-\; UA_\text{seg}\,(T_{h,j}-T_{c,j})$
$M_c\dfrac{dT_{c,j}}{dt} = \dot C_c\,(T_{c,\text{in}}-T_{c,j}) \;+\; UA_\text{seg}\,(T_{h,j}-T_{c,j})$
// cold: inflow from the other side; $\dot C_h \ne \dot C_c$ allowed
Why counter-flow? In parallel-flow both temperatures converge and end at a common mixing temperature — ε is capped. In counter-flow a nearly constant temperature gap is maintained along the length, and the cold outlet temperature can approach the hot inlet temperature → with large NTU, ε approaches 1.
Unequal capacity rates: the stream with the smaller $\dot C$ changes its temperature more (steeper curve) and sets $\dot C_\text{min}$. For $C_r\to 0$ counter- and parallel-flow give the same $\varepsilon = 1-e^{-\text{NTU}}$. The simulated effectiveness matches the analytic $\varepsilon$-NTU relation:$$\varepsilon_\text{counter} = \frac{1-e^{-\text{NTU}(1-C_r)}}{1-C_r\,e^{-\text{NTU}(1-C_r)}}, \qquad \varepsilon_\text{parallel} = \frac{1-e^{-\text{NTU}(1+C_r)}}{1+C_r}.$$
Live demo: temperature propagation along a pipe
The building block of every network model: a pipe (L = 100 m), split into N = 50 segments — each segment one entry in y. The pipe starts cold at 10 °C; from $t=0$, 70 °C supply water flows in on the left. Each segment balances inflow, outflow and heat loss to the ground. Press Step and watch the temperature front travel along the pipe — and turn v, dt and the loss.
dt up until CFL > 1 — then toggle between explicit/implicit. $M c\,\dfrac{dT_k}{dt} = \dot m c\,(T_{k-1} - T_k) \;-\; UA\,(T_k - T_\text{ground})$
// coupling only to the upstream neighbour → bidiagonal
What happens here: the front travels along the pipe at v — the temperature change reaches the outlet only after the dead time L/v, damped by the loss factor $e^{-\beta L / v}$: slow flow means longer travel time and more cooling. Push dt past the limit CFL = 1: explicit starts to oscillate and explodes, while implicit solves a bidiagonal LSE per step (a single forward sweep) and stays stable. That the computed front is flatter than the exact one is numerical diffusion — exactly why the dynamic pipe model in VICUS Districts splits pipes into many segments.
Time integration: CVODE and the stiffness of the network
Integration uses CVODE from the SUNDIALS package: an implicit, adaptive multi-step method based on BDF (Backward Differentiation Formulas) of order 1 to 5. The step size is not constant — during calm summer operation the solver takes large steps, during the morning load ramp-up or when a producer comes online it takes small ones. The output (hourly values, say) is decoupled from this and cleanly interpolated.
Why implicit? For the same reason as with buildings: stiffness. A short, fast-flowing pipe segment has a time constant of seconds; the ground around the route responds over weeks. Explicit methods would have to follow the fastest time constant and take tiny steps — an annual simulation would become unusably slow. The implicit method stays stable with large steps; the step size is governed solely by the desired accuracy.
Three nested loops — plus a subproblem
The mental map of the implicit solver applies unchanged:
- Outer, the time loop (CVODE): picks the step size
dtand goes fromttot+dt. - Middle, the Newton iteration: solves the nonlinear implicit equation for
y_{n+1}(usually 1–3 iterations). - Inner, the linear system of equations (LSE): in every Newton iteration, is solved once.
The network case adds the special feature that every ydot evaluation in turn solves the hydraulic subproblem via Newton-Raphson. There are thus two separate Jacobians, each with few dependencies — the hydraulic one is formed analytically for simple elements and numerically for controlled components.
Both systems are sparse: a pipe segment couples thermally only with its neighbours along the flow path, a node hydraulically only with the connected edges. The solver exploits this via sparse solvers; for very large networks, iterative Krylov methods with a preconditioner are used (GMRES + ILU). For most projects the solver picks these settings itself — you only touch them when a simulation is too slow or fails to converge.
From network model to solution in five sentences
- The solver describes the heat network as a graph; every element brings a hydraulic and a thermal model.
- The hydraulics (pressures, mass flows) are a steady-state algebraic system solved by Newton-Raphson in every evaluation; the thermal transport (temperatures) is a system of ordinary differential equations .
ydotbalances the energy of every fluid volume — advection minus heat loss — and is evaluated at runtime in three stages, including the hydraulic subproblem.- Integration uses CVODE (implicit BDF method) with adaptive step size plus error control — necessary because network models are stiff.
- Each implicit time step requires a Newton iteration, each Newton iteration a sparse linear system of equations, solved directly (sparse LU) or iteratively (GMRES + ILU).
What this means in practice
For day-to-day network planning you do not need to operate this machinery in detail — but it explains why a genuine thermo-hydraulic annual simulation needs computing time and is nevertheless finished in minutes rather than hours: the domain-specific split into hydraulic and thermal subproblems is the performance lever that makes even large networks with hundreds of participants, decentralised feed-in and prosumer structures reliably computable. The VICUS Solver is the computational core that VICUS Districts is built on; the underlying methodology is documented as open source through the SIM-VICUS research project.
To dig deeper: the article on thermo-hydraulic simulation places the methodology within network planning, pressure loss calculation shows the hydraulic equations in detail, and VICUS Solver: the Engine Behind VICUS Buildings explains the same core from the building perspective — with further interactive demos on the Newton iteration and the linear system of equations.
Frequently Asked Questions
What does the VICUS Solver compute for a heat network?
Why are hydraulics and thermal transport formulated separately?
What is ydot in heat network simulation?
Why does network simulation compute implicitly rather than explicitly?
How large do the systems of equations get?
Related Articles
Fundamentals of thermo-hydraulic simulation in district heating networks: methods, models and application
Disclaimer: The content of this page is for general information purposes only and does not constitute legal, planning or engineering advice. All information is provided without guarantee. Despite careful research, VICUS Software GmbH assumes no liability for the accuracy, completeness or timeliness of the information provided. Third-party product names and trademarks are mentioned for informational purposes only and are the property of their respective owners.