27 """A text report of where the pressure went."""
29 status =
"converged" if result.converged
else "DID NOT CONVERGE"
31 f
"Steady solve: {status} in {result.iterations} iterations "
32 f
"({result.elapsed * 1e3:.1f} ms)"
37 f
"{'branch':<14} {'from':<10} {'to':<10} "
38 f
"{'mdot':>10} {'dp':>10} {'p_out':>10}"
40 lines.append(f
"{'':14} {'':10} {'':10} {'kg/s':>10} {'bar':>10} {'bar':>10}")
41 lines.append(
"-" * 68)
44 network.branches.values(),
45 key=
lambda b: -result.pressures[b.upstream],
47 for branch
in ordered:
48 dp = result.dp(branch.id, network)
50 f
"{branch.id:<14} {branch.upstream:<10} {branch.downstream:<10} "
51 f
"{result.flows[branch.id]:>10.4f} {dp / _BAR:>10.4f} "
52 f
"{result.pressures[branch.downstream] / _BAR:>10.4f}"
57 f
"mass conservation: worst node imbalance "
58 f
"{result.max_mass_residual:.3e} kg/s"
61 if result.regularised_branches:
63 "derivative floor active at convergence on: "
64 +
", ".join(result.regularised_branches)
65 +
" (branches carrying essentially no flow)"
71 for branch
in network.branches.values()
72 for name
in branch.component.instance.assumptions()
76 lines.append(f
"resting on library defaults: {', '.join(assumed)}")
78 for violation
in result.violations:
79 lines.append(str(violation))
81 return "\n".join(lines)