Adjusting combustion component leads to no progress while solving #888
-
|
Hi! I am trying to include NO generation in the combustion component in my tespy fork but have some solving issues. When I test it with: from tespy.components import (
Source, Sink,
SimpleHeatExchanger,
DiabaticCombustionChamber,
)
from tespy.tools.fluid_properties.wrappers import PyromatWrapper
from tespy.connections import Connection
from rva_classes import ModelTemplate
class my_PyromatWrapper(PyromatWrapper):
def _set_constants(self):
self._p_min, self._p_max = 100, 1000e5
self._T_crit, self._p_crit = 180.15, 6400000 #self.AS.critical() not supported by pyromat
self._T_min, self._T_max = self.AS.Tlim()
self._molar_mass = self.AS.mw()
class create_solvent_combustion(ModelTemplate):
def _create_network(self) -> None:
super()._create_network()
amb = Source('ambient air')
sf = Source('fuel')
fg = Sink('flue gas outlet')
self.comb = DiabaticCombustionChamber('combustion chamber')
self.hex = SimpleHeatExchanger('heat exchanger')
self.amb_comb = Connection(amb, 'out1', self.comb, 'in1')
self.sf_comb = Connection(sf, 'out1', self.comb, 'in2')
self.comb_hex = Connection(self.comb, 'out1', self.hex, 'in1')
self.hex_fg = Connection(self.hex, 'out1', fg, 'in1')
self.nw.add_conns(self.sf_comb, self.amb_comb, self.comb_hex, self.hex_fg,
)
self.comb.set_attr(ti=500000, pr=0.95, eta=1, lamb=4, f_nox= 0.00025)
self.amb_comb.set_attr(
p=1.2, T=20,
fluid={'Ar': 0.0129, 'N2': 0.7553, 'CO2': 0.0004, 'O2': 0.2314, 'ig::NO':0},
fluid_engines={"NO": my_PyromatWrapper},
)
self.sf_comb.set_attr(
p=1.3, T=25, fluid={'CO2': 0.03, 'H2': 0.01, 'CH4': 0.96, 'ig::NO':0},
fluid_engines={"NO": my_PyromatWrapper},
)
self.hex.set_attr(pr=0.95)
#self.comb_hex.set_attr(T=1200)
self.hex_fg.set_attr(T=200)
rva= create_solvent_combustion()
rva.nw.solve('design')I get the following output: I needed to adjust some other things to make use of pyromat fluid engine for NO. What am I am missing here? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @HaSchneider, great addition, thank you! I think there is two issues in the implementation right now: First, you do need to subtract the mass of pure nitrogen vanishing from the mass balance due to conversion to NO. It seems (to me) in the first elif block that you were calculating the difference between what was available and what is converted. I think this would be the correct formulation (but please confirm): if self.lamb.val_SI < 1:
dm=0
elif n_nitrogen >= inl[1].m.val_SI*self.f_nox.val_SI /0.03001 *0.5: #molar mass of NO: 0.03001 kg/mol
dm = -inl[1].m.val_SI* self.f_nox.val_SI /0.03001 *inl[0].fluid.wrapper[self.n2]._molar_mass *0.5 #molar mass of NO: 0.03001 kg/mol
else:
dm= -n_nitrogen * inl[0].fluid.wrapper[self.n2]._molar_massSecond, you also have to add a elif fluid == "NO":
# nitrogen
n_nitrogen = 0
for i in inl:
n_nitrogen += (
i.m.val_SI
* i.fluid.val.get(self.n2, 0)
/ inl[0].fluid.wrapper[self.n2]._molar_mass
)
if self.lamb.val_SI < 1:
dn=0
elif n_nitrogen >= inl[1].m.val_SI*self.f_nox.val_SI /0.03001 *0.5: #molar mass of NO: 0.03001 kg/mol
dn = inl[1].m.val_SI* self.f_nox.val_SI /0.03001#molar mass of NO: 0.03001 kg/mol
else:
dn = n_nitrogen
dm = dn * (inl[0].fluid.wrapper[self.n2]._molar_mass + inl[0].fluid.wrapper[self.o2]._molar_mass) / 2Can you test if this gives the expected results? Best Francesco |
Beta Was this translation helpful? Give feedback.
Hi @HaSchneider,
great addition, thank you! I think there is two issues in the implementation right now:
First, you do need to subtract the mass of pure nitrogen vanishing from the mass balance due to conversion to NO. It seems (to me) in the first elif block that you were calculating the difference between what was available and what is converted. I think this would be the correct formulation (but please confirm):