oemof / tespy

Thermal Engineering Systems in Python (TESPy). This package provides a powerful simulation toolkit for thermodynamic modeling of thermal engineering plants such as power plants, heat pumps or refrigeration machines.
https://tespy.readthedocs.io
MIT License
281 stars 86 forks source link

Choice of inlets of combustion chamber affects simulation convergence #482

Closed tub-hofmann closed 10 months ago

tub-hofmann commented 10 months ago

https://tespy.readthedocs.io/en/main/api/components.html#tespy.components.combustion.base.CombustionChamber

The note on combustion chamber reads:

The fuel and the air components can be connected to either of the inlets.

But changing the topology of the inlets (air from in1 to in2, and fuel from in2 to in1) results in abort of calculation. No convergence.

from tespy.networks import Network
from tespy.components import (Sink, Source, CombustionChamber)
from tespy.connections import Connection

# fluids
air = {'O2': 0.2, 'N2': 0.8}
fuel = {'CH4': 1}

# network
combustion = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')

# components
src_air = Source('air-source')
src_fuel = Source('fuel-source')
snk_fluegas = Sink('flue-gas-sink')
cmp_cc = CombustionChamber('combustion chamber')

# connection
c01 = Connection(src_air, 'out1', cmp_cc, 'in1')
c02 = Connection(src_fuel, 'out1', cmp_cc, 'in2')
c03 = Connection(cmp_cc, 'out1', snk_fluegas, 'in1')

combustion.add_conns(c01, c02, c03)

# parameters

# components
cmp_cc.set_attr(lamb=1.05)

# connections
c01.set_attr(p=1, T=25, fluid=air)
c02.set_attr(m=1, T=25, fluid=fuel)

# solve
combustion.solve(mode='design')
combustion.print_results()

#changing topology of combustion chamber inlets
combustion.del_conns(c01, c02, c03)

c01 = Connection(src_air, 'out1', cmp_cc, 'in2')
c02 = Connection(src_fuel, 'out1', cmp_cc, 'in1')
c03 = Connection(cmp_cc, 'out1', snk_fluegas, 'in1')

combustion.add_conns(c01, c02, c03)

# parameters

# components
cmp_cc.set_attr(lamb=1.05)

# connections
c01.set_attr(p=1, T=25, fluid=air)
c02.set_attr(m=1, T=25, fluid=fuel)

# solve
combustion.solve(mode='design')
combustion.print_results()
fwitte commented 10 months ago

Hi @tub-hofmann,

thanks for the hint, I have found the bug, #483 resolves it. I'll upload one more version to pypi then... ;)

Best