tespy icon indicating copy to clipboard operation
tespy copied to clipboard

The `SectionedHeatExchanger` and `MovingBoundaryHeatExchanger` boundary identification does not work in some cases

Open fwitte opened this issue 2 weeks ago • 0 comments

Specifically, if the phase change happens at the inlet or the outlet exactly. In that case, brentq cannot find different signs in the saturation point search and throws a ValueError. The solutions may be:

  • Check if we are at boundary before running into the problem
  • try except that part and do not include additional boundary

I experienced this problem in a bigger model, which does not help here as a minimal reproducible example. In principle, this could lead to the problem (it does not for me). It seems to be a bit tricky to build a minimal example where we can observe this.

nw = Network()
nw.units.set_defaults(temperature="°C", pressure="bar")

so1 = Source("source1")
so2 = Source("source2")

si1 = Sink("sink1")
si2 = Sink("sink2")

mbsh = MovingBoundaryHeatExchanger("heatex")

c1 = Connection(so1, "out1", mbsh, "in1", label="c1")
c2 = Connection(mbsh, "out1", si1, "in1", label="c2")
c3 = Connection(so2, "out1", mbsh, "in2", label="c3")
c4 = Connection(mbsh, "out2", si2, "in1", label="c4")

nw.add_conns(c1, c2, c3, c4)

c1.set_attr(fluid={"Air": 1}, T=80, p=1, m=1)
c2.set_attr(T=60)

c3.set_attr(fluid={"NH3": 1}, T=0, x=1)
c4.set_attr(td_dew=5)

mbsh.set_attr(pr1=0.9, dp2=0.1)

nw.solve("design")

fwitte avatar Dec 16 '25 06:12 fwitte