Degrees of Freedom¶
The question students ask most is "why does DWSIM want this number, and why won't it take that one?". The answer is always the same count: a unit has as many degrees of freedom as unknowns minus equations, and its calculation mode says which of your numbers fill them.
What you will learn
- How many numbers a feed stream needs, and why
- What a calculation mode is, and how it moves a number from result to specification
- What over- and under-specification look like, and how the Flowsheet Check reports them
- Why a computed stream refuses your values
1. The count¶
For any object: degrees of freedom = variables the object introduces minus equations it brings. A sequential-modular simulator solves one unit at a time from its inlets, so the degrees of freedom of a unit are simply the values it still needs from you once its inlets are known.
A feed stream¶
A stream with n compounds has n + 3 unknowns worth fixing: the composition (n - 1
independent fractions, since they sum to 1), a flow, and two intensive variables. The phase rule
allows two intensive variables for a mixture of fixed composition, so the count is:
| You give | Count |
|---|---|
| Composition | 1 (the whole vector) |
| Flow | 1 |
| Two of temperature, pressure, vapour fraction, enthalpy, entropy | 2 |
| Total | 4 |
Give three and the stream is under-specified; the Flowsheet Check reports FEED_NO_TEMPERATURE,
FEED_NO_PRESSURE or FEED_NO_FLOW. Give a fifth and DWSIM ignores it: the specification type
of the stream (temperature and pressure, pressure and vapour fraction, ...) decides which two it
reads.
A unit operation¶
A heater introduces one outlet stream (fully determined by the balance once one more number is known) and one energy stream. The mass balance and the pressure rule fix everything except one thing, so a heater has one degree of freedom, and its calculation mode names it:
| Mode | You give | The heater computes |
|---|---|---|
| Outlet Temperature | outlet temperature | duty |
| Heat Added | duty | outlet temperature |
| Outlet Vapour Fraction | vapour fraction | duty and temperature |
| Temperature Change | delta T | duty |
| Energy Stream | nothing (the energy stream carries the duty) | outlet temperature |
Switching the mode does not add or remove a degree of freedom; it moves one number from the result column to the specification column. This is the single most useful idea for reading the editors: every box is either a specification or a result, and the mode decides which.
Other units follow the same pattern:
| Unit | Degrees of freedom | Typical modes |
|---|---|---|
| Valve | 1 | outlet pressure, pressure drop, Kv |
| Compressor, pump | 1 (plus an efficiency) | outlet pressure, pressure rise, power from the energy stream |
| Separator | 0 | flashes at the feed conditions (2 if you override T and P) |
| Heat exchanger | 1 to 2 depending on the mode | hot outlet T, cold outlet T, both from UA, area from both outlets |
| Shortcut column | 5 | light and heavy keys, their purities, reflux ratio, pressures |
| Rigorous column | 2 (once stages, feeds and pressures are fixed) | condenser and reboiler specifications |
| Conversion reactor | 1 per reaction (the conversion) | isothermal, adiabatic, outlet temperature |
Try it
Open any tutorial sample, then Flowsheet Analysis > Flowsheet Check (F8) and the Degrees of Freedom tab. Every object is listed with the slots its mode reads and whether each has a value. Change a heater's mode in its editor, run the check again, and watch the slot change name.
2. Over- and under-specification¶
- Under-specified: a slot is empty. The solver stops at that unit with a message naming it. The Flowsheet Check reports it before you solve.
- Over-specified: you typed a value into a box that is a result in the current mode. DWSIM simply overwrites it when it solves; the number you typed is lost. If a value keeps "changing back", this is why.
- Inconsistent: two specifications that no physical state satisfies, such as a stream at a temperature below its bubble point with a vapour fraction of 0.5. The flash fails or converges to nonsense; the Common Mistakes page lists the usual cases.
3. Computed streams¶
A stream attached to the outlet of a unit belongs to that unit. Its editor still shows the boxes, but nothing you type survives a solve. Two consequences students meet early:
- To set the outlet temperature of a heater, set it on the heater, in Outlet Temperature mode.
- To fix the state of a stream in the middle of a flowsheet (a common way to start a recycle), you either use a Recycle block or cut the flowsheet there and make the stream a feed.
4. The whole flowsheet¶
The flowsheet is fully specified when every object's count is zero. The Flowsheet Check sums the remaining slots; a total of zero means the sequential solve can run to the end. It does not mean the result is sensible: that is what the plausibility findings and Explain Result are for.
Exercises¶
- Take Tutorial 02 - Heater and Cooler. Switch the heater from Outlet Temperature to Heat Added, type the duty the previous solve reported, and solve. Does the outlet temperature come back the same? Now type a duty 20 % larger: what changes, and what stays?
- On the same flowsheet, type a temperature into the heater's outlet stream and solve. Explain what happened to your value, and where the temperature you see came from.
- Count the degrees of freedom of the shortcut column in Tutorial 04 - Distillation Column (or a shortcut column you add): list the five numbers it needs and mark which are purities and which are operating choices.